From fba60a84b9a838ad32def950210a6b62d9bcdbff Mon Sep 17 00:00:00 2001 From: necoro <> Date: Mon, 19 Feb 2007 23:04:14 +0000 Subject: Back to our own revision solution as the eclass-one checks _before_ updating --- portato/gui/gtk/TreeViewTooltips.py | 2 +- portato/gui/gtk/glade/portato.glade | 452 ++++++++++++++++++++---------------- portato/gui/gtk/usetips.py | 4 +- portato/gui/gtk/windows.py | 56 +++-- 4 files changed, 298 insertions(+), 216 deletions(-) (limited to 'portato/gui/gtk') diff --git a/portato/gui/gtk/TreeViewTooltips.py b/portato/gui/gtk/TreeViewTooltips.py index 1112d3e..120d4df 100644 --- a/portato/gui/gtk/TreeViewTooltips.py +++ b/portato/gui/gtk/TreeViewTooltips.py @@ -292,7 +292,7 @@ class TreeViewTooltips: def get_tooltip(self, view, column, path): 'See the module doc string for a description of this method' - raise NotImplemented, 'Subclass must implement get_tooltip()' + raise NotImplementedError, 'Subclass must implement get_tooltip()' if __name__ == '__main__': diff --git a/portato/gui/gtk/glade/portato.glade b/portato/gui/gtk/glade/portato.glade index f99be90..c8695c3 100644 --- a/portato/gui/gtk/glade/portato.glade +++ b/portato/gui/gtk/glade/portato.glade @@ -392,72 +392,48 @@ 4 2 - + True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC + 1 + True - + True + True + Installed + True + + + False + - - - 2 - 2 - 3 - 5 - 5 - - - - - True - + + True + True + Masked + True + + + + False + 1 + + + + + True + True + Testing + True + + + + False + 2 + - - - 1 - 2 - GTK_FILL - 5 - - - - - True - GTK_JUSTIFY_CENTER - True - - - 2 - GTK_FILL - - 10 - - - - - True - True - <span foreground='red'><b>MISSING KEYWORD</b></span> - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - True - <b>Installed, but not in portage anymore</b> - True 1 @@ -522,55 +498,79 @@ - + + True + True + <b>Installed, but not in portage anymore</b> + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + <span foreground='red'><b>MISSING KEYWORD</b></span> + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + GTK_JUSTIFY_CENTER + True + + + 2 + GTK_FILL + + 10 + + + + True - 1 - True - - - True - True - Installed - True - - - - False - - - - True - True - Masked - True - - - - False - 1 - + + + + 1 + 2 + GTK_FILL + 5 + + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC - + True - True - Testing - True - - - False - 2 - - 1 2 - 1 - 2 - GTK_FILL + 2 + 3 + 5 + 5 @@ -844,6 +844,68 @@ + + + True + 0 + + + True + 12 + + + True + + + True + Portage + True + True + + + + + True + False + pkgCore + True + portageRadio + + + 1 + + + + + True + False + Paludis + True + portageRadio + + + 2 + + + + + + + + + True + <b>System Options</b> + True + + + label_item + + + + + 1 + + True @@ -890,7 +952,7 @@ - 1 + 2 @@ -941,7 +1003,7 @@ - 2 + 3 @@ -969,186 +1031,186 @@ - - True - 0 - 5 - <u><i>Masking Keywords</i></u> - True - True - - - 7 - 8 - 5 - - - - + True - 0 - 5 - <u><i>Testing Keywords</i></u> - True - True - 4 - 5 - 5 + 1 + 2 + 3 + 4 - + True 0 - 5 - <u><i>Use-Flags</i></u> - True + File name to use, if package.use is a directory: True - 1 - 2 - 6 + 3 + 4 - + True - - - True - 0 - GTK_SHADOW_OUT - - - True - 0 - <u>You may use the following placeholders:</u> - - <i>$(cat)</i>: category - <i>$(pkg)</i>: package name - <i>$(cat-1)/$(cat-2)</i>: first/second part of the category - True - - - - - - label_item - - - - + Add only exact version to package.use + True 2 + 2 + 3 - + True - Add only exact version to package.mask/package.unmask + Add only exact version to package.keywords True 2 - 8 - 9 + 5 + 6 - + True 0 - File name to use, if package.mask/package.unmask is a directory: + File name to use, if package.keywords is a directory: True - 9 - 10 + 6 + 7 - + True 1 2 - 9 - 10 + 6 + 7 - + True 1 2 - 6 - 7 + 9 + 10 - + True 0 - File name to use, if package.keywords is a directory: + File name to use, if package.mask/package.unmask is a directory: True - 6 - 7 + 9 + 10 - + True - Add only exact version to package.keywords + Add only exact version to package.mask/package.unmask True 2 - 5 - 6 + 8 + 9 - + True - Add only exact version to package.use - True + + + True + 0 + GTK_SHADOW_OUT + + + True + 0 + <u>You may use the following placeholders:</u> + + <i>$(cat)</i>: category + <i>$(pkg)</i>: package name + <i>$(cat-1)/$(cat-2)</i>: first/second part of the category + True + + + + + + label_item + + + + 2 - 2 - 3 - + True 0 - File name to use, if package.use is a directory: + 5 + <u><i>Use-Flags</i></u> + True True - 3 - 4 + 1 + 2 + 6 - + + True + 0 + 5 + <u><i>Testing Keywords</i></u> + True + True + + + 4 + 5 + 5 + + + + True + 0 + 5 + <u><i>Masking Keywords</i></u> + True + True - 1 - 2 - 3 - 4 + 7 + 8 + 5 @@ -1167,7 +1229,7 @@ - 3 + 4 @@ -1196,7 +1258,7 @@ - 4 + 5 diff --git a/portato/gui/gtk/usetips.py b/portato/gui/gtk/usetips.py index 6611e09..d59e397 100644 --- a/portato/gui/gtk/usetips.py +++ b/portato/gui/gtk/usetips.py @@ -10,7 +10,7 @@ # # Written by René 'Necoro' Neumann -from portato.backend import Package +from portato.backend import system from portato.backend.flags import invert_use_flag from TreeViewTooltips import TreeViewTooltips @@ -48,7 +48,7 @@ class UseTips (TreeViewTooltips): return None def __get_flags(self, cpv): - pkg = Package(cpv) + pkg = system.new_package(cpv) enabled = [] disabled = [] diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py index a872f3a..7841e5e 100644 --- a/portato/gui/gtk/windows.py +++ b/portato/gui/gtk/windows.py @@ -23,8 +23,7 @@ if USE_GTKSOURCEVIEW: # our backend stuff from portato.helper import * from portato.constants import CONFIG_LOCATION, VERSION, DATA_DIR -from portato import backend -from portato.backend import flags +from portato.backend import flags, system from portato.backend.exceptions import * # more GUI stuff @@ -37,7 +36,6 @@ from usetips import UseTips import vte # other -from portage_util import unique_array import types GLADE_FILE = DATA_DIR+"portato.glade" @@ -189,6 +187,19 @@ class PreferenceWindow (AbstractDialog): "syncCommandEdit" : "syncCmd_opt" } + # mapping from the radio buttons to the system name + # widget name -> option + system_radios = { + "portageRadio" : "portage", + "pkgCoreRadio" : "pkgcore", + "paludisRadio" : "paludis" + } + + # mapping from the system name to the radio button + # option -> widget name + systems = {} + systems.update(zip(system_radios.values(), system_radios.keys())) + def __init__ (self, parent, cfg): """Constructor. @@ -206,6 +217,7 @@ class PreferenceWindow (AbstractDialog): hintEB = self.tree.get_widget("hintEB") hintEB.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#f3f785")) + # the checkboxes for box in self.checkboxes: val = self.checkboxes[box] if type(val) == types.TupleType: @@ -215,10 +227,14 @@ class PreferenceWindow (AbstractDialog): self.tree.get_widget(box).\ set_active(self.cfg.get_boolean(val)) + # the edits for edit in self.edits: self.tree.get_widget(edit).\ set_text(self.cfg.get(self.edits[edit])) + # the system radios + self.tree.get_widget(self.systems[self.cfg.get("system_opt").lower()]).set_active(True) + self.window.show_all() def _save(self): @@ -233,6 +249,10 @@ class PreferenceWindow (AbstractDialog): for edit in self.edits: self.cfg.set(self.edits[edit],self.tree.get_widget(edit).get_text()) + + for radio in self.system_radios: + if self.tree.get_widget(radio).get_active(): + self.cfg.set("system_opt", self.system_radios[radio]) def cb_ok_clicked(self, button): """Saves, writes to config-file and closes the window.""" @@ -355,8 +375,8 @@ class PackageTable: self.instantChange = instantChange # packages and installed packages - self.packages = backend.sort_package_list(backend.find_packages(cp, masked = True)) - self.instPackages = backend.sort_package_list(backend.find_installed_packages(cp, masked = True)) + self.packages = system.sort_package_list(system.find_packages(cp, masked = True)) + self.instPackages = system.sort_package_list(system.find_installed_packages(cp, masked = True)) # version-combo-box self.vCombo = self.build_vers_combo() @@ -400,7 +420,7 @@ class PackageTable: pkg_flags = pkg.get_all_use_flags() pkg_flags.sort() for use in pkg_flags: - store.append([pkg.is_use_flag_enabled(use), use, backend.get_use_desc(use, self.cp)]) + store.append([pkg.is_use_flag_enabled(use), use, system.get_use_desc(use, self.cp)]) return store @@ -439,7 +459,7 @@ class PackageTable: if self.version: best_version = self.version else: - best_version = backend.find_best_match(self.packages[0].get_cp(), (self.instPackages != [])).get_version() + best_version = system.find_best_match(self.packages[0].get_cp(), (self.instPackages != [])).get_version() for i in range(len(self.packages)): if self.packages[i].get_version() == best_version: combo.set_active(i) @@ -465,7 +485,7 @@ class PackageTable: try: try: self.queue.append(self.actual_package().get_cpv(), unmerge = False, update = update) - except backend.PackageNotFoundException, e: + except PackageNotFoundException, e: if unmask_dialog(e[0]) == gtk.RESPONSE_YES: self.queue.append(self.actual_package().get_cpv(), unmerge = False, unmask = True, update = update) except BlockedException, e: @@ -473,7 +493,7 @@ class PackageTable: else: try: self.queue.append(self.actual_package().get_cpv(), unmerge = True) - except backend.PackageNotFoundException, e: + except PackageNotFoundException, e: masked_dialog(e[0]) def cb_combo_changed (self, combo): @@ -730,7 +750,7 @@ class MainWindow (Window): store = gtk.ListStore(str) # build categories - for p in backend.list_categories(): + for p in system.list_categories(): store.append([p]) # sort them alphabetically store.set_sort_column_id(0, gtk.SORT_ASCENDING) @@ -823,7 +843,7 @@ class MainWindow (Window): iterator = store.get_original().get_iter(path) if store.is_in_emerge(iterator): package = store.get_value(iterator, 0) - cat, name, vers, rev = backend.split_package_name(package) + cat, name, vers, rev = system.split_cpv(package) if rev != "r0": vers = vers+"-"+rev self.show_package(cat+"/"+name, queue = self.queue, version = vers, instantChange = True, doEmerge = False) return True @@ -844,7 +864,7 @@ class MainWindow (Window): changed_flags_dialog("masking keywords") flags.write_masked() flags.write_testing() - backend.reload_settings() + system.reload_settings() if not self.doUpdate: self.queue.emerge(force=True) @@ -861,11 +881,11 @@ class MainWindow (Window): @Window.watch_cursor def cb_update_clicked (self, action): - if not backend.am_i_root(): + if not am_i_root(): not_root_dialog() else: - updating = backend.update_world(newuse = self.cfg.get_boolean("newuse_opt"), deep = self.cfg.get_boolean("deep_opt")) + updating = system.update_world(newuse = self.cfg.get_boolean("newuse_opt"), deep = self.cfg.get_boolean("deep_opt")) debug("updating list:", [(x.get_cpv(), y.get_cpv()) for x,y in updating],"--> length:",len(updating)) try: @@ -907,7 +927,7 @@ class MainWindow (Window): return True def cb_sync_clicked (self, action): - if not backend.am_i_root(): + if not am_i_root(): not_root_dialog() else: self.notebook.set_current_page(self.CONSOLE_PAGE) @@ -920,7 +940,7 @@ class MainWindow (Window): self.queue.sync() def cb_save_flags_clicked (self, action): - if not backend.am_i_root(): + if not am_i_root(): not_root_dialog() else: flags.write_use_flags() @@ -930,7 +950,7 @@ class MainWindow (Window): @Window.watch_cursor def cb_reload_clicked (self, action): """Reloads the portage settings and the database.""" - backend.reload_settings() + system.reload_settings() del self.db self.db = Database() self.db.populate() @@ -939,7 +959,7 @@ class MainWindow (Window): def cb_search_clicked (self, entry): """Do a search.""" if entry.get_text() != "": - packages = backend.find_all_packages(entry.get_text(), withVersion = False) + packages = system.find_all_packages(entry.get_text(), withVersion = False) if packages == []: nothing_found_dialog() -- cgit v1.2.3-54-g00ecf