def __cb_launch_gui(self, *arg): # If client is not running, launch it # Send DBus 'show_main_window' signal self.parent.dbus_server.show_main_window() if not self.parent.client_pid or \ not verify_pid(self.parent.client_pid): gui = Popen('billreminder', shell=True) self.parent.client_pid = gui.pid
def __init__(self, options): # Verify if Lock File exist and if there is another instance running if not lock(): lockfd = open(common.DAEMON_LOCK_FILE, 'r') lockpid = int(lockfd.readline()) lockfd.close() if verify_pid(lockpid): print _('Lock File found:' \ ' You have another instance running. (pid=%d)') % \ lockpid raise SystemExit else: print _('Lock File found: ' \ 'Possibly the program was exited unexpectedly.') try: print _('Removing Lock File...') os.remove(common.DAEMON_LOCK_FILE) print _('Successfully.') except OSError: print _('Failed.') # Verify if there is another Billreminder-Daemon DBus Service if verify_service(common.DBUS_INTERFACE): print _('BillReminder Notifier is already running.') raise SystemExit Daemon.__init__(self, options) self.client_pid = None self.actions = Actions() self.dbus_server = Server(self) if options.app_opengui: gui = Popen('billreminder', shell=True) self.client_pid = gui.pid self.alarm = Alarm(self) # Create the mainloop self.mainloop = gobject.MainLoop() self.mainloop.run()