From bd302b9c31dafd5bab1b09cc13212dd5ccc3e374 Mon Sep 17 00:00:00 2001 From: bionel Date: Wed, 20 Sep 2017 19:39:18 +0300 Subject: improve search, trigger model update after install/uninstall --- src/frontend/gui/sisyphus-gui.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index f8be306..2b4aa6b 100755 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -21,9 +21,10 @@ class Sisyphus(QtWidgets.QMainWindow): self.selectfield.addItems(self.SEARCHFIELDS.keys()) self.selectfield.setCurrentIndex(1) # defaults to package name self.selectfield.activated.connect(self.setSearchField) - + + Sisyphus.SEARCHTERM = "'%%'" # defaults to all Sisyphus.SEARCHFIELD = "pn" # defaults to package name - self.loadDatabase(Sisyphus.SEARCHFIELD,"'%%'") + self.loadDatabase(Sisyphus.SEARCHFIELD,Sisyphus.SEARCHTERM) self.input.textEdited.connect(self.filterDatabase) @@ -84,8 +85,8 @@ class Sisyphus(QtWidgets.QMainWindow): def filterDatabase(self): search = self.input.text() - searchTerm = "'%" + search + "%'" - self.loadDatabase(Sisyphus.SEARCHFIELD,searchTerm) + Sisyphus.SEARCHTERM = "'%" + search + "%'" + self.loadDatabase(Sisyphus.SEARCHFIELD,Sisyphus.SEARCHTERM) def packageInstall(self): indexes = self.database.selectionModel().selectedRows(1) @@ -100,6 +101,7 @@ class Sisyphus(QtWidgets.QMainWindow): def finishedInstall(self): self.hideProgressBar() + self.loadDatabase(Sisyphus.SEARCHFIELD,Sisyphus.SEARCHTERM) def packageUninstall(self): indexes = self.database.selectionModel().selectedRows(1) @@ -114,6 +116,7 @@ class Sisyphus(QtWidgets.QMainWindow): def finishedUninstall(self): self.hideProgressBar() + self.loadDatabase(Sisyphus.SEARCHFIELD,Sisyphus.SEARCHTERM) def systemUpgrade(self): self.showProgressBar() @@ -128,6 +131,7 @@ class Sisyphus(QtWidgets.QMainWindow): def finishedOrphans(self): self.hideProgressBar() + self.loadDatabase(Sisyphus.SEARCHFIELD,Sisyphus.SEARCHTERM) def showProgressBar(self): self.hideButtons() -- cgit v1.2.3