From 88c12349dd5f71af16a6398dda4684f15691ab5b Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 21 Sep 2017 18:55:19 +0100 Subject: sisyphus-gui : start application faster, by running the update in it's own thread --- src/frontend/gui/sisyphus-gui.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 16a7323..54b52ed 100755 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -8,8 +8,8 @@ class Sisyphus(QtWidgets.QMainWindow): def __init__(self): super(Sisyphus, self).__init__() uic.loadUi('ui/sisyphus-gui.ui', self) - self.updateSystem() self.centerOnScreen() + self.updateSystem() self.show() self.progress.hide() @@ -35,7 +35,7 @@ class Sisyphus(QtWidgets.QMainWindow): Sisyphus.SEARCHTERM = "'%%'" Sisyphus.SEARCHFIELD = self.SEARCHFIELDS['Name'] - Sisyphus.SEARCHFILTER = self.SEARCHFILTERS['All'] + Sisyphus.SEARCHFILTER = self.SEARCHFILTERS['All'] self.loadDatabase(Sisyphus.SEARCHFIELD,Sisyphus.SEARCHTERM,Sisyphus.SEARCHFILTER) self.input.textEdited.connect(self.filterDatabase) @@ -66,9 +66,6 @@ class Sisyphus(QtWidgets.QMainWindow): Sisyphus.SEARCHFILTER = self.SEARCHFILTERS[self.selectfilter.currentText()] self.loadDatabase(Sisyphus.SEARCHFIELD,Sisyphus.SEARCHTERM,Sisyphus.SEARCHFILTER) - def updateSystem(self): - sisyphus_pkg_system_update() - def centerOnScreen(self): resolution = QtWidgets.QDesktopWidget().screenGeometry() self.move((resolution.width() / 2) - (self.frameSize().width() / 2), @@ -104,7 +101,11 @@ class Sisyphus(QtWidgets.QMainWindow): search = self.input.text() Sisyphus.SEARCHTERM = "'%" + search + "%'" self.loadDatabase(Sisyphus.SEARCHFIELD,Sisyphus.SEARCHTERM,Sisyphus.SEARCHFILTER) - + + def updateSystem(self): + self.updateThread = UpdateThread() + self.updateThread.start() + def packageInstall(self): indexes = self.database.selectionModel().selectedRows(1) if len(indexes) == 0: @@ -179,6 +180,11 @@ class Sisyphus(QtWidgets.QMainWindow): def sisyphusExit(self): self.close() +class UpdateThread(QtCore.QThread): + updateFinished = QtCore.pyqtSignal() + def run(self): + sisyphus_pkg_system_update() + class InstallThread(QtCore.QThread): installFinished = QtCore.pyqtSignal() def run(self): -- cgit v1.2.3