コード例 #1
0
ファイル: kupfer_plugins.py プロジェクト: CharString/kupfer
	def get_items(self):
		setctl = settings.GetSettingsController()
		for info in plugins.get_plugin_info():
			plugin_id = info["name"]
			if setctl.get_plugin_is_hidden(plugin_id):
				continue
			yield Plugin(info, info["localized_name"])
コード例 #2
0
 def get_items(self):
     setctl = settings.GetSettingsController()
     for info in plugins.get_plugin_info():
         plugin_id = info["name"]
         if setctl.get_plugin_is_hidden(plugin_id):
             continue
         yield Plugin(info, info["localized_name"])
コード例 #3
0
ファイル: preferences.py プロジェクト: cjparsons74/kupfer
	def __init__(self):
		"""Load ui from data file"""
		builder = gtk.Builder()
		builder.set_translation_domain(version.PACKAGE_NAME)
		ui_file = config.get_data_file("preferences.ui")

		if ui_file:
			builder.add_from_file(ui_file)
		else:
			self.window = None
			return
		builder.connect_signals(self)
		self.window = builder.get_object("preferenceswindow")
		self.window.set_position(gtk.WIN_POS_CENTER)
		self.window.connect("delete-event", self._close_window)
		self.pluglist_parent = builder.get_object("plugin_list_parent")
		self.dirlist_parent = builder.get_object("directory_list_parent")
		self.plugin_about_parent = builder.get_object("plugin_about_parent")
		self.preferences_notebook = builder.get_object("preferences_notebook")

		self.buttonremovedirectory = builder.get_object("buttonremovedirectory")
		checkautostart = builder.get_object("checkautostart")
		checkstatusicon = builder.get_object("checkstatusicon")
		checkcloseonunfocus = builder.get_object("checkcloseonunfocus")
		checkusecommandkeys = builder.get_object("checkusecommandkeys")
		self.entry_plugins_filter = builder.get_object('entry_plugins_filter')
		self.keybindings_list_parent = builder.get_object('keybindings_list_parent')
		self.gkeybindings_list_parent = builder.get_object('gkeybindings_list_parent')
		source_list_parent = builder.get_object("source_list_parent")
		self.sources_list_ctrl = SourceListController(source_list_parent)

		setctl = settings.GetSettingsController()
		checkautostart.set_active(self._get_should_autostart())
		checkstatusicon.set_active(setctl.get_show_status_icon())
		checkusecommandkeys.set_active(setctl.get_use_command_keys())
		checkcloseonunfocus.set_active(setctl.get_close_on_unfocus())

		# Plugin List
		columns = [
			{"key": "plugin_id", "type": str },
			{"key": "enabled", "type": bool },
			{"key": "icon-name", "type": str },
			{"key": "markup", "type": str },
		]
		# setup plugin list table
		column_types = [c["type"] for c in columns]
		self.columns = [c["key"] for c in columns]
		self.store = gtk.ListStore(*column_types)
		self.table = gtk.TreeView(self.store)
		self.table.set_headers_visible(False)
		self.table.set_property("enable-search", False)
		self.table.set_rules_hint(True)
		self.table.connect("cursor-changed", self.plugin_table_cursor_changed)
		self.table.get_selection().set_mode(gtk.SELECTION_BROWSE)

		checkcell = gtk.CellRendererToggle()
		checkcol = gtk.TreeViewColumn("item", checkcell)
		checkcol.add_attribute(checkcell, "active",
				self.columns.index("enabled"))
		checkcell.connect("toggled", self.on_checkplugin_toggled)

		icon_cell = gtk.CellRendererPixbuf()
		icon_cell.set_property("height", LIST_ICON_SIZE)
		icon_cell.set_property("width", LIST_ICON_SIZE)

		icon_col = gtk.TreeViewColumn("icon", icon_cell)
		icon_col.add_attribute(icon_cell, "icon-name",
				self.columns.index("icon-name"))

		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn("item", cell)
		col.add_attribute(cell, "markup", self.columns.index("markup"))

		self.table.append_column(checkcol)
		# hide icon for now
		#self.table.append_column(icon_col)
		self.table.append_column(col)

		self.plugin_list_timer = scheduler.Timer()
		self.plugin_info = utils.locale_sort(plugins.get_plugin_info(),
				key= lambda rec: rec["localized_name"])
		self._refresh_plugin_list()
		self.output_debug("Standard Plugins: %d" % len(self.store))
		self.table.show()
		self.pluglist_parent.add(self.table)

		# Directory List
		self.dir_store = gtk.ListStore(str, gio.Icon, str)
		self.dir_table = gtk.TreeView(self.dir_store)
		self.dir_table.set_headers_visible(False)
		self.dir_table.set_property("enable-search", False)
		self.dir_table.connect("cursor-changed", self.dir_table_cursor_changed)
		self.dir_table.get_selection().set_mode(gtk.SELECTION_BROWSE)

		icon_cell = gtk.CellRendererPixbuf()

		icon_col = gtk.TreeViewColumn("icon", icon_cell)
		icon_col.add_attribute(icon_cell, "gicon", 1)

		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn("name", cell)
		col.add_attribute(cell, "text", 2)
		cell.set_property("ellipsize", pango.ELLIPSIZE_END)
		self.dir_table.append_column(icon_col)
		self.dir_table.append_column(col)
		self.dir_table.show()
		self.dirlist_parent.add(self.dir_table)
		self.read_directory_settings()

		# keybindings list
		self.keybind_table, self.keybind_store = _create_conf_keys_list()
		self.keybindings_list_parent.add(self.keybind_table)
		self.keybind_table.connect("row-activated", self.on_keybindings_row_activate)
		# global keybindings list
		self.gkeybind_table, self.gkeybind_store = _create_conf_keys_list()
		self.gkeybindings_list_parent.add(self.gkeybind_table)
		self.gkeybind_table.connect("row-activated",
				self.on_gkeybindings_row_activate)

		self._show_keybindings(setctl)
		self._show_gkeybindings(setctl)
