summaryrefslogtreecommitdiff
path: root/portato/gui/gui_helper.py
diff options
context:
space:
mode:
authornecoro <>2007-05-07 07:30:41 +0000
committernecoro <>2007-05-07 07:30:41 +0000
commitc87ec9a27f2d70c7c6449ed1cadc58d003f6b0c0 (patch)
treed7156245c25f678535ae19018104fdda01f6c8c6 /portato/gui/gui_helper.py
parentce3139188ed3f4564d37a1ffb02bb20daff6adb1 (diff)
downloadportato-c87ec9a27f2d70c7c6449ed1cadc58d003f6b0c0.tar.gz
portato-c87ec9a27f2d70c7c6449ed1cadc58d003f6b0c0.tar.bz2
portato-c87ec9a27f2d70c7c6449ed1cadc58d003f6b0c0.zip
added the ability of sorting the pkglist by installation status
Diffstat (limited to 'portato/gui/gui_helper.py')
-rw-r--r--portato/gui/gui_helper.py18
1 files changed, 16 insertions, 2 deletions
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 []