diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-09-03 20:11:03 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-09-03 20:11:03 +0100 |
commit | 4699cbceb008eded8c82384ce48a28089e9dbe43 (patch) | |
tree | 77e00e84f08a94b43b3165e783ba3b75bb1ae631 /src/frontend/gui | |
parent | d476149f4e04e72b90faa649e4cefac2883c4c3a (diff) |
sisyphus-gui : enable multithreading
Diffstat (limited to 'src/frontend/gui')
-rwxr-xr-x | src/frontend/gui/sisyphus-gui.py | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 36e8070..38c0c5f 100755 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -19,25 +19,30 @@ class Sisyphus(QtWidgets.QMainWindow): self.orphans.clicked.connect(self.remove_orphans) self.upgrade.clicked.connect(self.upgrade_system) self.abort.clicked.connect(self.exit_sisyphus) - + + self.install_thread = InstallThread() + self.uninstall_thread = UninstallThread() + self.orphans_thread = OrphansThread() + self.upgrade_thread = UpgradeThread() + def centerOnScreen(self): resolution = QtWidgets.QDesktopWidget().screenGeometry() self.move((resolution.width() / 2) - (self.frameSize().width() / 2), (resolution.height() / 2) - (self.frameSize().height() / 2)) def install_package(self): - PKGLIST = self.database.item(self.database.currentRow(), 1).text() - sisyphus_pkg_auto_install(PKGLIST.split()) + Sisyphus.PKGLIST = self.database.item(self.database.currentRow(), 1).text() + self.install_thread.start() def uninstall_package(self): - PKGLIST = self.database.item(self.database.currentRow(), 1).text() - sisyphus_pkg_auto_uninstall(PKGLIST.split()) + Sisyphus.PKGLIST = self.database.item(self.database.currentRow(), 1).text() + self.uninstall_thread.start() def remove_orphans(self): - sisyphus_pkg_auto_remove_orphans() + self.orphans_thread.start() def upgrade_system(self): - sisyphus_pkg_auto_system_upgrade() + self.upgrade_thread.start() def refresh_database(self): sisyphus_pkg_system_update() @@ -82,6 +87,32 @@ class Sisyphus(QtWidgets.QMainWindow): self.database.setItem(inx, 3, QtWidgets.QTableWidgetItem(row[3])) self.database.setItem(inx, 4, QtWidgets.QTableWidgetItem(row[4])) +class InstallThread(QtCore.QThread): + installFinished = QtCore.pyqtSignal() + def run(self): + PKGLIST = Sisyphus.PKGLIST + sisyphus_pkg_auto_install(PKGLIST.split()) + self.installFinished.emit() + +class UninstallThread(QtCore.QThread): + uninstallFinished = QtCore.pyqtSignal() + def run(self): + PKGLIST = Sisyphus.PKGLIST + sisyphus_pkg_auto_uninstall(PKGLIST.split()) + self.uninstallFinished.emit() + +class OrphansThread(QtCore.QThread): + orphansFinished = QtCore.pyqtSignal() + def run(self): + sisyphus_pkg_auto_remove_orphans() + self.orphansFinished.emit() + +class UpgradeThread(QtCore.QThread): + upgradeFinished = QtCore.pyqtSignal() + def run(self): + sisyphus_pkg_auto_system_upgrade() + self.upgradeFinished.emit() + if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) window = Sisyphus() |