コード例 #4
0
ファイル: preferences.py プロジェクト: guns/kupfer
    def __init__(self):
        """Load ui from data file"""
        builder = Gtk.Builder()
        builder.set_translation_domain(version.PACKAGE_NAME)
        ui_file = config.get_data_file("preferences.ui")

        if ui_file:
            builder.add_from_file(ui_file)
        else:
            self.window = None
            return
        self.window = builder.get_object("preferenceswindow")
        self.window.set_position(Gtk.WindowPosition.CENTER)
        self.window.connect("delete-event", self._close_window)
        self.pluglist_parent = builder.get_object("plugin_list_parent")
        self.dirlist_parent = builder.get_object("directory_list_parent")
        self.plugin_about_parent = builder.get_object("plugin_about_parent")
        self.preferences_notebook = builder.get_object("preferences_notebook")

        self.buttonremovedirectory = builder.get_object(
            "buttonremovedirectory")
        checkautostart = builder.get_object("checkautostart")
        checkstatusicon_gtk = builder.get_object("checkstatusicon_gtk")
        checkstatusicon_ai = builder.get_object("checkstatusicon_ai")
        combo_icons_large_size = builder.get_object("icons_large_size")
        combo_icons_small_size = builder.get_object("icons_small_size")
        checkusecommandkeys = builder.get_object("checkusecommandkeys")
        radio_actionaccelalt = builder.get_object("radio_actionaccelalt")
        radio_actionaccelctrl = builder.get_object("radio_actionaccelctrl")
        self.entry_plugins_filter = builder.get_object('entry_plugins_filter')
        self.keybindings_list_parent = builder.get_object(
            'keybindings_list_parent')
        self.gkeybindings_list_parent = builder.get_object(
            'gkeybindings_list_parent')
        source_list_parent = builder.get_object("source_list_parent")
        button_reset_keys = builder.get_object("button_reset_keys")
        self.sources_list_ctrl = SourceListController(source_list_parent)

        setctl = settings.GetSettingsController()
        checkautostart.set_active(self._get_should_autostart())
        checkstatusicon_gtk.set_active(setctl.get_show_status_icon())

        large_icon_size = setctl.get_config_int("Appearance",
                                                "icon_large_size")
        small_icon_size = setctl.get_config_int("Appearance",
                                                "icon_small_size")

        set_combobox(large_icon_size, combo_icons_large_size)
        set_combobox(small_icon_size, combo_icons_small_size)

        if supports_app_indicator():
            checkstatusicon_ai.set_active(setctl.get_show_status_icon_ai())
        else:
            checkstatusicon_ai.set_sensitive(False)

        label = checkstatusicon_gtk.get_label()
        checkstatusicon_gtk.set_label(label + " (GtkStatusIcon)")
        label = checkstatusicon_ai.get_label()
        checkstatusicon_ai.set_label(label + " (AppIndicator)")

        checkusecommandkeys.set_active(setctl.get_use_command_keys())
        radio_actionaccelalt.set_active(
            setctl.get_action_accelerator_modifer() != 'ctrl')
        radio_actionaccelctrl.set_active(
            setctl.get_action_accelerator_modifer() == 'ctrl')

        # List store with columns (Name, ID)
        # Make alternative comboboxes
        terminal_combobox = builder.get_object("terminal_combobox")
        icons_combobox = builder.get_object("icons_combobox")

        def make_combobox_model(combobox):
            combobox_store = Gtk.ListStore(GObject.TYPE_STRING,
                                           GObject.TYPE_STRING)
            combobox.set_model(combobox_store)
            combobox_cell = Gtk.CellRendererText()
            combobox.pack_start(combobox_cell, True)
            combobox.add_attribute(combobox_cell, 'text', 0)

        make_combobox_model(terminal_combobox)
        make_combobox_model(icons_combobox)

        self._update_alternative_combobox('terminal', terminal_combobox)
        self._update_alternative_combobox('icon_renderer', icons_combobox)
        self.terminal_combobox = terminal_combobox
        self.icons_combobox = icons_combobox
        setctl.connect("alternatives-changed", self._on_alternatives_changed)

        # Plugin List
        columns = [
            {
                "key": "plugin_id",
                "type": str
            },
            {
                "key": "enabled",
                "type": bool
            },
            {
                "key": "icon-name",
                "type": str
            },
            {
                "key": "text",
                "type": str
            },
        ]
        # setup plugin list table
        column_types = [c["type"] for c in columns]
        self.columns = [c["key"] for c in columns]
        self.store = Gtk.ListStore.new(column_types)
        self.table = Gtk.TreeView.new_with_model(self.store)
        self.table.set_headers_visible(False)
        self.table.set_property("enable-search", False)
        self.table.connect("cursor-changed", self.plugin_table_cursor_changed)
        self.table.get_selection().set_mode(Gtk.SelectionMode.BROWSE)

        checkcell = Gtk.CellRendererToggle()
        checkcol = Gtk.TreeViewColumn("item", checkcell)
        checkcol.add_attribute(checkcell, "active",
                               self.columns.index("enabled"))
        checkcell.connect("toggled", self.on_checkplugin_toggled)

        icon_cell = Gtk.CellRendererPixbuf()
        icon_cell.set_property("height", LIST_ICON_SIZE)
        icon_cell.set_property("width", LIST_ICON_SIZE)

        icon_col = Gtk.TreeViewColumn("icon", icon_cell)
        icon_col.add_attribute(icon_cell, "icon-name",
                               self.columns.index("icon-name"))

        cell = Gtk.CellRendererText()
        col = Gtk.TreeViewColumn("item", cell)
        col.add_attribute(cell, "text", self.columns.index("text"))

        self.table.append_column(checkcol)
        # hide icon for now
        #self.table.append_column(icon_col)
        self.table.append_column(col)

        self.plugin_list_timer = scheduler.Timer()
        self.plugin_info = utils.locale_sort(
            plugins.get_plugin_info(), key=lambda rec: rec["localized_name"])
        self._refresh_plugin_list()
        self.output_debug("Standard Plugins: %d" % len(self.store))
        self.table.show()
        self.pluglist_parent.add(self.table)

        # Directory List
        self.dir_store = Gtk.ListStore.new([str, Gio.Icon, str])
        self.dir_table = Gtk.TreeView.new_with_model(self.dir_store)
        self.dir_table.set_headers_visible(False)
        self.dir_table.set_property("enable-search", False)
        self.dir_table.connect("cursor-changed", self.dir_table_cursor_changed)
        self.dir_table.get_selection().set_mode(Gtk.SelectionMode.BROWSE)

        icon_cell = Gtk.CellRendererPixbuf()

        icon_col = Gtk.TreeViewColumn("icon", icon_cell)
        icon_col.add_attribute(icon_cell, "gicon", 1)

        cell = Gtk.CellRendererText()
        col = Gtk.TreeViewColumn("name", cell)
        col.add_attribute(cell, "text", 2)
        cell.set_property("ellipsize", Pango.EllipsizeMode.END)
        self.dir_table.append_column(icon_col)
        self.dir_table.append_column(col)
        self.dir_table.show()
        self.dirlist_parent.add(self.dir_table)
        self.read_directory_settings()

        # global keybindings list
        self.keybind_table, self.keybind_store = _create_conf_keys_list()
        self.keybindings_list_parent.add(self.keybind_table)
        self.keybind_table.connect("row-activated",
                                   self.on_keybindings_row_activate)
        button_reset_keys.set_sensitive(keybindings.is_available())
        self.keybind_table.set_sensitive(keybindings.is_available())

        # kupfer interface (accelerators) keybindings list
        self.gkeybind_table, self.gkeybind_store = _create_conf_keys_list()
        self.gkeybindings_list_parent.add(self.gkeybind_table)
        self.gkeybind_table.connect("row-activated",
                                    self.on_gkeybindings_row_activate)

        # Requires GTK 3.22
        try:
            self.gkeybindings_list_parent.set_propagate_natural_height(True)
        except AttributeError:
            pass

        self._show_keybindings(setctl)
        self._show_gkeybindings(setctl)

        # Connect to signals at the last point
        builder.connect_signals(self)
