miner.py 1.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#!/usr/bin/env python
import gi
from gi.repository import TrackerMiner, GLib, GObject, Gio


class MyMiner (TrackerMiner.Miner):
    __gtype_name__ = 'MyMiner'

    def __init__ (self):
        TrackerMiner.Miner.__init__ (self,
                                     name="MyMiner",
                                     progress=0,
                                     status="fine")
        # This shouldn't be needed, but at the moment the
        # overrided methods are not called
        self.connect ("started", self.started_cb)

        # Say to initable that we are ok
        self.init (None)

    def started (self, x):
        print "override started"

    def started_cb (self, x):
        print "started as callback"

    def stopped (self):
        print "override stopped"

    def resumed (self):
        print "override resumed"

    def paused (self):
        print "override paused"

    def progress (self):
        print "override progress"

if __name__ == "__main__":
    m = MyMiner ()
    m.start ()

    GObject.MainLoop().run ()