def __init__(self): dbus_main_loop = dbus.glib.DBusGMainLoop(set_as_default=True) session_bus = dbus.SessionBus(dbus_main_loop) bus_name = dbus.service.BusName("com.mikeasoft.statusnet", bus=session_bus) dbus.service.Object.__init__(self, object_path="/synchronize", bus_name=bus_name) self.app = QCoreApplication(sys.argv) signal.signal(signal.SIGINT, signal.SIG_DFL) self.client = gconf.client_get_default() self.api_path = self.client.get_string( '/apps/ControlPanel/Statusnet/api_path') self.latest = self.client.get_int( '/apps/ControlPanel/Statusnet/latest') self.eventService = EventFeedService('statusnet', 'StatusNet') self.eventService.local_name = "com.mikeasoft.statusnet.eventcallback" self.eventService.DEFAULT_INTF = "com.mikeasoft.statusnet.eventcallback" if not self.api_path: return self.cacheDir = QDesktopServices.storageLocation( QDesktopServices.CacheLocation) if not os.path.exists(self.cacheDir): os.mkdir(self.cacheDir) sys.exit(self.app.exec_())
def notifyNewTx(self, address, datas, amount): from eventfeed import EventFeedService, EventFeedItem service = EventFeedService('BitPurse', 'BitPurse', self.on_event_data_received) item = EventFeedItem( '/usr/share/icons/hicolor/80x80/apps/bitpurse.png', 'BitPurse') item.set_body('New transaction on address %s : %f BTC' % (address, amount / float(10 ** 8))) # item.set_custom_action(self.notifyCallback) service.add_item(item)