コード例 #5
0
ファイル: preferences.py プロジェクト: chmouel/kupfer
	def __init__(self):
		"""Load ui from data file"""
		builder = gtk.Builder()
		builder.set_translation_domain(version.PACKAGE_NAME)
		ui_file = config.get_data_file("preferences.ui")

		if ui_file:
			builder.add_from_file(ui_file)
		else:
			self.window = None
			return
		builder.connect_signals(self)
		self.window = builder.get_object("preferenceswindow")
		self.window.set_position(gtk.WIN_POS_CENTER)
		self.window.connect("delete-event", self._close_window)
		self.pluglist_parent = builder.get_object("plugin_list_parent")
		self.dirlist_parent = builder.get_object("directory_list_parent")
		self.plugin_about_parent = builder.get_object("plugin_about_parent")
		self.preferences_notebook = builder.get_object("preferences_notebook")

		self.entrykeybinding = builder.get_object("entrykeybinding")
		self.buttonkeybinding = builder.get_object("buttonkeybinding")
		self.imagekeybindingaux = builder.get_object("imagekeybindingaux")
		self.labelkeybindingaux = builder.get_object("labelkeybindingaux")
		self.buttonremovedirectory = builder.get_object("buttonremovedirectory")
		checkautostart = builder.get_object("checkautostart")
		checkstatusicon = builder.get_object("checkstatusicon")

		setctl = settings.GetSettingsController()
		self.entrykeybinding.set_text(setctl.get_keybinding())
		checkautostart.set_active(self._get_should_autostart())
		checkstatusicon.set_active(setctl.get_show_status_icon())

		# Plugin List
		columns = [
			{"key": "plugin_id", "type": str },
			{"key": "enabled", "type": bool },
			{"key": "icon-name", "type": str },
			{"key": "markup", "type": str },
		]
		# setup plugin list table
		column_types = [c["type"] for c in columns]
		self.columns = [c["key"] for c in columns]
		self.store = gtk.ListStore(*column_types)
		self.table = gtk.TreeView(self.store)
		self.table.set_headers_visible(False)
		self.table.set_property("enable-search", False)
		self.table.set_rules_hint(True)
		self.table.connect("cursor-changed", self.plugin_table_cursor_changed)
		self.table.get_selection().set_mode(gtk.SELECTION_BROWSE)

		checkcell = gtk.CellRendererToggle()
		checkcol = gtk.TreeViewColumn("item", checkcell)
		checkcol.add_attribute(checkcell, "active",
				self.columns.index("enabled"))
		checkcell.connect("toggled", self.on_checkplugin_toggled)

		icon_cell = gtk.CellRendererPixbuf()
		icon_cell.set_property("height", 18)
		icon_cell.set_property("width", 18)

		icon_col = gtk.TreeViewColumn("icon", icon_cell)
		icon_col.add_attribute(icon_cell, "icon-name",
				self.columns.index("icon-name"))

		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn("item", cell)
		col.add_attribute(cell, "markup", self.columns.index("markup"))

		self.table.append_column(checkcol)
		# hide icon for now
		#self.table.append_column(icon_col)
		self.table.append_column(col)

		self.plugin_info = utils.locale_sort(plugins.get_plugin_info(),
				key= lambda rec: rec["localized_name"])
		for info in self.plugin_info:
			plugin_id = info["name"]
			if setctl.get_plugin_is_hidden(plugin_id):
				continue
			enabled = setctl.get_plugin_enabled(plugin_id)
			name = info["localized_name"]
			desc = info["description"]
			text = u"%s" % name
			self.store.append((plugin_id, enabled, "kupfer-object", text))
		self.output_debug("Standard Plugins: %d" % len(self.store))
		self.table.show()
		self.pluglist_parent.add(self.table)

		# Directory List
		self.dir_store = gtk.ListStore(str, gio.Icon, str)
		self.dir_table = gtk.TreeView(self.dir_store)
		self.dir_table.set_headers_visible(False)
		self.dir_table.set_property("enable-search", False)
		self.dir_table.connect("cursor-changed", self.dir_table_cursor_changed)
		self.dir_table.get_selection().set_mode(gtk.SELECTION_BROWSE)

		icon_cell = gtk.CellRendererPixbuf()
			
		icon_col = gtk.TreeViewColumn("icon", icon_cell)
		icon_col.add_attribute(icon_cell, "gicon", 1)

		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn("name", cell)
		col.add_attribute(cell, "text", 2)
		cell.set_property("ellipsize", pango.ELLIPSIZE_END)
		self.dir_table.append_column(icon_col)
		self.dir_table.append_column(col)
		self.dir_table.show()
		self.dirlist_parent.add(self.dir_table)
		self.read_directory_settings()
