diff options
-rw-r--r-- | portato/gui/templates/MainWindow.glade | 136 | ||||
-rw-r--r-- | portato/gui/windows/main.py | 58 |
2 files changed, 102 insertions, 92 deletions
diff --git a/portato/gui/templates/MainWindow.glade b/portato/gui/templates/MainWindow.glade index c9e32fd..07349fa 100644 --- a/portato/gui/templates/MainWindow.glade +++ b/portato/gui/templates/MainWindow.glade @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> -<!--Generated with glade3 3.4.1 on Tue Mar 25 14:51:55 2008 --> +<!--Generated with glade3 3.4.1 on Tue Mar 25 15:21:22 2008 --> <glade-interface> <widget class="GtkWindow" id="MainWindow"> <property name="border_width">2</property> @@ -436,17 +436,48 @@ </packing> </child> <child> - <widget class="GtkScrolledWindow" id="pkgScroll"> + <widget class="GtkHPaned" id="listPaned2"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="can_focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <widget class="GtkTreeView" id="pkgList"> + <widget class="GtkScrolledWindow" id="pkgScroll"> <property name="visible">True</property> - <property name="headers_clickable">True</property> - <property name="search_column">0</property> + <property name="can_focus">False</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <child> + <widget class="GtkTreeView" id="pkgList"> + <property name="visible">True</property> + <property name="headers_clickable">True</property> + <property name="search_column">0</property> + </widget> + </child> </widget> + <packing> + <property name="resize">True</property> + <property name="shrink">True</property> + </packing> + </child> + <child> + <widget class="GtkScrolledWindow" id="versionScroll"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <child> + <widget class="GtkTreeView" id="versionList"> + <property name="visible">True</property> + <property name="headers_clickable">True</property> + <property name="search_column">0</property> + <signal name="cursor_changed" handler="cb_version_list_changed"/> + </widget> + </child> + </widget> + <packing> + <property name="resize">True</property> + <property name="shrink">True</property> + </packing> </child> </widget> <packing> @@ -478,90 +509,61 @@ <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <widget class="GtkTable" id="packageHeaderTable"> + <widget class="GtkLabel" id="nameLabel"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="column_spacing">4</property> - <property name="row_spacing">4</property> + <property name="label" translatable="yes">label</property> + </widget> + <packing> + <property name="expand">False</property> + </packing> + </child> + <child> + <widget class="GtkToolbar" id="packageTB"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="icon_size">GTK_ICON_SIZE_BUTTON</property> + <property name="icon_size_set">True</property> <child> - <widget class="GtkLabel" id="nameLabel"> + <widget class="GtkToolButton" id="pkgEmergeBtn"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">label</property> + <property name="tooltip" translatable="yes">Install onto system</property> + <property name="stock_id">gtk-add</property> + <signal name="clicked" handler="cb_package_emerge_clicked"/> </widget> <packing> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> + <property name="expand">False</property> </packing> </child> <child> - <widget class="GtkComboBox" id="versionCombo"> + <widget class="GtkToolButton" id="pkgUnmergeBtn"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="tooltip" translatable="yes">Uninstall from system</property> + <property name="stock_id">gtk-remove</property> + <signal name="clicked" handler="cb_package_unmerge_clicked"/> </widget> <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> + <property name="expand">False</property> </packing> </child> <child> - <widget class="GtkToolbar" id="packageTB"> + <widget class="GtkToolButton" id="pkgRevertBtn"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="icon_size">GTK_ICON_SIZE_BUTTON</property> - <property name="icon_size_set">True</property> - <child> - <widget class="GtkToolButton" id="pkgEmergeBtn"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip" translatable="yes">Install onto system</property> - <property name="stock_id">gtk-add</property> - <signal name="clicked" handler="cb_package_emerge_clicked"/> - </widget> - <packing> - <property name="expand">False</property> - </packing> - </child> - <child> - <widget class="GtkToolButton" id="pkgUnmergeBtn"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip" translatable="yes">Uninstall from system</property> - <property name="stock_id">gtk-remove</property> - <signal name="clicked" handler="cb_package_unmerge_clicked"/> - </widget> - <packing> - <property name="expand">False</property> - </packing> - </child> - <child> - <widget class="GtkToolButton" id="pkgRevertBtn"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip" translatable="yes">Revert changes</property> - <property name="stock_id">gtk-undo</property> - <signal name="clicked" handler="cb_package_revert_clicked"/> - </widget> - <packing> - <property name="expand">False</property> - </packing> - </child> + <property name="tooltip" translatable="yes">Revert changes</property> + <property name="stock_id">gtk-undo</property> + <signal name="clicked" handler="cb_package_revert_clicked"/> </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="expand">False</property> </packing> </child> </widget> <packing> <property name="expand">False</property> - <property name="padding">5</property> + <property name="position">1</property> </packing> </child> <child> @@ -1031,7 +1033,7 @@ </child> </widget> <packing> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> </widget> diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index d996526..e52439a 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -68,8 +68,8 @@ class PackageTable: self.notebook = self.tree.get_widget("packageNotebook") # the version combo - self.versionCombo = self.tree.get_widget("versionCombo") - self.build_version_combo() + self.versionList = self.tree.get_widget("versionList") + self.build_version_list() # chechboxes self.installedCheck = self.tree.get_widget("installedCheck") @@ -148,17 +148,17 @@ class PackageTable: self.instPackages = system.sort_package_list(system.find_installed_packages(cp, masked = True)) # version-combo-box - self.versionCombo.handler_block(self.versionCombo.changeHandler) # block change handler, because it would be called several times - self.versionCombo.get_model().clear() - self.fill_version_combo() - self.versionCombo.handler_unblock(self.versionCombo.changeHandler) # unblock handler again + #self.versionCombo.handler_block(self.versionCombo.changeHandler) # block change handler, because it would be called several times + self.versionList.get_model().clear() + self.fill_version_list() + #self.versionCombo.handler_unblock(self.versionCombo.changeHandler) # unblock handler again if not self.queue or not self.doEmerge: self.emergeBtn.set_sensitive(False) self.unmergeBtn.set_sensitive(False) # current status - self.cb_version_combo_changed() + self.cb_version_list_changed() self.vb.show_all() def hide (self): @@ -339,29 +339,31 @@ class PackageTable: self.useList.set_search_column(2) self.useList.set_enable_tree_lines(True) - def build_version_combo (self): + def build_version_list (self): store = gtk.ListStore(gtk.gdk.Pixbuf, str) # build view - self.versionCombo.set_model(store) - col = gtk.TreeViewColumn("Versions") + self.versionList.set_model(store) + col = gtk.TreeViewColumn(_("Versions")) # adding the pixbuf cell = gtk.CellRendererPixbuf() - self.versionCombo.pack_start(cell, False) - self.versionCombo.add_attribute(cell, "pixbuf", 0) + col.pack_start(cell, False) + col.add_attribute(cell, "pixbuf", 0) # adding the package name cell = gtk.CellRendererText() - self.versionCombo.pack_start(cell, True) - self.versionCombo.add_attribute(cell, "text", 1) + col.pack_start(cell, True) + col.add_attribute(cell, "text", 1) + + self.versionList.append_column(col) # connect - self.versionCombo.changeHandler = self.versionCombo.connect("changed", self.cb_version_combo_changed) + #self.versionCombo.changeHandler = self.versionCombo.connect("changed", self.cb_version_combo_changed) - def fill_version_combo (self): + def fill_version_list (self): - store = self.versionCombo.get_model() + store = self.versionList.get_model() # append versions for vers, inst in ((x.get_version(), x.is_installed()) for x in self.packages): @@ -370,6 +372,8 @@ class PackageTable: else: icon = None store.append([icon, vers]) + + sel = self.versionList.get_selection() # activate the first one try: @@ -380,18 +384,22 @@ class PackageTable: best_version = system.find_best_match(self.packages[0].get_cp(), only_installed = (self.instPackages != [])).get_version() for i in range(len(self.packages)): if self.packages[i].get_version() == best_version: - self.versionCombo.set_active(i) + sel.select_path((i,)) break except AttributeError: # no package found - self.versionCombo.set_active(0) + sel.select_path((0,)) def actual_package (self): """Returns the actual selected package. @returns: the actual selected package @rtype: backend.Package""" - - return self.packages[self.versionCombo.get_active()] + + model, iter = self.versionList.get_selection().get_selected() + if iter: + return self.packages[model.get_path(iter)[0]] + else: + return self.packages[0] def _update_keywords (self, emerge, update = False): if emerge: @@ -411,7 +419,7 @@ class PackageTable: error(_("Package could not be found: %s"), e[0]) #masked_dialog(e[0]) - def cb_version_combo_changed (self, *args): + def cb_version_list_changed (self, *args): pkg = self.actual_package() @@ -506,9 +514,9 @@ class PackageTable: self.actual_package().remove_new_use_flags() self.actual_package().remove_new_masked() self.actual_package().remove_new_testing() - self.versionCombo.get_model().clear() - self.fill_version_combo() - self.cb_version_combo_changed() + self.versionList.get_model().clear() + self.fill_version_list() + self.cb_version_list_changed() if self.instantChange: self._update_keywords(True, update = True) return True |