def __init__(self, req): ''' Initializes the gtk objects and signals. @param req: a Requester object ''' self.req = req self.icon_theme = None self._configure_icon_theme() # Declare subsequently loaded widget self.dialog = None self.treeview_window = None self.central_pane = None self.add_button = None self.remove_button = None self.backends_tv = None self.config_panel = None self.add_panel = None builder = Gtk.Builder() self._load_widgets_from_builder(builder) # Load and setup other widgets self.dialog.set_title(_("Synchronization Services - %s" % info.NAME)) self._create_widgets_for_add_panel() self._create_widgets_for_conf_panel() self._setup_signal_connections(builder) self._create_widgets_for_treeview() help.add_help_shortcut(self.dialog, "sync")
def __init__(self, requester): self.req = requester self.config = self.req.get_config("plugins") builder = Gtk.Builder() builder.add_from_file(ViewConfig.PLUGINS_UI_FILE) self.dialog = builder.get_object("PluginsDialog") self.dialog.set_title(_("Plugins - %s" % info.NAME)) self.plugin_tree = builder.get_object("PluginTree") self.plugin_configure = builder.get_object("plugin_configure") self.plugin_about = builder.get_object("PluginAboutDialog") self.plugin_depends = builder.get_object("PluginDepends") help.add_help_shortcut(self.dialog, "plugins") self.pengine = PluginEngine() # plugin config initiation if self.pengine.get_plugins(): self.config.set("disabled", [p.module_name for p in self.pengine.get_plugins("disabled")]) self.config.set("enabled", [p.module_name for p in self.pengine.get_plugins("enabled")]) # see constants PLUGINS_COL_* for column meanings self.plugin_store = Gtk.ListStore(str, bool, str, str, bool) builder.connect_signals( { "on_plugins_help": self.on_help, "on_plugins_close": self.on_close, "on_PluginsDialog_delete_event": self.on_close, "on_PluginTree_cursor_changed": self.on_plugin_select, "on_plugin_about": self.on_plugin_about, "on_plugin_configure": self.on_plugin_configure, "on_PluginAboutDialog_close": self.on_plugin_about_close, } )
def __init__(self, req, vmanager): self.req = req self.config = self.req.get_config('browser') builder = Gtk.Builder() builder.add_from_file(ViewConfig.PREFERENCES_UI_FILE) self.dialog = builder.get_object("PreferencesDialog") self.dialog.set_title(_("Preferences - %s" % info.NAME)) self.pref_autostart = builder.get_object("pref_autostart") self.pref_show_preview = builder.get_object("pref_show_preview") self.bg_color_enable = builder.get_object("bg_color_enable") self.hbox1 = builder.get_object("hbox1") self.shortcut_button = builder.get_object("shortcut_button") self.shortcut = ShortcutWidget(builder) help.add_help_shortcut(self.dialog, "preferences") self.fontbutton = builder.get_object("fontbutton") self.timer = vmanager.timer self.color_invalid = Color(50000, 0, 0) self.refresh_hour = builder.get_object("hour") self.refresh_mins = builder.get_object("min") editor_font = self.config.get("font_name") if editor_font == "": font = self.dialog.get_style_context().get_font( Gtk.StateFlags.NORMAL) editor_font = font.to_string() self.fontbutton.set_font_name(editor_font) builder.connect_signals({ 'on_pref_autostart_toggled': self.on_autostart_toggled, 'on_pref_show_preview_toggled': self.toggle_preview, 'on_bg_color_toggled': self.on_bg_color_toggled, 'on_prefs_help': self.on_help, 'on_prefs_close': self.on_close, 'on_PreferencesDialog_delete_event': self.on_close, 'on_fontbutton_font_set': self.on_font_change, 'on_shortcut_button_toggled': self.shortcut.on_shortcut_toggled, 'on_valid_check': self.valid_check, })
def __init__(self, requester): self.req = requester self.config = self.req.get_config("plugins") builder = Gtk.Builder() builder.add_from_file(ViewConfig.PLUGINS_UI_FILE) self.dialog = builder.get_object("PluginsDialog") self.dialog.set_title(_("Plugins - %s" % info.NAME)) self.plugin_tree = builder.get_object("PluginTree") self.plugin_configure = builder.get_object("plugin_configure") self.plugin_about = builder.get_object("PluginAboutDialog") self.plugin_depends = builder.get_object('PluginDepends') help.add_help_shortcut(self.dialog, "plugins") self.pengine = PluginEngine() # plugin config initiation if self.pengine.get_plugins(): self.config.set( "disabled", [p.module_name for p in self.pengine.get_plugins("disabled")], ) self.config.set( "enabled", [p.module_name for p in self.pengine.get_plugins("enabled")], ) # see constants PLUGINS_COL_* for column meanings self.plugin_store = Gtk.ListStore(str, bool, str, str, bool) builder.connect_signals({ 'on_plugins_help': self.on_help, 'on_plugins_close': self.on_close, 'on_PluginsDialog_delete_event': self.on_close, 'on_PluginTree_cursor_changed': self.on_plugin_select, 'on_plugin_about': self.on_plugin_about, 'on_plugin_configure': self.on_plugin_configure, 'on_PluginAboutDialog_close': self.on_plugin_about_close, })
def init_accelerators(self): agr = Gtk.AccelGroup() self.window.add_accel_group(agr) # Escape and Ctrl-W close the dialog. It's faster to call close # directly, rather than use the close button widget key, modifier = Gtk.accelerator_parse('Escape') agr.connect(key, modifier, Gtk.AccelFlags.VISIBLE, self.close) key, modifier = Gtk.accelerator_parse('<Control>w') agr.connect(key, modifier, Gtk.AccelFlags.VISIBLE, self.close) # F1 shows help add_help_shortcut(self.window, "editor") # Ctrl-N creates a new task key, modifier = Gtk.accelerator_parse('<Control>n') agr.connect(key, modifier, Gtk.AccelFlags.VISIBLE, self.new_task) # Ctrl-Shift-N creates a new subtask insert_subtask = self.builder.get_object("insert_subtask") key, mod = Gtk.accelerator_parse("<Control><Shift>n") insert_subtask.add_accelerator('clicked', agr, key, mod, Gtk.AccelFlags.VISIBLE) # Ctrl-D marks task as done mark_as_done_editor = self.builder.get_object('mark_as_done_editor') key, mod = Gtk.accelerator_parse('<Control>d') mark_as_done_editor.add_accelerator('clicked', agr, key, mod, Gtk.AccelFlags.VISIBLE) # Ctrl-I marks task as dismissed dismiss_editor = self.builder.get_object('dismiss_editor') key, mod = Gtk.accelerator_parse('<Control>i') dismiss_editor.add_accelerator('clicked', agr, key, mod, Gtk.AccelFlags.VISIBLE) # Ctrl-Q quits GTG key, modifier = Gtk.accelerator_parse('<Control>q') agr.connect(key, modifier, Gtk.AccelFlags.VISIBLE, self.quit)