diff options
Diffstat (limited to '')
-rw-r--r-- | portato/gui/gtk/TreeViewTooltips.py | 2 | ||||
-rw-r--r-- | portato/gui/gtk/glade/portato.glade | 452 | ||||
-rw-r--r-- | portato/gui/gtk/usetips.py | 4 | ||||
-rw-r--r-- | portato/gui/gtk/windows.py | 56 | ||||
-rw-r--r-- | portato/gui/gui_helper.py | 50 |
5 files changed, 325 insertions, 239 deletions
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 @@ <property name="n_rows">4</property> <property name="n_columns">2</property> <child> - <widget class="GtkScrolledWindow" id="useListScroll"> + <widget class="GtkHBox" id="checkHB"> <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="spacing">1</property> + <property name="homogeneous">True</property> <child> - <widget class="GtkTreeView" id="useList"> + <widget class="GtkCheckButton" id="installedCheck"> <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">Installed</property> + <property name="draw_indicator">True</property> + <signal name="button_press_event" handler="cb_button_pressed"/> </widget> + <packing> + <property name="fill">False</property> + </packing> </child> - </widget> - <packing> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">5</property> - <property name="y_padding">5</property> - </packing> - </child> - <child> - <widget class="GtkVBox" id="comboVB"> - <property name="visible">True</property> <child> - <placeholder/> + <widget class="GtkCheckButton" id="maskedCheck"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">Masked</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="cb_masked_toggled"/> + </widget> + <packing> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkCheckButton" id="testingCheck"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">Testing</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="cb_testing_toggled"/> + </widget> + <packing> + <property name="fill">False</property> + <property name="position">2</property> + </packing> </child> - </widget> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">GTK_FILL</property> - <property name="x_padding">5</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="descLabel"> - <property name="visible">True</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">True</property> - </widget> - <packing> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - <property name="y_padding">10</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="missingLabel"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes"><span foreground='red'><b>MISSING KEYWORD</b></span></property> - <property name="use_markup">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="notInSysLabel"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes"><b>Installed, but not in portage anymore</b></property> - <property name="use_markup">True</property> </widget> <packing> <property name="left_attach">1</property> @@ -522,55 +498,79 @@ </packing> </child> <child> - <widget class="GtkHBox" id="checkHB"> + <widget class="GtkLabel" id="notInSysLabel"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes"><b>Installed, but not in portage anymore</b></property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="missingLabel"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes"><span foreground='red'><b>MISSING KEYWORD</b></span></property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="descLabel"> + <property name="visible">True</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="wrap">True</property> + </widget> + <packing> + <property name="right_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + <property name="y_padding">10</property> + </packing> + </child> + <child> + <widget class="GtkVBox" id="comboVB"> <property name="visible">True</property> - <property name="spacing">1</property> - <property name="homogeneous">True</property> - <child> - <widget class="GtkCheckButton" id="installedCheck"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes">Installed</property> - <property name="draw_indicator">True</property> - <signal name="button_press_event" handler="cb_button_pressed"/> - </widget> - <packing> - <property name="fill">False</property> - </packing> - </child> <child> - <widget class="GtkCheckButton" id="maskedCheck"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes">Masked</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="cb_masked_toggled"/> - </widget> - <packing> - <property name="fill">False</property> - <property name="position">1</property> - </packing> + <placeholder/> </child> + </widget> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options">GTK_FILL</property> + <property name="x_padding">5</property> + </packing> + </child> + <child> + <widget class="GtkScrolledWindow" id="useListScroll"> + <property name="visible">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <child> - <widget class="GtkCheckButton" id="testingCheck"> + <widget class="GtkTreeView" id="useList"> <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes">Testing</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="cb_testing_toggled"/> </widget> - <packing> - <property name="fill">False</property> - <property name="position">2</property> - </packing> </child> </widget> <packing> - <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">GTK_FILL</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_padding">5</property> + <property name="y_padding">5</property> </packing> </child> </widget> @@ -845,6 +845,68 @@ </widget> </child> <child> + <widget class="GtkFrame" id="systemFrame"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <child> + <widget class="GtkAlignment" id="alignment6"> + <property name="visible">True</property> + <property name="left_padding">12</property> + <child> + <widget class="GtkHButtonBox" id="systemButtonBox"> + <property name="visible">True</property> + <child> + <widget class="GtkRadioButton" id="portageRadio"> + <property name="visible">True</property> + <property name="label" translatable="yes">Portage</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </widget> + </child> + <child> + <widget class="GtkRadioButton" id="pkgCoreRadio"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="label" translatable="yes">pkgCore</property> + <property name="draw_indicator">True</property> + <property name="group">portageRadio</property> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkRadioButton" id="paludisRadio"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="label" translatable="yes">Paludis</property> + <property name="draw_indicator">True</property> + <property name="group">portageRadio</property> + </widget> + <packing> + <property name="position">2</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + <child> + <widget class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>System Options</b></property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> <widget class="GtkFrame" id="syncFrame"> <property name="visible">True</property> <property name="label_xalign">0</property> @@ -890,7 +952,7 @@ </child> </widget> <packing> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -941,7 +1003,7 @@ </child> </widget> <packing> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> <child> @@ -969,186 +1031,186 @@ <placeholder/> </child> <child> - <widget class="GtkLabel" id="maskLabel"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="xpad">5</property> - <property name="label" translatable="yes"><u><i>Masking Keywords</i></u></property> - <property name="use_markup">True</property> - <property name="single_line_mode">True</property> - </widget> - <packing> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - <property name="y_padding">5</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="testLabel"> + <widget class="GtkEntry" id="useFileEdit"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="xpad">5</property> - <property name="label" translatable="yes"><u><i>Testing Keywords</i></u></property> - <property name="use_markup">True</property> - <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="y_padding">5</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> </packing> </child> <child> - <widget class="GtkLabel" id="useLabel"> + <widget class="GtkLabel" id="useEditLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="xpad">5</property> - <property name="label" translatable="yes"><u><i>Use-Flags</i></u></property> - <property name="use_markup">True</property> + <property name="label" translatable="yes">File name to use, if package.use is a directory: </property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_padding">6</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> </packing> </child> <child> - <widget class="GtkEventBox" id="hintEB"> + <widget class="GtkCheckButton" id="usePerVersionCheck"> <property name="visible">True</property> - <child> - <widget class="GtkFrame" id="hintFrame"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - <child> - <widget class="GtkLabel" id="hintLabel"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes"><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</property> - <property name="use_markup">True</property> - </widget> - </child> - <child> - <placeholder/> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - </child> + <property name="label" translatable="yes">Add only exact version to package.use</property> + <property name="draw_indicator">True</property> </widget> <packing> <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="maskPerVersionCheck"> + <widget class="GtkCheckButton" id="testPerVersionCheck"> <property name="visible">True</property> - <property name="label" translatable="yes">Add only exact version to package.mask/package.unmask</property> + <property name="label" translatable="yes">Add only exact version to package.keywords</property> <property name="draw_indicator">True</property> </widget> <packing> <property name="right_attach">2</property> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> </packing> </child> <child> - <widget class="GtkLabel" id="maskEditLabel"> + <widget class="GtkLabel" id="testEditLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">File name to use, if package.mask/package.unmask is a directory: </property> + <property name="label" translatable="yes">File name to use, if package.keywords is a directory: </property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> </packing> </child> <child> - <widget class="GtkEntry" id="maskFileEdit"> + <widget class="GtkEntry" id="testFileEdit"> <property name="visible">True</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> </packing> </child> <child> - <widget class="GtkEntry" id="testFileEdit"> + <widget class="GtkEntry" id="maskFileEdit"> <property name="visible">True</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> </packing> </child> <child> - <widget class="GtkLabel" id="testEditLabel"> + <widget class="GtkLabel" id="maskEditLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">File name to use, if package.keywords is a directory: </property> + <property name="label" translatable="yes">File name to use, if package.mask/package.unmask is a directory: </property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="testPerVersionCheck"> + <widget class="GtkCheckButton" id="maskPerVersionCheck"> <property name="visible">True</property> - <property name="label" translatable="yes">Add only exact version to package.keywords</property> + <property name="label" translatable="yes">Add only exact version to package.mask/package.unmask</property> <property name="draw_indicator">True</property> </widget> <packing> <property name="right_attach">2</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> + <property name="top_attach">8</property> + <property name="bottom_attach">9</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="usePerVersionCheck"> + <widget class="GtkEventBox" id="hintEB"> <property name="visible">True</property> - <property name="label" translatable="yes">Add only exact version to package.use</property> - <property name="draw_indicator">True</property> + <child> + <widget class="GtkFrame" id="hintFrame"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">GTK_SHADOW_OUT</property> + <child> + <widget class="GtkLabel" id="hintLabel"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes"><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</property> + <property name="use_markup">True</property> + </widget> + </child> + <child> + <placeholder/> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + </child> </widget> <packing> <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> </packing> </child> <child> - <widget class="GtkLabel" id="useEditLabel"> + <widget class="GtkLabel" id="useLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">File name to use, if package.use is a directory: </property> + <property name="xpad">5</property> + <property name="label" translatable="yes"><u><i>Use-Flags</i></u></property> + <property name="use_markup">True</property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_padding">6</property> </packing> </child> <child> - <widget class="GtkEntry" id="useFileEdit"> + <widget class="GtkLabel" id="testLabel"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="xpad">5</property> + <property name="label" translatable="yes"><u><i>Testing Keywords</i></u></property> + <property name="use_markup">True</property> + <property name="single_line_mode">True</property> + </widget> + <packing> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="y_padding">5</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="maskLabel"> <property name="visible">True</property> + <property name="xalign">0</property> + <property name="xpad">5</property> + <property name="label" translatable="yes"><u><i>Masking Keywords</i></u></property> + <property name="use_markup">True</property> + <property name="single_line_mode">True</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">7</property> + <property name="bottom_attach">8</property> + <property name="y_padding">5</property> </packing> </child> </widget> @@ -1167,7 +1229,7 @@ </child> </widget> <packing> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> <child> @@ -1196,7 +1258,7 @@ </child> </widget> <packing> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> </widget> 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 <necoro@necoro.net> -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() diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py index be42b52..cf03a57 100644 --- a/portato/gui/gui_helper.py +++ b/portato/gui/gui_helper.py @@ -12,7 +12,7 @@ # some backend things from portato import backend -from portato.backend import flags +from portato.backend import flags, system from portato.helper import * # parser @@ -45,7 +45,8 @@ class Config: "deep_opt" : "deep", "newuse_opt" : "newuse", "syncCmd_opt" : "synccommand", - "useTips_opt" : "showusetips" + "useTips_opt" : "showusetips", + "system_opt" : "system" } def __init__ (self, cfgFile): @@ -205,8 +206,8 @@ class Database: @type category: string""" # get the lists - packages = backend.find_all_packages(name = category, withVersion = False) - installed = backend.find_all_installed_packages(name = category, withVersion = False) + packages = system.find_all_packages(name = category, withVersion = False) + installed = system.find_all_installed_packages(name = category, withVersion = False) # cycle through packages for p in packages: @@ -294,17 +295,17 @@ class EmergeQueue: @raises backend.PackageNotFoundException: If no package could be found - normally it is existing but masked.""" # for the beginning: let us create a package object - but it is not guaranteed, that it actually exists in portage - pkg = backend.Package(cpv) + pkg = system.new_package(cpv) masked = not (pkg.is_masked() or pkg.is_testing(use_keywords=True)) # we are setting this to True in case we have unmasked it already, but portage does not know this # and now try to find it in portage - pkg = backend.find_packages("="+cpv, masked = masked) + pkg = system.find_packages("="+cpv, masked = masked) if pkg: # gotcha pkg = pkg[0] elif unmask: # no pkg returned, but we are allowed to unmask it - pkg = backend.find_packages("="+cpv, masked = True)[0] + pkg = system.find_packages("="+cpv, masked = True)[0] if pkg.is_testing(use_keywords = True): pkg.set_testing(True) if pkg.is_masked(): @@ -338,7 +339,7 @@ class EmergeQueue: try: pkg = self._get_pkg_from_cpv(cpv, unmask) if not pkg.is_installed(): - old = backend.find_installed_packages(pkg.get_slot_cp()) + old = system.find_installed_packages(pkg.get_slot_cp()) if old: old = old[0] # assume we have only one there; FIXME: slotted packages update = True @@ -450,11 +451,11 @@ class EmergeQueue: for p in packages: if p in ["world", "system"]: continue - cat = backend.split_package_name(p)[0] # get category + cat = system.split_cpv(p)[0] # get category self.db.reload(cat) debug("Category %s refreshed" % cat) - def _emerge (self, options, packages, it, command = ["/usr/bin/python","/usr/bin/emerge"]): + def _emerge (self, options, packages, it, command = None): """Calls emerge and updates the terminal. @param options: options to send to emerge @@ -466,6 +467,9 @@ class EmergeQueue: @param command: the command to execute - default is "/usr/bin/python /usr/bin/emerge" @type command: string[]""" + if command is None: + command = system.get_merge_command() + # open tty (master, slave) = pty.openpty() self.console.set_pty(master) @@ -501,8 +505,8 @@ class EmergeQueue: # prepare package-list for oneshot list, its = prepare(self.oneshotmerge) - s = ["--oneshot"] - if not force: s += ["--verbose", "--pretend"] + s = system.get_oneshot_option() + if not force: s += system.get_pretend_option() self._emerge(s, list, its) @@ -512,7 +516,7 @@ class EmergeQueue: list, its = prepare(self.mergequeue) s = [] - if not force: s = ["--verbose", "--pretend"] + if not force: s = system.get_pretend_option() self._emerge(s, list, its) @@ -527,8 +531,8 @@ class EmergeQueue: list = self.unmergequeue[:] # copy the unmerge-queue # set options - s = ["-C"] - if not force: s += ["-pv"] + s = system.get_unmerge_option() + if not force: s += system.get_pretend_option() self._emerge(s,list, [self.unmergeIt]) @@ -538,11 +542,11 @@ class EmergeQueue: @param force: If False, '-pv' is send to emerge. Default: False. @type force: boolean""" - options = ["--update"] + options = system.get_update_option() - if newuse: options += ["--newuse"] - if deep: options += ["--deep"] - if not force: options += ["-pv"] + if newuse: options += system.get_newuse_option() + if deep: options += system.get_deep_option() + if not force: options += system.get_pretend_option() self._emerge(options, ["world"], [self.emergeIt]) @@ -552,10 +556,10 @@ class EmergeQueue: @param command: command to execute to sync. If None "emerge --sync" is taken. @type command: string[]""" - if command == None: - self._emerge(["--sync"], [], []) - else: - self._emerge([],[],[], command = command) + if command is None: + command = system.get_sync_command() + + self._emerge([],[],[], command = command) def kill_emerge (self): """Kills the emerge process.""" |