From c87ec9a27f2d70c7c6449ed1cadc58d003f6b0c0 Mon Sep 17 00:00:00 2001 From: necoro <> Date: Mon, 7 May 2007 07:30:41 +0000 Subject: added the ability of sorting the pkglist by installation status --- portato/gui/gtk/windows.py | 27 ++- portato/gui/gui_helper.py | 18 +- portato/gui/qt/windows.py | 9 +- portato/gui/templates/portato.glade | 419 ++++++++++++++++++--------------- portato/gui/templates/ui/MainWindow.ui | 16 +- 5 files changed, 283 insertions(+), 206 deletions(-) (limited to 'portato/gui') diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py index ffeb01f..2f06bc0 100644 --- a/portato/gui/gtk/windows.py +++ b/portato/gui/gtk/windows.py @@ -108,16 +108,20 @@ class AboutWindow (AbstractDialog): AbstractDialog.__init__(self, parent) - label = self.tree.get_widget("aboutLabel") - label.set_markup(""" + img = self.tree.get_widget("portatoImage") + img.set_from_file(APP_ICON) + + hlabel = self.tree.get_widget("highAboutLabel") + hlabel.set_markup(""" Portato v.%s -A Portage-GUI - -This software is licensed under the terms of the GPLv2. +A Portage-GUI""" % VERSION) + + llabel = self.tree.get_widget("lowAboutLabel") + llabel.set_markup("""This software is licensed under the terms of the GPLv2. Copyright (C) 2006-2007 René 'Necoro' Neumann <necoro@necoro.net> Icon created by wolfden -""" % VERSION) +""") view = self.tree.get_widget("pluginList") store = gtk.ListStore(str,str) @@ -776,6 +780,7 @@ class MainWindow (Window): vpaned.set_position(mHeight/2) # cat and pkg list + self.sortPkgListByName = True self.catList = self.tree.get_widget("catList") self.pkgList = self.tree.get_widget("pkgList") self.build_cat_list() @@ -876,6 +881,8 @@ class MainWindow (Window): self.pkgList.set_model(store) col = gtk.TreeViewColumn("Packages") + col.set_clickable(True) + col.connect("clicked", self.cb_pkg_list_header_clicked) # adding the pixbuf cell = gtk.CellRendererPixbuf() @@ -900,7 +907,7 @@ class MainWindow (Window): @rtype: gtk.ListStore""" if name: - for pkg, is_inst in self.db.get_cat(name): + for pkg, is_inst in self.db.get_cat(name, self.sortPkgListByName): if is_inst: icon = self.instPixbuf else: @@ -947,6 +954,12 @@ class MainWindow (Window): self.show_package(self.selCatName+"/"+package, self.queue) return True + def cb_pkg_list_header_clicked(self, col): + self.sortPkgListByName = not self.sortPkgListByName + self.pkgList.get_model().clear() + self.fill_pkg_store(self.pkgList.get_model(), self.selCatName) + return True + def cb_row_activated (self, view, path, *args): """Callback for an activated row in the emergeQueue. Opens a package window.""" store = self.queueTree diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py index 86fd6ed..df4e1d7 100644 --- a/portato/gui/gui_helper.py +++ b/portato/gui/gui_helper.py @@ -232,16 +232,30 @@ class Database: for key in self._db: # sort alphabetically self._db[key].sort(cmp=cmp, key=lambda x: str.lower(x[0])) - def get_cat (self, cat): + def get_cat (self, cat, byName = True): """Returns the packages in the category. @param cat: category to return the packages from @type cat: string + @param byName: selects whether to return the list sorted by name or by installation + @type byName: boolean @return: list of tuples: (name, is_installed) or [] @rtype: (string, boolean)[]""" try: - return self._db[cat] + if byName: + return self._db[cat] + else: + inst = [] + ninst = [] + for p, i in self._db[cat]: + if i: + inst.append((p,i)) + else: + ninst.append((p,i)) + + return inst+ninst + except KeyError: # cat is in category list - but not in portage debug("Catched KeyError =>", cat, "seems not to be an available category. Have you played with rsync-excludes?") return [] diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py index e131bdd..80e193f 100644 --- a/portato/gui/qt/windows.py +++ b/portato/gui/qt/windows.py @@ -611,6 +611,8 @@ class MainWindow (Window): Qt.QObject.connect(action, Qt.SIGNAL("triggered()"), m.call) # the two lists + self.sortPkgListByName = True + self.pkgList.addAction(self.pkgListSortAction) self.build_cat_list() Qt.QObject.connect(self.selCatListModel, Qt.SIGNAL("currentChanged(QModelIndex, QModelIndex)"), self.cb_cat_list_selected) Qt.QObject.connect(self.pkgList, Qt.SIGNAL("currentItemChanged(QListWidgetItem*, QListWidgetItem*)"), self.cb_pkg_list_selected) @@ -669,7 +671,7 @@ class MainWindow (Window): self.pkgList.clear() - for name, inst in self.db.get_cat(cat): + for name, inst in self.db.get_cat(cat, self.sortPkgListByName): if use_icons: if inst: icon = yes @@ -765,6 +767,11 @@ class MainWindow (Window): self.cfg.set_local(pkg, "oneshot_opt", set) self.queue.append(pkg, update = True, oneshot = set, forceUpdate = True) + @Qt.pyqtSignature("bool") + def on_pkgListSortAction_triggered (self, checked): + self.sortPkgListByName = checked + self.fill_pkg_list(self.selCatName) + @Qt.pyqtSignature("") @Window.watch_cursor def on_searchBtn_clicked (self): diff --git a/portato/gui/templates/portato.glade b/portato/gui/templates/portato.glade index 8037ca9..8433fa0 100644 --- a/portato/gui/templates/portato.glade +++ b/portato/gui/templates/portato.glade @@ -372,6 +372,7 @@ True + True 0 @@ -403,72 +404,48 @@ 4 2 - + True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC + 1 + True - + True + True + Installed + True + + + False + - - - 2 - 2 - 3 - 5 - 5 - - - - - True - + + True + True + Masked + True + + + + False + 1 + + + + + True + True + Testing + True + + + + False + 2 + - - - 1 - 2 - GTK_FILL - 5 - - - - - True - GTK_JUSTIFY_CENTER - True - - - 2 - GTK_FILL - - 10 - - - - - True - True - <span foreground='red'><b>MISSING KEYWORD</b></span> - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - True - <b>Installed, but not in portage anymore</b> - True 1 @@ -533,55 +510,79 @@ - + + True + True + <b>Installed, but not in portage anymore</b> + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + <span foreground='red'><b>MISSING KEYWORD</b></span> + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + GTK_JUSTIFY_CENTER + True + + + 2 + GTK_FILL + + 10 + + + + True - 1 - True - - - True - True - Installed - True - - - - False - - - - True - True - Masked - True - - - - False - 1 - + + + + 1 + 2 + GTK_FILL + 5 + + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC - + True - True - Testing - True - - - False - 2 - - 1 2 - 1 - 2 - GTK_FILL + 2 + 3 + 5 + 5 @@ -767,11 +768,39 @@ True - + True - True - GTK_JUSTIFY_CENTER - True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + True + GTK_JUSTIFY_CENTER + True + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-missing-image + + + 1 + + + + + True + True + GTK_JUSTIFY_CENTER + True + + + 2 + + False @@ -1147,186 +1176,186 @@ - - True - 0 - 5 - <u><i>Masking Keywords</i></u> - True - True - - - 7 - 8 - 5 - - - - + True - 0 - 5 - <u><i>Testing Keywords</i></u> - True - True - 4 - 5 - 5 + 1 + 2 + 3 + 4 - + True 0 - 5 - <u><i>Use-Flags</i></u> - True + File name to use, if package.use is a directory: True - 1 - 2 - 6 + 3 + 4 - + True - - - True - 0 - GTK_SHADOW_OUT - - - True - 0 - <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 - True - - - - - - label_item - - - - + Add only exact version to package.use + True 2 + 2 + 3 - + True - Add only exact version to package.mask/package.unmask + Add only exact version to package.keywords True 2 - 8 - 9 + 5 + 6 - + True 0 - File name to use, if package.mask/package.unmask is a directory: + File name to use, if package.keywords is a directory: True - 9 - 10 + 6 + 7 - + True 1 2 - 9 - 10 + 6 + 7 - + True 1 2 - 6 - 7 + 9 + 10 - + True 0 - File name to use, if package.keywords is a directory: + File name to use, if package.mask/package.unmask is a directory: True - 6 - 7 + 9 + 10 - + True - Add only exact version to package.keywords + Add only exact version to package.mask/package.unmask True 2 - 5 - 6 + 8 + 9 - + True - Add only exact version to package.use - True + + + True + 0 + GTK_SHADOW_OUT + + + True + 0 + <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 + True + + + + + + label_item + + + + 2 - 2 - 3 - + True 0 - File name to use, if package.use is a directory: + 5 + <u><i>Use-Flags</i></u> + True True - 3 - 4 + 1 + 2 + 6 - + + True + 0 + 5 + <u><i>Testing Keywords</i></u> + True + True + + + 4 + 5 + 5 + + + + True + 0 + 5 + <u><i>Masking Keywords</i></u> + True + True - 1 - 2 - 3 - 4 + 7 + 8 + 5 diff --git a/portato/gui/templates/ui/MainWindow.ui b/portato/gui/templates/ui/MainWindow.ui index 5b8d0d9..def2d67 100644 --- a/portato/gui/templates/ui/MainWindow.ui +++ b/portato/gui/templates/ui/MainWindow.ui @@ -71,6 +71,9 @@ + + Qt::ActionsContextMenu + QAbstractItemView::NoEditTriggers @@ -78,7 +81,7 @@ false - true + false @@ -507,6 +510,17 @@ p, li { white-space: pre-wrap; } &Oneshot + + + true + + + true + + + Sort by Name + + -- cgit v1.2.3-54-g00ecf