summaryrefslogtreecommitdiff
path: root/geneticone/gui
diff options
context:
space:
mode:
Diffstat (limited to 'geneticone/gui')
-rw-r--r--geneticone/gui/gtk/glade/geneticone.glade319
-rw-r--r--geneticone/gui/gtk/windows.py80
-rw-r--r--geneticone/gui/gtk/wrapper.py28
-rw-r--r--geneticone/gui/gui_helper.py46
-rw-r--r--geneticone/gui/wrapper.py52
5 files changed, 310 insertions, 215 deletions
diff --git a/geneticone/gui/gtk/glade/geneticone.glade b/geneticone/gui/gtk/glade/geneticone.glade
index b9ce4cc..598ddce 100644
--- a/geneticone/gui/gtk/glade/geneticone.glade
+++ b/geneticone/gui/gtk/glade/geneticone.glade
@@ -33,6 +33,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">_Reload Portage</property>
<property name="use_underline">True</property>
+ <signal name="activate" handler="cb_reload_clicked"/>
</widget>
</child>
<child>
@@ -222,74 +223,47 @@
<property name="n_rows">4</property>
<property name="n_columns">2</property>
<child>
- <widget class="GtkHButtonBox" id="buttonBB">
+ <widget class="GtkScrolledWindow" id="useListScroll">
<property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
- <child>
- <widget class="GtkButton" id="pkgEmergeBtn">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Emerge</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="cb_package_emerge_clicked"/>
- </widget>
- </child>
- <child>
- <widget class="GtkButton" id="pkgUnmergeBtn">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Unmerge</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="cb_package_unmerge_clicked"/>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<child>
- <widget class="GtkButton" id="pkgRevertBtn">
+ <widget class="GtkTreeView" id="useList">
<property name="visible">True</property>
- <property name="label" translatable="yes">Re_vert</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="cb_package_revert_clicked"/>
</widget>
- <packing>
- <property name="position">2</property>
- </packing>
</child>
</widget>
<packing>
<property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_padding">5</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="notInSysLabel">
+ <widget class="GtkVBox" id="comboVB">
<property name="visible">True</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Installed, but not in portage anymore&lt;/b&gt;</property>
- <property name="use_markup">True</property>
+ <child>
+ <placeholder/>
+ </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>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="missingLabel">
+ <widget class="GtkLabel" id="descLabel">
<property name="visible">True</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">&lt;span foreground='red'&gt;&lt;b&gt;MISSING KEYWORD&lt;/b&gt;&lt;/span&gt;</property>
- <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">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>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND</property>
+ <property name="y_padding">10</property>
</packing>
</child>
<child>
@@ -341,47 +315,74 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="descLabel">
+ <widget class="GtkLabel" id="missingLabel">
<property name="visible">True</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">True</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">&lt;span foreground='red'&gt;&lt;b&gt;MISSING KEYWORD&lt;/b&gt;&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
</widget>
<packing>
+ <property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_EXPAND</property>
- <property name="y_padding">10</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="GtkVBox" id="comboVB">
+ <widget class="GtkLabel" id="notInSysLabel">
<property name="visible">True</property>
- <child>
- <placeholder/>
- </child>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Installed, but not in portage anymore&lt;/b&gt;</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="GtkScrolledWindow" id="useListScroll">
+ <widget class="GtkHButtonBox" id="buttonBB">
<property name="visible">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
<child>
- <widget class="GtkTreeView" id="useList">
+ <widget class="GtkButton" id="pkgEmergeBtn">
<property name="visible">True</property>
+ <property name="label" translatable="yes">_Emerge</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="cb_package_emerge_clicked"/>
</widget>
</child>
+ <child>
+ <widget class="GtkButton" id="pkgUnmergeBtn">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Unmerge</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="cb_package_unmerge_clicked"/>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="pkgRevertBtn">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Re_vert</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="cb_package_revert_clicked"/>
+ </widget>
+ <packing>
+ <property name="position">2</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="y_padding">5</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
</packing>
</child>
</widget>
@@ -705,186 +706,186 @@
<placeholder/>
</child>
<child>
- <widget class="GtkEntry" id="useFileEdit">
+ <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">&lt;u&gt;&lt;i&gt;Masking Keywords&lt;/i&gt;&lt;/u&gt;</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>
<child>
- <widget class="GtkLabel" id="useEditLabel">
+ <widget class="GtkLabel" id="testLabel">
<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">&lt;u&gt;&lt;i&gt;Testing Keywords&lt;/i&gt;&lt;/u&gt;</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">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="y_padding">5</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="usePerVersionCheck">
+ <widget class="GtkLabel" id="useLabel">
<property name="visible">True</property>
- <property name="label" translatable="yes">Add only exact version to package.use</property>
- <property name="draw_indicator">True</property>
+ <property name="xalign">0</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes">&lt;u&gt;&lt;i&gt;Use-Flags&lt;/i&gt;&lt;/u&gt;</property>
+ <property name="use_markup">True</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>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEventBox" id="hintEB">
+ <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">&lt;u&gt;You may use the following placeholders:&lt;/u&gt;
+
+&lt;i&gt;$(cat)&lt;/i&gt;: category
+&lt;i&gt;$(pkg)&lt;/i&gt;: package name
+&lt;i&gt;$(cat-1)/$(cat-2)&lt;/i&gt;: 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="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="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="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="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="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="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="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">&lt;u&gt;You may use the following placeholders:&lt;/u&gt;
-
-&lt;i&gt;$(cat)&lt;/i&gt;: category
-&lt;i&gt;$(pkg)&lt;/i&gt;: package name
-&lt;i&gt;$(cat-1)/$(cat-2)&lt;/i&gt;: 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="GtkLabel" id="useLabel">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="xpad">5</property>
- <property name="label" translatable="yes">&lt;u&gt;&lt;i&gt;Use-Flags&lt;/i&gt;&lt;/u&gt;</property>
- <property name="use_markup">True</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>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="testLabel">
+ <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">&lt;u&gt;&lt;i&gt;Testing Keywords&lt;/i&gt;&lt;/u&gt;</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">4</property>
- <property name="bottom_attach">5</property>
- <property name="y_padding">5</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="maskLabel">
+ <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">&lt;u&gt;&lt;i&gt;Masking Keywords&lt;/i&gt;&lt;/u&gt;</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>
+ <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>
</widget>
@@ -938,4 +939,14 @@
</widget>
</child>
</widget>
+ <widget class="GtkMenu" id="queuePopup">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkMenuItem" id="oneShotItem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">oneshot</property>
+ <signal name="activate" handler="cb_oneshot_clicked"/>
+ </widget>
+ </child>
+ </widget>
</glade-interface>
diff --git a/geneticone/gui/gtk/windows.py b/geneticone/gui/gtk/windows.py
index c73394c..98bcba4 100644
--- a/geneticone/gui/gtk/windows.py
+++ b/geneticone/gui/gtk/windows.py
@@ -481,6 +481,8 @@ class PackageTable:
self.actual_package().remove_new_masked()
self.actual_package().remove_new_testing()
self.cb_combo_changed(self.vCombo)
+ if self.instantChange:
+ self._update_keywords(True, update = True)
return True
def cb_package_emerge_clicked (self, button):
@@ -612,8 +614,14 @@ class MainWindow (Window):
self.packageTable = PackageTable(self)
self.packageTable.table.hide_all()
+ # popup
+ popupTree = gtk.glade.XML(DATA_DIR+"geneticone.glade", root = "queuePopup")
+ popupTree.signal_autoconnect(self)
+ self.queuePopup = popupTree.get_widget("queuePopup")
+
# set emerge queue
- self.queue = EmergeQueue(console = GtkConsole(term), tree = GtkTree(self.queueList.get_model()), db = self.db)
+ self.queueTree = GtkTree(self.queueList.get_model())
+ self.queue = EmergeQueue(console = GtkConsole(term), tree = self.queueTree, db = self.db)
def show_package (self, *args, **kwargs):
self.packageTable.update(*args, **kwargs)
@@ -706,12 +714,14 @@ class MainWindow (Window):
def cb_row_activated (self, view, path, *args):
"""Callback for an activated row in the emergeQueue. Opens a package window."""
- store = view.get_model()
+ store = self.queueTree
if len(path) > 1:
- package = store.get_value(store.get_iter(path), 0)
- cat, name, vers, rev = backend.split_package_name(package)
- if rev != "r0": vers = vers+"-"+rev
- self.show_package(cat+"/"+name, queue = self.queue, version = vers, instantChange = True, doEmerge = False)
+ 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)
+ if rev != "r0": vers = vers+"-"+rev
+ self.show_package(cat+"/"+name, queue = self.queue, version = vers, instantChange = True, doEmerge = False)
return True
def cb_emerge_clicked (self, action):
@@ -784,8 +794,11 @@ class MainWindow (Window):
return True
def cb_sync_clicked (self, action):
- self.notebook.set_current_page(self.CONSOLE_PAGE)
- self.queue.sync()
+ if not backend.am_i_root():
+ not_root_dialog()
+ else:
+ self.notebook.set_current_page(self.CONSOLE_PAGE)
+ self.queue.sync()
@Window.watch_cursor
def cb_reload_clicked (self, action):
@@ -818,34 +831,33 @@ class MainWindow (Window):
return True
def cb_queue_right_click (self, queue, event):
- pass
- # if event.button == 3:
- # x = int(event.x)
- # y = int(event.y)
- # time = event.time
- # pthinfo = queue.get_path_at_pos(x, y)
- # if pthinfo is not None:
- # path, col, cellx, celly = pthinfo
- # queue.grab_focus()
- # queue.set_cursor(path, col, 0)
- # self.queuePopup.popup(None, None, None, event.button, time)
- # return True
- # else:
- # return False
+ if event.button == 3:
+ x = int(event.x)
+ y = int(event.y)
+ time = event.time
+ pthinfo = queue.get_path_at_pos(x, y)
+ if pthinfo is not None:
+ path, col, cellx, celly = pthinfo
+ if self.queueTree.is_in_emerge(self.queueTree.get_original().get_iter(path)):
+ queue.grab_focus()
+ queue.set_cursor(path, col, 0)
+ self.queuePopup.popup(None, None, None, event.button, time)
+ return True
+ else:
+ return False
def cb_oneshot_clicked (self, action):
- pass
- # sel = self.queueList.get_selection()
- # store, it = sel.get_selected()
- # if it:
- # package = store.get_value(it, 0)
- # if not self.cfg.get_local(package, self.cfg.const["oneshot_opt"]):
- # set = True
- # else:
- # set = False
- #
- # self.cfg.set_local(package, self.cfg.const["oneshot_opt"], set)
- # self.queue.append(package, update = True, oneshot = set, forceUpdate = True)
+ sel = self.queueList.get_selection()
+ store, it = sel.get_selected()
+ if it:
+ package = store.get_value(it, 0)
+ if not self.cfg.get_local(package, self.cfg.const["oneshot_opt"]):
+ set = True
+ else:
+ set = False
+
+ self.cfg.set_local(package, self.cfg.const["oneshot_opt"], set)
+ self.queue.append(package, update = True, oneshot = set, forceUpdate = True)
def cb_destroy (self, widget):
"""Calls main_quit()."""
diff --git a/geneticone/gui/gtk/wrapper.py b/geneticone/gui/gtk/wrapper.py
index 6f3cdd8..7597a8a 100644
--- a/geneticone/gui/gtk/wrapper.py
+++ b/geneticone/gui/gtk/wrapper.py
@@ -25,6 +25,34 @@ class GtkTree (Tree):
self.tree = tree
self.cpv_col = col
+ self.emergeIt = self.append(None, ["Emerge", ""])
+ self.unmergeIt = self.append(None, ["Unmerge", ""])
+
+ def build_append_value (self, cpv, oneshot = False, update = False, version = None):
+ string = ""
+
+ if oneshot:
+ string += "<i>oneshot</i>"
+ if update: string += "; "
+
+ if update:
+ string += "<i>updating</i>"
+ if version != None:
+ string += "<i> from version %s</i>" % version
+
+ return [cpv, string]
+
+ def get_emerge_it (self):
+ return self.emergeIt
+
+ def get_unmerge_it (self):
+ return self.unmergeIt
+
+ def is_in_emerge (self, it):
+ return self.get_path_from_iter(it).split(":")[0] == self.get_path_from_iter(self.emergeIt)
+
+ def is_in_unmerge (self, it):
+ return self.get_path_from_iter(it).split(":")[0] == self.get_path_from_iter(self.unmergeIt)
def iter_has_parent (self, it):
return (self.tree.iter_parent(it) != None)
diff --git a/geneticone/gui/gui_helper.py b/geneticone/gui/gui_helper.py
index 81e26ef..3e41501 100644
--- a/geneticone/gui/gui_helper.py
+++ b/geneticone/gui/gui_helper.py
@@ -246,10 +246,10 @@ class EmergeQueue:
self.db = db
- # our iterators pointing at the toplevels; they are set to None if do not have a tree
+ # our iterators pointing at the toplevels; they are set to None if we do not have a tree
if self.tree:
- self.emergeIt = self.tree.append(None, ["Emerge", ""])
- self.unmergeIt = self.tree.append(None, ["Unmerge", ""])
+ self.emergeIt = self.tree.get_emerge_it()
+ self.unmergeIt = self.tree.get_unmerge_it()
else:
self.emergeIt = self.unmergeIt = None
@@ -287,7 +287,7 @@ class EmergeQueue:
return pkg
- def update_tree (self, it, cpv, unmask = False, options = None):
+ def update_tree (self, it, cpv, unmask = False, oneshot = False):
"""This updates the tree recursivly, or? Isn't it? Bjorn!
@param it: iterator where to append
@@ -296,24 +296,25 @@ class EmergeQueue:
@type cpv: string (cat/pkg-ver)
@param unmask: True if we are allowed to look for masked packages
@type unmask: boolean
- @param options: options to append to the tree
- @type options: string[]
+ @param oneshot: True if we want to emerge is oneshot
+ @type oneshot: boolean
@raises backend.BlockedException: When occured during dependency-calculation.
@raises backend.PackageNotFoundException: If no package could be found - normally it is existing but masked."""
- if not options: options = []
-
if cpv in self.deps:
return # in list already and therefore it's already in the tree too
+ update = False
+ uVersion = None
try:
pkg = self._get_pkg_from_cpv(cpv, unmask)
if not pkg.is_installed():
old = backend.get_all_installed_versions(pkg.get_cp())
if old:
old = old[0] # assume we have only one there; FIXME: slotted packages
- options += ["updating from "+old.get_version()]
+ update = True
+ uVersion = old.get_version()
except backend.PackageNotFoundException, e: # package not found / package is masked -> delete current tree and re-raise the exception
if self.tree.iter_has_parent(it):
@@ -323,7 +324,7 @@ class EmergeQueue:
raise e
# add iter
- subIt = self.tree.append(it, [cpv, "<i>"+" ".join(options)+"</i>"])
+ subIt = self.tree.append(it, self.tree.build_append_value(cpv, oneshot = oneshot, update = update, version = uVersion))
self.iters.update({cpv: subIt})
# get dependencies
@@ -339,7 +340,7 @@ class EmergeQueue:
self.remove_with_children(subIt)
raise e
- def append (self, cpv, unmerge = False, update = False, forceUpdate = False, unmask = False, oneshot = False, options = []):
+ def append (self, cpv, unmerge = False, update = False, forceUpdate = False, unmask = False, oneshot = False):
"""Appends a cpv either to the merge queue or to the unmerge-queue.
Also updates the tree-view.
@@ -355,8 +356,6 @@ class EmergeQueue:
@type unmask: boolean
@param oneshot: True if this package should not be added to the world-file.
@type oneshot: boolean
- @param options: additional options to get showed in tree
- @type options: string[]
@raises geneticone.backend.PackageNotFoundException: if trying to add a package which does not exist"""
@@ -376,18 +375,18 @@ class EmergeQueue:
self.remove_with_children(self.iters[cpv], removeNewFlags = False)
if hasBeenInQueue: # package has been in queue before
- options += self._queue_append(cpv, oneshot)
+ self._queue_append(cpv, oneshot)
- self.update_tree(parentIt, cpv, unmask, options = options)
+ self.update_tree(parentIt, cpv, unmask, oneshot = oneshot)
else: # not update
- options += self._queue_append(cpv, oneshot)
+ self._queue_append(cpv, oneshot)
if self.emergeIt:
- self.update_tree(self.emergeIt, cpv, unmask, options)
+ self.update_tree(self.emergeIt, cpv, unmask, oneshot = oneshot)
else: # unmerge
self.unmergequeue.append(cpv)
if self.unmergeIt: # update tree
- self.tree.append(self.unmergeIt, [cpv, ""])
+ self.tree.append(self.unmergeIt, self.tree.build_append_value(cpv))
def _queue_append (self, cpv, oneshot = False):
"""Convenience function appending a cpv either to self.mergequeue or to self.oneshotmerge.
@@ -395,19 +394,12 @@ class EmergeQueue:
@param cpv: cpv to add
@type cpv: string (cpv)
@param oneshot: True if this package should not be added to the world-file.
- @type oneshot: boolean
+ @type oneshot: boolean"""
- @returns: options set
- @rtype: string[]"""
-
- options = []
if not oneshot:
self.mergequeue.append(cpv)
else:
self.oneshotmerge.append(cpv)
- options.append("oneshot")
-
- return options
def _update_packages(self, packages, process = None):
"""This updates the packages-list. It simply makes the db to rebuild the specific category.
@@ -558,7 +550,7 @@ class EmergeQueue:
if self.tree.iter_has_parent(it): # NEVER remove our top stuff
cpv = self.tree.get_value(it, self.tree.get_cpv_column())
- if self.tree.get_path_from_iter(it).split(":")[0] == self.tree.get_path_from_iter(self.emergeIt): # in Emerge
+ if self.tree.is_in_emerge(it): # Emerge
del self.iters[cpv]
try:
del self.deps[cpv]
diff --git a/geneticone/gui/wrapper.py b/geneticone/gui/wrapper.py
index fd69e82..3616d21 100644
--- a/geneticone/gui/wrapper.py
+++ b/geneticone/gui/wrapper.py
@@ -106,6 +106,10 @@ class Tree:
@rtype: tree-object"""
raise NotImplementedError
+ #
+ # the "design" part
+ #
+
def get_cpv_column (self):
"""Returns the number of the column where the cpv's are stored.
@@ -113,6 +117,54 @@ class Tree:
@rtype: int"""
raise NotImplementedError
+ def is_in_emerge (self, it):
+ """Checks whether an iterator is part of the "Emerge" section.
+
+ @param it: the iterator to check
+ @type it: Iterator
+ @returns: True if the iter is part; False otherwise
+ @rtype: boolean"""
+ raise NotImplementedError
+
+ def is_in_unmerge (self, it):
+ """Checks whether an iterator is part of the "Unmerge" section.
+
+ @param it: the iterator to check
+ @type it: Iterator
+ @returns: True if the iter is part; False otherwise
+ @rtype: boolean"""
+ raise NotImplementedError
+
+ def get_emerge_it (self):
+ """Returns an iterator signaling the top of the emerge section.
+
+ @returns: emerge-iterator
+ @rtype: Iterator"""
+ raise NotImplementedError
+
+ def get_unmerge_it (self):
+ """Returns an iterator signaling the top of the unmerge section.
+
+ @returns: unmerge-iterator
+ @rtype: Iterator"""
+ raise NotImplementedError
+
+ def build_append_value (self, cpv, oneshot = False, update = False, version = None):
+ """Builds the list, which is going to be passed to append.
+
+ @param cpv: the cpv
+ @type cpv: string (cpv)
+ @param oneshot: True if oneshot
+ @type oneshot: boolean
+ @param update: True if this is an update
+ @type update: boolean
+ @param version: the version we update from
+ @type version: string
+
+ @returns: the created list
+ @rtype: list"""
+ raise NotImplementedError
+
class Console:
"""This represents the abstract of a console. It should be used for all operations not in a specific frontend, where a console is needed.
Each frontend _MUST_ define its own subclass and implement ALL of the methods, otherwise a NotImplementedError will be thrown."""