From 38c8f2f4bddc9eadeb69a61cc6ac3d483831228c Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 9 Jul 2017 23:23:33 +0100 Subject: filtering works, finally --- src/frontend/gui/sisyphus-gui.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/frontend/gui') diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 1a7a64a..7fa14f7 100755 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -11,6 +11,8 @@ class Sisyphus(QtWidgets.QMainWindow): self.centerOnScreen() self.show() self.load_packages() + + self.input.returnPressed.connect(self.filter_database) self.install.clicked.connect(self.install_package) self.uninstall.clicked.connect(self.uninstall_package) @@ -42,6 +44,15 @@ class Sisyphus(QtWidgets.QMainWindow): def exit_sisyphus(self): self.close() + + def filter_database(self): + items = self.database.findItems(self.input.text(), QtCore.Qt.MatchExactly) + if items: + for item in items: + results = ''.join('%d' % (item.row() + 0)).split() + coordinates = map(int, results) + for coordinate in coordinates: + self.database.setCurrentCell(coordinate, 0) def load_packages(self): with sqlite3.connect('/var/lib/sisyphus/db/sisyphus.db') as db: -- cgit v1.2.3