summaryrefslogtreecommitdiff
path: root/portato/gui/windows/main.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/gui/windows/main.py58
1 files changed, 33 insertions, 25 deletions
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