def __init__(self, tray_icon, attention_icon, slot, file): GenericScheduler.__init__(self, file, config_dir()) self.tray_icon = tray_icon self.attention_icon = attention_icon self.helper = SchedulerQtHelper(slot) if use_pynotify: pynotify.init("remindor-qt")
def main(): check_autostart() check_database() (options, parser) = parse_options(get_version()) set_up_logging("remindor_qt", log_file(), config_dir(), options, get_version()) import logging logger = logging.getLogger('remindor_qt') #Run the application. app = QApplication([""]) app.setWindowIcon(QIcon.fromTheme("remindor-qt")) app.setApplicationName("Remindor-Qt") app.setApplicationVersion(get_version()) app.setOrganizationDomain("http://bhdouglass.com/remindor/") app.setQuitOnLastWindowClosed(False) if os.name == 'nt': for plugins_dir in [os.path.join(p, 'plugins') for p in PySide.__path__]: qApp.addLibraryPath(plugins_dir) QTextCodec.setCodecForCStrings(QTextCodec.codecForName("UTF-8")) if use_dbus: DBusGMainLoop(set_as_default=True) session_bus = dbus.SessionBus() ds = dbus_service(session_bus) if options.add: dialog = ReminderDialog(None) dialog.exec_() ds.emitUpdate() sys.exit(0) elif options.quick: dialog = QuickDialog(None) dialog.exec_() ds.emitUpdate() sys.exit(0) elif options.simple: dialog = SimpleDialog(None) dialog.exec_() ds.emitUpdate() sys.exit(0) elif options.manage: ds.emitManage() sys.exit(0) elif options.prefs: dialog = PreferencesDialog(None) dialog.exec_() ds.emitUpdate() sys.exit(0) elif options.stop: ds.emitStop() sys.exit(0) elif options.update: ds.emitUpdate() sys.exit(0) elif options.close: ds.emitClose() sys.exit(0) else: window = RemindorQtWindow.RemindorQtWindow(ds) bus = dbus.SystemBus() bus.add_signal_receiver(window.update_schedule, signal_name='Resuming', dbus_interface='org.freedesktop.UPower', path='/org/freedesktop/UPower') bus2 = dbus.SessionBus() bus2.add_signal_receiver(window.dbus_receiver, signal_name=None, dbus_interface=ds.interface(), path=ds.path()) else: logger.debug('Unable to initialize dbus, this features will be disabled') if options.add or options.quick or options.manage or options.prefs or options.stop or options.update or options.close: logger.warn('dbus is not available, command line options are disabled') print 'dbus is not available, command line options are disabled' sys.exit(0) else: window = RemindorQtWindow.RemindorQtWindow() app.exec_()
def main(): check_autostart() check_database() (options, parser) = parse_options(get_version()) set_up_logging("remindor_qt", log_file(), config_dir(), options, get_version()) import logging logger = logging.getLogger('remindor_qt') #Run the application. app = QApplication([""]) app.setWindowIcon(QIcon.fromTheme("remindor-qt")) app.setApplicationName("Remindor-Qt") app.setApplicationVersion(get_version()) app.setOrganizationDomain("http://bhdouglass.com/remindor/") app.setQuitOnLastWindowClosed(False) if os.name == 'nt': for plugins_dir in [ os.path.join(p, 'plugins') for p in PySide.__path__ ]: qApp.addLibraryPath(plugins_dir) QTextCodec.setCodecForCStrings(QTextCodec.codecForName("UTF-8")) if use_dbus: DBusGMainLoop(set_as_default=True) session_bus = dbus.SessionBus() ds = dbus_service(session_bus) if options.add: dialog = ReminderDialog(None) dialog.exec_() ds.emitUpdate() sys.exit(0) elif options.quick: dialog = QuickDialog(None) dialog.exec_() ds.emitUpdate() sys.exit(0) elif options.simple: dialog = SimpleDialog(None) dialog.exec_() ds.emitUpdate() sys.exit(0) elif options.manage: ds.emitManage() sys.exit(0) elif options.prefs: dialog = PreferencesDialog(None) dialog.exec_() ds.emitUpdate() sys.exit(0) elif options.stop: ds.emitStop() sys.exit(0) elif options.update: ds.emitUpdate() sys.exit(0) elif options.close: ds.emitClose() sys.exit(0) else: window = RemindorQtWindow.RemindorQtWindow(ds) bus = dbus.SystemBus() bus.add_signal_receiver(window.update_schedule, signal_name='Resuming', dbus_interface='org.freedesktop.UPower', path='/org/freedesktop/UPower') bus2 = dbus.SessionBus() bus2.add_signal_receiver(window.dbus_receiver, signal_name=None, dbus_interface=ds.interface(), path=ds.path()) else: logger.debug( 'Unable to initialize dbus, this features will be disabled') if options.add or options.quick or options.manage or options.prefs or options.stop or options.update or options.close: logger.warn( 'dbus is not available, command line options are disabled') print 'dbus is not available, command line options are disabled' sys.exit(0) else: window = RemindorQtWindow.RemindorQtWindow() app.exec_()