コード例 #6
0
    def __init__(self):
        """Load ui from data file"""
        builder = gtk.Builder()
        builder.set_translation_domain(version.PACKAGE_NAME)
        ui_file = config.get_data_file("preferences.ui")

        if ui_file:
            builder.add_from_file(ui_file)
        else:
            self.window = None
            return
        builder.connect_signals(self)
        self.window = builder.get_object("preferenceswindow")
        self.window.set_position(gtk.WIN_POS_CENTER)
        self.window.connect("delete-event", self._close_window)
        self.pluglist_parent = builder.get_object("plugin_list_parent")
        self.dirlist_parent = builder.get_object("directory_list_parent")
        self.plugin_about_parent = builder.get_object("plugin_about_parent")
        self.preferences_notebook = builder.get_object("preferences_notebook")

        self.buttonremovedirectory = builder.get_object(
            "buttonremovedirectory")
        checkautostart = builder.get_object("checkautostart")
        checkstatusicon = builder.get_object("checkstatusicon")
        checkusecommandkeys = builder.get_object("checkusecommandkeys")
        self.entry_plugins_filter = builder.get_object('entry_plugins_filter')
        self.keybindings_list_parent = builder.get_object(
            'keybindings_list_parent')
        self.gkeybindings_list_parent = builder.get_object(
            'gkeybindings_list_parent')
        source_list_parent = builder.get_object("source_list_parent")
        self.sources_list_ctrl = SourceListController(source_list_parent)

        setctl = settings.GetSettingsController()
        checkautostart.set_active(self._get_should_autostart())
        checkstatusicon.set_active(setctl.get_show_status_icon())
        checkusecommandkeys.set_active(setctl.get_use_command_keys())

        # List store with columns (Name, ID)
        # Make alternative comboboxes
        terminal_combobox = builder.get_object("terminal_combobox")
        icons_combobox = builder.get_object("icons_combobox")

        def make_combobox_model(combobox):
            combobox_store = gtk.ListStore(gobject.TYPE_STRING,
                                           gobject.TYPE_STRING)
            combobox.set_model(combobox_store)
            combobox_cell = gtk.CellRendererText()
            combobox.pack_start(combobox_cell, True)
            combobox.add_attribute(combobox_cell, 'text', 0)

        make_combobox_model(terminal_combobox)
        make_combobox_model(icons_combobox)

        self._update_alternative_combobox('terminal', terminal_combobox)
        self._update_alternative_combobox('icon_renderer', icons_combobox)
        self.terminal_combobox = terminal_combobox
        self.icons_combobox = icons_combobox
        setctl.connect("alternatives-changed", self._on_alternatives_changed)

        # Plugin List
        columns = [
            {
                "key": "plugin_id",
                "type": str
            },
            {
                "key": "enabled",
                "type": bool
            },
            {
                "key": "icon-name",
                "type": str
            },
            {
                "key": "text",
                "type": str
            },
        ]
        # setup plugin list table
        column_types = [c["type"] for c in columns]
        self.columns = [c["key"] for c in columns]
        self.store = gtk.ListStore(*column_types)
        self.table = gtk.TreeView(self.store)
        self.table.set_headers_visible(False)
        self.table.set_property("enable-search", False)
        self.table.set_rules_hint(True)
        self.table.connect("cursor-changed", self.plugin_table_cursor_changed)
        self.table.get_selection().set_mode(gtk.SELECTION_BROWSE)

        checkcell = gtk.CellRendererToggle()
        checkcol = gtk.TreeViewColumn("item", checkcell)
        checkcol.add_attribute(checkcell, "active",
                               self.columns.index("enabled"))
        checkcell.connect("toggled", self.on_checkplugin_toggled)

        icon_cell = gtk.CellRendererPixbuf()
        icon_cell.set_property("height", LIST_ICON_SIZE)
        icon_cell.set_property("width", LIST_ICON_SIZE)

        icon_col = gtk.TreeViewColumn("icon", icon_cell)
        icon_col.add_attribute(icon_cell, "icon-name",
                               self.columns.index("icon-name"))

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn("item", cell)
        col.add_attribute(cell, "text", self.columns.index("text"))

        self.table.append_column(checkcol)
        # hide icon for now
        #self.table.append_column(icon_col)
        self.table.append_column(col)

        self.plugin_list_timer = scheduler.Timer()
        self.plugin_info = utils.locale_sort(
            plugins.get_plugin_info(), key=lambda rec: rec["localized_name"])
        self._refresh_plugin_list()
        self.output_debug("Standard Plugins: %d" % len(self.store))
        self.table.show()
        self.pluglist_parent.add(self.table)

        # Directory List
        self.dir_store = gtk.ListStore(str, gio.Icon, str)
        self.dir_table = gtk.TreeView(self.dir_store)
        self.dir_table.set_headers_visible(False)
        self.dir_table.set_property("enable-search", False)
        self.dir_table.connect("cursor-changed", self.dir_table_cursor_changed)
        self.dir_table.get_selection().set_mode(gtk.SELECTION_BROWSE)

        icon_cell = gtk.CellRendererPixbuf()

        icon_col = gtk.TreeViewColumn("icon", icon_cell)
        icon_col.add_attribute(icon_cell, "gicon", 1)

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn("name", cell)
        col.add_attribute(cell, "text", 2)
        cell.set_property("ellipsize", pango.ELLIPSIZE_END)
        self.dir_table.append_column(icon_col)
        self.dir_table.append_column(col)
        self.dir_table.show()
        self.dirlist_parent.add(self.dir_table)
        self.read_directory_settings()

        # keybindings list
        self.keybind_table, self.keybind_store = _create_conf_keys_list()
        self.keybindings_list_parent.add(self.keybind_table)
        self.keybind_table.connect("row-activated",
                                   self.on_keybindings_row_activate)
        # global keybindings list
        self.gkeybind_table, self.gkeybind_store = _create_conf_keys_list()
        self.gkeybindings_list_parent.add(self.gkeybind_table)
        self.gkeybind_table.connect("row-activated",
                                    self.on_gkeybindings_row_activate)

        self._show_keybindings(setctl)
        self._show_gkeybindings(setctl)