class DustBinApplication: def __init__(self): # create the dust bin self.Bin = DustBin() self.indicator = DustBinIndicator("dustbin", "/home/vinod/Code/DustBin/trash-dark.png", appindicator.CATEGORY_APPLICATION_STATUS) self.indicator.initWidgets() self.indicator.SetSize(self.Bin.Size()) # create the folder change notifier wm = pyinotify.WatchManager() wdd = wm.add_watch(TRASH_FILE_DIR, mask, rec=True) handler = EventHandler(self.Bin, self.indicator) self.Notifier = pyinotify.Notifier(wm, handler, timeout=10) # Add the timer gobject.timeout_add(100, self.CheckTrash) def CheckTrash(self, widget=None): assert self.Notifier._timeout is not None, 'Notifier must be constructed with a short timeout' self.Notifier.process_events() while self.Notifier.check_events(): #loop in case more events appear while we are processing self.Notifier.read_events() self.Notifier.process_events() return True def main(self): gtk.main()
def __init__(self): # create the dust bin self.Bin = DustBin() self.indicator = DustBinIndicator("dustbin", "/home/vinod/Code/DustBin/trash-dark.png", appindicator.CATEGORY_APPLICATION_STATUS) self.indicator.initWidgets() self.indicator.SetSize(self.Bin.Size()) # create the folder change notifier wm = pyinotify.WatchManager() wdd = wm.add_watch(TRASH_FILE_DIR, mask, rec=True) handler = EventHandler(self.Bin, self.indicator) self.Notifier = pyinotify.Notifier(wm, handler, timeout=10) # Add the timer gobject.timeout_add(100, self.CheckTrash)