diff options
Diffstat (limited to '')
-rw-r--r-- | geneticone/gui/gtk/glade/geneticone.glade | 319 | ||||
-rw-r--r-- | geneticone/gui/gtk/windows.py | 80 | ||||
-rw-r--r-- | geneticone/gui/gtk/wrapper.py | 28 |
3 files changed, 239 insertions, 188 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"><b>Installed, but not in portage anymore</b></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"><span foreground='red'><b>MISSING KEYWORD</b></span></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"><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="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"><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="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"><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> <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"><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">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"><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">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"><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="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"><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="GtkLabel" id="useLabel"> - <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="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"><u><i>Testing Keywords</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">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"><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> + <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) |