diff options
author | bionel <ionel.busuioc@gmail.com> | 2017-10-05 19:39:19 +0300 |
---|---|---|
committer | bionel <ionel.busuioc@gmail.com> | 2017-10-05 19:39:19 +0300 |
commit | 94b5a75341a87a64327cda479f4b16dacf0db860 (patch) | |
tree | ac3967888152ba47fac332c5fd9e652940598b6e /src/frontend/gui/sisyphus-gui.py | |
parent | c06f8cfe0803b23e4851dd7e8beaf46af0c629a8 (diff) |
nail the virtual bastards
Diffstat (limited to 'src/frontend/gui/sisyphus-gui.py')
-rwxr-xr-x | src/frontend/gui/sisyphus-gui.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 61e0203..027c90c 100755 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -90,6 +90,7 @@ class Sisyphus(QtWidgets.QMainWindow): self.loadDatabase() def loadDatabase(self): + FILTEROUT = "AND cat NOT LIKE 'virtual'" self.SELECTS = OrderedDict ([ ('all','''SELECT i.category AS cat, @@ -101,7 +102,7 @@ class Sisyphus(QtWidgets.QMainWindow): ON i.category = a.category AND i.name = a.name AND i.slot = a.slot - WHERE %s LIKE %s + WHERE %s LIKE %s %s UNION SELECT a.category AS cat, @@ -113,8 +114,8 @@ class Sisyphus(QtWidgets.QMainWindow): ON a.category = i.category AND a.name = i.name AND a.slot = i.slot - WHERE %s LIKE %s - ''' % (Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM, Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM)), + WHERE %s LIKE %s %s + ''' % (Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM, FILTEROUT, Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM, FILTEROUT)), ('instaled','''SELECT i.category AS cat, i.name AS pn, @@ -126,8 +127,8 @@ class Sisyphus(QtWidgets.QMainWindow): ON i.category = a.category AND i.name = a.name AND i.slot = a.slot - WHERE %s LIKE %s - ''' % (Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM)), + WHERE %s LIKE %s %s + ''' % (Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM, FILTEROUT)), ('installable','''SELECT a.category AS cat, a.name AS pn, @@ -139,9 +140,9 @@ class Sisyphus(QtWidgets.QMainWindow): ON a.category = i.category AND a.name = i.name AND a.slot = i.slot - WHERE %s LIKE %s + WHERE %s LIKE %s %s AND iv IS NULL - ''' % (Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM)), + ''' % (Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM, FILTEROUT)), ('removable','''SELECT i.category AS cat, i.name AS pn, @@ -157,8 +158,8 @@ class Sisyphus(QtWidgets.QMainWindow): ON i.category = rm.category AND i.name = rm.name AND i.slot = rm.slot - WHERE %s LIKE %s - ''' % (Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM)), + WHERE %s LIKE %s %s + ''' % (Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM, FILTEROUT)), ('upgradable','''SELECT i.category AS cat, i.name AS pn, @@ -170,14 +171,13 @@ class Sisyphus(QtWidgets.QMainWindow): ON i.category = a.category AND i.name = a.name AND i.slot = a.slot - WHERE %s LIKE %s + WHERE %s LIKE %s %s AND a.timestamp > i.timestamp - ''' % (Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM)), + ''' % (Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM, FILTEROUT)), ]) with sqlite3.connect(sisyphus_database_path) as db: cursor=db.cursor() - FILTEROUT = "AND cat NOT LIKE 'virtual'" - cursor.execute('%s %s' % (self.SELECTS[Sisyphus.SEARCHFILTER], FILTEROUT)) + cursor.execute('%s' % (self.SELECTS[Sisyphus.SEARCHFILTER])) rows = cursor.fetchall() Sisyphus.PKGCOUNT = len(rows) Sisyphus.PKGSELECTED = 0 |