From 6dafbb4d8889eceba43f2de9dfdbba29c137b594 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 3 Sep 2017 21:22:53 +0100 Subject: sisyphus-gui : with multithreading enabled, we can do really cool stuff...a progress bar in this case --- src/frontend/gui/sisyphus-gui.py | 61 +++++- src/frontend/gui/ui/sisyphus-gui.ui | 385 +++++++++++++++++++++--------------- 2 files changed, 282 insertions(+), 164 deletions(-) (limited to 'src') diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 38c0c5f..6b49d58 100755 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -13,17 +13,26 @@ class Sisyphus(QtWidgets.QMainWindow): self.load_packages() self.input.returnPressed.connect(self.filter_database) - + self.install.clicked.connect(self.install_package) self.uninstall.clicked.connect(self.uninstall_package) self.orphans.clicked.connect(self.remove_orphans) self.upgrade.clicked.connect(self.upgrade_system) self.abort.clicked.connect(self.exit_sisyphus) + self.progress.hide() + self.install_thread = InstallThread() + self.install_thread.installFinished.connect(self.install_finished) + self.uninstall_thread = UninstallThread() + self.uninstall_thread.uninstallFinished.connect(self.uninstall_finished) + self.orphans_thread = OrphansThread() + self.orphans_thread.orphansFinished.connect(self.orphans_finished) + self.upgrade_thread = UpgradeThread() + self.upgrade_thread.upgradeFinished.connect(self.upgrade_finished) def centerOnScreen(self): resolution = QtWidgets.QDesktopWidget().screenGeometry() @@ -31,19 +40,69 @@ class Sisyphus(QtWidgets.QMainWindow): (resolution.height() / 2) - (self.frameSize().height() / 2)) def install_package(self): + self.hide_buttons() + self.progress.setRange(0,0) + self.progress.show() Sisyphus.PKGLIST = self.database.item(self.database.currentRow(), 1).text() self.install_thread.start() + def install_finished(self): + self.progress.setRange(0,1) + self.progress.setValue(1) + self.progress.hide() + self.show_buttons() + def uninstall_package(self): + self.hide_buttons() + self.progress.setRange(0,0) + self.progress.show() Sisyphus.PKGLIST = self.database.item(self.database.currentRow(), 1).text() self.uninstall_thread.start() + def uninstall_finished(self): + self.progress.setRange(0,1) + self.progress.setValue(1) + self.progress.hide() + self.show_buttons() + def remove_orphans(self): + self.hide_buttons() + self.progress.setRange(0,0) + self.progress.show() self.orphans_thread.start() + def orphans_finished(self): + self.progress.setRange(0,1) + self.progress.setValue(1) + self.progress.hide() + self.show_buttons() + def upgrade_system(self): + self.hide_buttons() + self.progress.setRange(0,0) + self.progress.show() self.upgrade_thread.start() + def upgrade_finished(self): + self.progress.setRange(0,1) + self.progress.setValue(1) + self.progress.hide() + self.show_buttons() + + def hide_buttons(self): + self.install.hide() + self.uninstall.hide() + self.orphans.hide() + self.upgrade.hide() + self.abort.hide() + + def show_buttons(self): + self.install.show() + self.uninstall.show() + self.orphans.show() + self.upgrade.show() + self.abort.show() + def refresh_database(self): sisyphus_pkg_system_update() diff --git a/src/frontend/gui/ui/sisyphus-gui.ui b/src/frontend/gui/ui/sisyphus-gui.ui index 86bebd9..2269e01 100644 --- a/src/frontend/gui/ui/sisyphus-gui.ui +++ b/src/frontend/gui/ui/sisyphus-gui.ui @@ -37,17 +37,14 @@ 25 25 - 952 - 239 + 906 + 296 - + 25 - - 25 - 25 @@ -57,172 +54,234 @@ 25 - - - - <html><head/><body><p align="center">Write package name and press Enter</p></body></html> - - - true - - - - - - - QFrame::Panel + + + + 0 - - QFrame::Raised + + 25 - - QAbstractScrollArea::AdjustToContents + + 0 - - QAbstractItemView::NoEditTriggers + + 0 - - false + + 25 - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - true - - - 125 - - - true - - - false - - - false - - - - Category - - - - - Name - - - - - Available Version - - - - - Installed Version - - - - - Description - - - + + + + + 16777215 + 25 + + + + <html><head/><body><p align="center">Remove orphan packages</p></body></html> + + + + + + + ../icon/orphans.png../icon/orphans.png + + + + 32 + 32 + + + + + + + + + 16777215 + 25 + + + + <html><head/><body><p align="center">Upgrade system</p></body></html> + + + + ../icon/upgrade.png../icon/upgrade.png + + + + 32 + 32 + + + + + + + + <html><head/><body><p align="center">Write package name and press Enter</p></body></html> + + + true + + + + + + + + 16777215 + 25 + + + + <html><head/><body><p align="center">Uninstall package</p></body></html> + + + + + + + ../icon/uninstall.png../icon/uninstall.png + + + + 32 + 32 + + + + + + + + QFrame::Panel + + + QFrame::Raised + + + QAbstractScrollArea::AdjustToContents + + + QAbstractItemView::NoEditTriggers + + + false + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + true + + + 125 + + + true + + + false + + + false + + + + Category + + + + + Name + + + + + Available Version + + + + + Installed Version + + + + + Description + + + + + + + + + 16777215 + 25 + + + + <html><head/><body><p align="center">Exit Sisyphus</p></body></html> + + + + ../icon/exit.png../icon/exit.png + + + + 32 + 32 + + + + + + + + + 16777215 + 25 + + + + <html><head/><body><p align="center">Install package</p></body></html> + + + + + + + ../icon/install.png../icon/install.png + + + + 32 + 32 + + + + + - - - - <html><head/><body><p align="center">Install package</p></body></html> - - - - - - - ../icon/install.png../icon/install.png - - - - 32 - 32 - - - - - - - - <html><head/><body><p align="center">Uninstall package</p></body></html> - - - - - - - ../icon/uninstall.png../icon/uninstall.png - - + + + - 32 - 32 + 16777215 + 25 - - - - - - <html><head/><body><p align="center">Remove orphan packages</p></body></html> - - - - - - - ../icon/orphans.png../icon/orphans.png - - - - 32 - 32 - - - - - - - - <html><head/><body><p align="center">Upgrade system</p></body></html> - - - - ../icon/upgrade.png../icon/upgrade.png - - - - 32 - 32 - - - - - - - - <html><head/><body><p align="center">Exit Sisyphus</p></body></html> - - - - ../icon/exit.png../icon/exit.png - - - - 32 - 32 - + + 24 -- cgit v1.2.3