diff options
author | Necoro <> | 2008-02-23 00:31:53 +0000 |
---|---|---|
committer | Necoro <> | 2008-02-23 00:31:53 +0000 |
commit | c8d34d5474bfef3f1a621aad63311dcc971cef99 (patch) | |
tree | cf5b6bcbb14117c4beef76cac49623984169d9cf | |
parent | c47a04e95db9fae95b482aa9aa96bb7a9263c303 (diff) | |
download | portato-c8d34d5474bfef3f1a621aad63311dcc971cef99.tar.gz portato-c8d34d5474bfef3f1a621aad63311dcc971cef99.tar.bz2 portato-c8d34d5474bfef3f1a621aad63311dcc971cef99.zip |
r785@Devoty: necoro | 2008-02-23 01:31:44 +0100
improved new search
Diffstat (limited to '')
-rw-r--r-- | portato/gui/gui_helper.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py index d48dadd..57b9e43 100644 --- a/portato/gui/gui_helper.py +++ b/portato/gui/gui_helper.py @@ -13,6 +13,7 @@ from __future__ import absolute_import # some stuff needed +import re import logging import sys, os, pty import signal, threading, time @@ -194,7 +195,7 @@ class Database (object): yield pkg if self.restrict: - return (pkg for pkg in get_pkgs() if pkg[1].find(self.restrict) != -1) + return (pkg for pkg in get_pkgs() if self.restrict.search(pkg[1]))#if pkg[1].find(self.restrict) != -1) else: return get_pkgs() @@ -217,12 +218,13 @@ class Database (object): cats = self._db.iterkeys() else: - cats = set((pkg[0] for pkg in self.get_cat(self.ALL))) - if installed: - cats = cats.intersection(self.inst_cats) + cats = set((pkg[0] for pkg in self.get_cat(self.ALL) if pkg[2])) + else: + cats = set((pkg[0] for pkg in self.get_cat(self.ALL))) - cats.add(self.ALL) + if len(cats)>1: + cats.add(self.ALL) return (cat for cat in cats) @@ -251,8 +253,12 @@ class Database (object): if not restrict: self._restrict = None else: - #self._restrict = re.compile(".*%s.*" % restrict) - self._restrict = restrict + try: + regex = re.compile(restrict, re.I) + except re.error, e: + info(_("Error while compiling search expression: '%s'."), str(e)) + else: # only set self._restrict if no error occurred + self._restrict = regex restrict = property(get_restrict, set_restrict) |