diff options
author | bionel <ionel.busuioc@gmail.com> | 2017-09-24 22:04:36 +0300 |
---|---|---|
committer | bionel <ionel.busuioc@gmail.com> | 2017-09-24 22:04:36 +0300 |
commit | fb5e09c06ca609788bcf2ab34eabf6d762d2817d (patch) | |
tree | 80cbb9a5a9b6da3319fac33c5409bbadc7f1a5de /src/frontend | |
parent | 67c89253f7e7b3d2351121ba4a95d5ddda84f3da (diff) |
implement removable filter
Diffstat (limited to 'src/frontend')
-rwxr-xr-x | src/frontend/gui/sisyphus-gui.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 1de49c8..05212af 100755 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -27,7 +27,8 @@ class Sisyphus(QtWidgets.QMainWindow): ('All', ''), ('Available', 'AND iv IS NULL'), ('Installed', 'AND iv IS NOT NULL'), - ('Upgradable', 'AND iv <> av') + ('Upgradable', 'AND iv <> av'), + ('Removable', 'AND rmv = "yes"') ]) Sisyphus.SEARCHFILTER = self.SEARCHFILTERS['All'] @@ -72,6 +73,9 @@ class Sisyphus(QtWidgets.QMainWindow): self.abort.clicked.connect(self.sisyphusExit) + #hide removable column + self.database.horizontalHeader().hideSection(5) + def centerOnScreen(self): resolution = QtWidgets.QDesktopWidget().screenGeometry() self.move((resolution.width() / 2) - (self.frameSize().width() / 2), @@ -101,22 +105,27 @@ class Sisyphus(QtWidgets.QMainWindow): a.name AS pn, a.version AS av, i.version AS iv, - a.description AS descr + a.description AS descr, + CASE WHEN rm.name ISNULL THEN 'no' ELSE 'yes' END AS rmv FROM remote_packages AS a LEFT JOIN local_packages AS i ON a.category = i.category AND a.name = i.name AND a.slot = i.slot + LEFT JOIN removeable_packages as rm + ON i.category = rm.category + AND i.name = rm.name + AND i.slot = rm.slot WHERE %s LIKE %s %s %s ''' % (Sisyphus.SEARCHFIELD, Sisyphus.SEARCHTERM, Sisyphus.SEARCHFILTER, FILTEROUT)) rows = cursor.fetchall() Sisyphus.PKGCOUNT = len(rows) Sisyphus.PKGSELECTED = 0 model = QtGui.QStandardItemModel(len(rows), 5) - model.setHorizontalHeaderLabels(['Category', 'Name', 'Available Version', 'Installed Version', 'Description']) + model.setHorizontalHeaderLabels(['Category', 'Name', 'Available Version', 'Installed Version', 'Description', 'Rmv']) for row in rows: indx = rows.index(row) - for column in range(0, 5): + for column in range(0, 6): item = QtGui.QStandardItem("%s"%(row[column])) model.setItem(indx, column, item) self.database.setModel(model) |