def check_gpaste_version(): result = True try: from draobpilc.lib import gpaste_client except DBusException: result = False current_version = _('Not detected') else: try: gpaste_client.get_history_name() except DBusException: result = False current_version = _('Not detected') else: current_version = gpaste_client.get_prop('Version') if ( StrictVersion(current_version) < StrictVersion(version.GPASTE_VERSION) ): result = False if not result: msg = _( 'GPaste version >= {0} is required, ' 'current version == {1}.' ).format( version.GPASTE_VERSION, current_version ) utils.notify(version.APP_NAME, msg) sys.exit(msg)
def do_startup(self): Gtk.Application.do_startup(self) actions = [ [ 'delete', 'app.delete', common.DELETE_ITEM, self._on_delete_action ], [ 'show_histories', 'app.show_histories', common.SHOW_HISTORIES, self.show_histories_manager ], [ 'focus_search', 'app.focus_search', common.FOCUS_SEARCH, lambda _, __: self._search_box.entry.grab_focus() ], [ 'reset_search', 'app.reset_search', common.RESET_SEARCH, self._on_reset_search_action ], [ 'editor_wrap_text', 'app.editor_wrap_text', common.EDITOR_WRAP_TEXT_SHORTCUT, self._on_editor_wrap_action ], [ 'open_item', 'app.open_item', common.OPEN_ITEM, self._on_open_item ], [ 'backup_history', 'app.backup_history', common.BACKUP_HISTORY, self._on_backup_history ], [ 'keep_search', 'app.keep_search', common.KEEP_SEARCH_AND_CLOSE, lambda _, __: self.hide(False) ], ['hide', 'app.hide', common.HIDE_APP, lambda _, __: self.hide()], ['quit', 'app.quit', common.QUIT_APP, lambda _, __: self.quit()], [ 'show_help', 'app.show_help', common.SHOW_HELP, lambda _, __: shortcuts_window.show_or_false(self._window) ], [ 'load_all_history', 'app.load_all_history', common.LOAD_ALL_HISTORY, lambda _, __: self._items_view.load_rest_items() ] ] for name, target, key, callback in actions: self._bind_action(name, target, key, callback) if common.SETTINGS[common.STARTUP_NOTIFICATION]: utils.notify( body=_('%s is now running, press <b>%s</b> to use it.' % (version.APP_NAME, gpaste_client.SETTINGS['show-history'])))
def do_startup(self): Gtk.Application.do_startup(self) actions = [ ["delete", "app.delete", common.DELETE_ITEM, self._on_delete_action], ["show_histories", "app.show_histories", common.SHOW_HISTORIES, self.show_histories_manager], [ "focus_search", "app.focus_search", common.FOCUS_SEARCH, lambda _, __: self._search_box.entry.grab_focus(), ], ["reset_search", "app.reset_search", common.RESET_SEARCH, self._on_reset_search_action], ["editor_wrap_text", "app.editor_wrap_text", common.EDITOR_WRAP_TEXT_SHORTCUT, self._on_editor_wrap_action], ["open_item", "app.open_item", common.OPEN_ITEM, self._on_open_item], ["backup_history", "app.backup_history", common.BACKUP_HISTORY, self._on_backup_history], ["keep_search", "app.keep_search", common.KEEP_SEARCH_AND_CLOSE, lambda _, __: self.hide(False)], ["hide", "app.hide", common.HIDE_APP, lambda _, __: self.hide()], ["quit", "app.quit", common.QUIT_APP, lambda _, __: self.quit()], [ "show_help", "app.show_help", common.SHOW_HELP, lambda _, __: shortcuts_window.show_or_false(self._window), ], [ "load_all_history", "app.load_all_history", common.LOAD_ALL_HISTORY, lambda _, __: self._items_view.load_rest_items(), ], ] for name, target, key, callback in actions: self._bind_action(name, target, key, callback) if common.SETTINGS[common.STARTUP_NOTIFICATION]: utils.notify( body=_( "%s is now running, press <b>%s</b> to use it." % (version.APP_NAME, gpaste_client.SETTINGS["show-history"]) ) )