diff options
Diffstat (limited to 'portato/gui')
-rw-r--r-- | portato/gui/queue.py | 4 | ||||
-rw-r--r-- | portato/gui/templates/PreferenceWindow.glade | 42 | ||||
-rw-r--r-- | portato/gui/utils.py | 2 | ||||
-rw-r--r-- | portato/gui/windows/main.py | 10 | ||||
-rw-r--r-- | portato/gui/windows/plugin.py | 2 | ||||
-rw-r--r-- | portato/gui/windows/preference.py | 39 |
6 files changed, 90 insertions, 9 deletions
diff --git a/portato/gui/queue.py b/portato/gui/queue.py index 4bcd41a..c04d449 100644 --- a/portato/gui/queue.py +++ b/portato/gui/queue.py @@ -143,7 +143,7 @@ class EmergeQueue: try: pkg = self._get_pkg_from_cpv(cpv, unmask) if not pkg.is_installed(): - old = system.find_packages(pkg.get_slot_cp(), "installed") + old = system.find_packages(pkg.get_slot_cp(), system.SET_INSTALLED) if old: old = old[0] # assume we have only one there cmp = pkg.compare_version(old) @@ -272,7 +272,7 @@ class EmergeQueue: # get the blocks that block an installed package inst = [] for block in self.blocks[type]: - pkgs = system.find_packages(block, "installed") + pkgs = system.find_packages(block, system.SET_INSTALLED) if pkgs: inst.append((pkgs, block)) diff --git a/portato/gui/templates/PreferenceWindow.glade b/portato/gui/templates/PreferenceWindow.glade index 3dc556b..7c144e7 100644 --- a/portato/gui/templates/PreferenceWindow.glade +++ b/portato/gui/templates/PreferenceWindow.glade @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> -<!--Generated with glade3 3.4.4 on Sun Jun 8 01:45:17 2008 --> +<!--Generated with glade3 3.4.4 on Wed Jul 9 21:08:44 2008 --> <glade-interface> <widget class="GtkWindow" id="PreferenceWindow"> <property name="border_width">5</property> @@ -121,6 +121,42 @@ <property name="position">1</property> </packing> </child> + <child> + <widget class="GtkFrame" id="setFrame"> + <property name="no_show_all">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + <child> + <widget class="GtkAlignment" id="alignment4"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="right_padding">10</property> + <child> + <widget class="GtkTreeView" id="setList"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="headers_visible">False</property> + <property name="rules_hint">True</property> + </widget> + </child> + </widget> + </child> + <child> + <widget class="GtkLabel" id="label12"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Package sets to update</b></property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="position">2</property> + </packing> + </child> </widget> </child> </widget> @@ -517,7 +553,7 @@ <property name="can_focus">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="has_tooltip">True</property> - <property name="tooltip_markup" translatable="yes">Update the package list with the current search results while you are typing. + <property name="tooltip_markup">Update the package list with the current search results while you are typing. <b>Note</b>: Will slow down the typing process.</property> <property name="label" translatable="yes">Search while typing</property> <property name="yalign">0.47999998927116394</property> @@ -766,7 +802,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_markup" translatable="yes">Organize the categories in a tree. Thereby collapse categories with the same prefix: + <property name="tooltip_markup">Organize the categories in a tree. Thereby collapse categories with the same prefix: As an example: <i>app-admin</i>, <i>app-emacs</i>, and <i>app-vim</i> would be collapsed into <i><b>app</b></i> as root and <i>admin</i>, <i>emacs</i>, and <i>vim</i> as children.</property> <property name="label" translatable="yes">Collapse categories with same prefix</property> <property name="response_id">0</property> diff --git a/portato/gui/utils.py b/portato/gui/utils.py index c4f25fa..923f2fa 100644 --- a/portato/gui/utils.py +++ b/portato/gui/utils.py @@ -185,7 +185,7 @@ class Database (object): # get the lists packages = system.find_packages(category, with_version = False) - installed = system.find_packages(category, "installed", with_version = False) + installed = system.find_packages(category, system.SET_INSTALLED, with_version = False) # cycle through packages for p in packages: diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 265d4dd..50dd366 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1313,7 +1313,7 @@ class MainWindow (Window): if pkg.is_installed(): installed = set(pkg.get_iuse_flags()).intersection(pkg.get_installed_use_flags()) else: - inst = system.find_packages(pkg.get_slot_cp(), "installed") + inst = system.find_packages(pkg.get_slot_cp(), system.SET_INSTALLED) if inst: installed = set(inst[0].get_iuse_flags()).intersection(inst[0].get_installed_use_flags()) else: @@ -1420,7 +1420,13 @@ class MainWindow (Window): watch = gtk.gdk.Cursor(gtk.gdk.WATCH) self.window.window.set_cursor(watch) try: - updating = system.update_world(newuse = self.cfg.get_boolean("newuse"), deep = self.cfg.get_boolean("deep")) + sets = ("world", "system") # default + if system.has_set_support(): + confsets = [x.strip() for x in self.cfg.get("updatesets").split(",")] + syssets = system.get_sets() + sets = [s for s in confsets if s in syssets] + + updating = system.update_world(sets = sets, newuse = self.cfg.get_boolean("newuse"), deep = self.cfg.get_boolean("deep")) debug("updating list: %s --> length: %s", [(x.get_cpv(), y.get_cpv()) for x,y in updating], len(updating)) gobject.idle_add(cb_idle_append, updating) finally: diff --git a/portato/gui/windows/plugin.py b/portato/gui/windows/plugin.py index 392654e..a0694be 100644 --- a/portato/gui/windows/plugin.py +++ b/portato/gui/windows/plugin.py @@ -134,7 +134,7 @@ class PluginWindow (AbstractDialog): if plugin.deps: for dep in plugin.deps: - if system.find_packages(dep, pkgSet = "installed", with_version = False): + if system.find_packages(dep, pkgSet = system.SET_INSTALLED, with_version = False): self.inst.append(dep) else: self.ninst.append(dep) diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py index d35666d..8aabbba 100644 --- a/portato/gui/windows/preference.py +++ b/portato/gui/windows/preference.py @@ -14,6 +14,8 @@ from __future__ import absolute_import import gtk +from ...backend import system + from .basic import AbstractDialog from ..dialogs import io_ex_dialog from ...helper import debug @@ -106,6 +108,12 @@ class PreferenceWindow (AbstractDialog): self.tree.get_widget(edit).\ set_text(self.cfg.get(val)) + # the set list + self.setList = self.tree.get_widget("setList") + if system.has_set_support(): + self.fill_setlist() + self.tree.get_widget("setFrame").show() + # the console font button self.consoleFontBtn = self.tree.get_widget("consoleFontBtn") self.consoleFontBtn.set_font_name(self.cfg.get("consolefont", section = "GUI")) @@ -144,6 +152,8 @@ class PreferenceWindow (AbstractDialog): else: self.cfg.set(val,self.tree.get_widget(edit).get_text()) + self.cfg.set("updatesets", ", ".join(sorted(name for enabled, markup, descr, name in self.setList.get_model() if enabled))) + font = self.consoleFontBtn.get_font_name() self.cfg.set("consolefont", font, section = "GUI") self.console_fn(font) @@ -162,6 +172,29 @@ class PreferenceWindow (AbstractDialog): self.catmodel_fn() + def fill_setlist (self): + store = gtk.ListStore(bool, str, str, str) + + enabled = [x.strip() for x in self.cfg.get("updatesets").split(",")] + + for set, descr in system.get_sets(description = True): + store.append([set in enabled, "<i>%s</i>" % set, descr, set]) + + tCell = gtk.CellRendererToggle() + tCell.set_property("activatable", True) + tCell.connect("toggled", self.cb_check_toggled) # emulate the normal toggle behavior ... + + sCell = gtk.CellRendererText() + + col = gtk.TreeViewColumn(_("Package Set"), tCell, active = 0) + col.pack_start(sCell) + col.add_attribute(sCell, "markup", 1) + self.setList.append_column(col) + + self.setList.append_column(gtk.TreeViewColumn(_("Description"), sCell, text = 2)) + + self.setList.set_model(store) + def cb_ok_clicked(self, button): """Saves, writes to config-file and closes the window.""" self._save() @@ -175,3 +208,9 @@ class PreferenceWindow (AbstractDialog): def cb_cancel_clicked (self, button): """Just closes - w/o saving.""" self.window.destroy() + + def cb_check_toggled (self, cell, path): + # for whatever reason we have to define normal toggle behavior explicitly + store = self.setList.get_model() + store[path][0] = not store[path][0] + return True |