diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-09-03 21:22:53 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-09-03 21:22:53 +0100 |
commit | 6dafbb4d8889eceba43f2de9dfdbba29c137b594 (patch) | |
tree | 0e23794023d6e023216a62200deebe824505f0dc /src/frontend | |
parent | 4699cbceb008eded8c82384ce48a28089e9dbe43 (diff) |
sisyphus-gui : with multithreading enabled, we can do really cool stuff...a progress bar in this case
Diffstat (limited to 'src/frontend')
-rwxr-xr-x | src/frontend/gui/sisyphus-gui.py | 61 | ||||
-rw-r--r-- | src/frontend/gui/ui/sisyphus-gui.ui | 385 |
2 files changed, 282 insertions, 164 deletions
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 @@ <rect> <x>25</x> <y>25</y> - <width>952</width> - <height>239</height> + <width>906</width> + <height>296</height> </rect> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QGridLayout" name="externalgrid"> <property name="leftMargin"> <number>25</number> </property> - <property name="topMargin"> - <number>25</number> - </property> <property name="rightMargin"> <number>25</number> </property> @@ -57,172 +54,234 @@ <property name="spacing"> <number>25</number> </property> - <item row="0" column="1" colspan="3"> - <widget class="QLineEdit" name="input"> - <property name="toolTip"> - <string><html><head/><body><p align="center">Write package name and press Enter</p></body></html></string> - </property> - <property name="clearButtonEnabled"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="0" colspan="5"> - <widget class="QTableWidget" name="database"> - <property name="frameShape"> - <enum>QFrame::Panel</enum> + <item row="0" column="0"> + <layout class="QGridLayout" name="internalgrid"> + <property name="leftMargin"> + <number>0</number> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> + <property name="topMargin"> + <number>25</number> </property> - <property name="sizeAdjustPolicy"> - <enum>QAbstractScrollArea::AdjustToContents</enum> + <property name="rightMargin"> + <number>0</number> </property> - <property name="editTriggers"> - <set>QAbstractItemView::NoEditTriggers</set> + <property name="bottomMargin"> + <number>0</number> </property> - <property name="dragDropOverwriteMode"> - <bool>false</bool> + <property name="spacing"> + <number>25</number> </property> - <property name="selectionMode"> - <enum>QAbstractItemView::SingleSelection</enum> - </property> - <property name="selectionBehavior"> - <enum>QAbstractItemView::SelectRows</enum> - </property> - <attribute name="horizontalHeaderCascadingSectionResizes"> - <bool>true</bool> - </attribute> - <attribute name="horizontalHeaderDefaultSectionSize"> - <number>125</number> - </attribute> - <attribute name="horizontalHeaderStretchLastSection"> - <bool>true</bool> - </attribute> - <attribute name="verticalHeaderVisible"> - <bool>false</bool> - </attribute> - <attribute name="verticalHeaderHighlightSections"> - <bool>false</bool> - </attribute> - <column> - <property name="text"> - <string>Category</string> - </property> - </column> - <column> - <property name="text"> - <string>Name</string> - </property> - </column> - <column> - <property name="text"> - <string>Available Version</string> - </property> - </column> - <column> - <property name="text"> - <string>Installed Version</string> - </property> - </column> - <column> - <property name="text"> - <string>Description</string> - </property> - </column> - </widget> + <item row="2" column="2"> + <widget class="QPushButton" name="orphans"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>25</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p align="center">Remove orphan packages</p></body></html></string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset> + <normaloff>../icon/orphans.png</normaloff>../icon/orphans.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QPushButton" name="upgrade"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>25</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p align="center">Upgrade system</p></body></html></string> + </property> + <property name="icon"> + <iconset> + <normaloff>../icon/upgrade.png</normaloff>../icon/upgrade.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + </item> + <item row="0" column="1" colspan="3"> + <widget class="QLineEdit" name="input"> + <property name="toolTip"> + <string><html><head/><body><p align="center">Write package name and press Enter</p></body></html></string> + </property> + <property name="clearButtonEnabled"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="uninstall"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>25</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p align="center">Uninstall package</p></body></html></string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset> + <normaloff>../icon/uninstall.png</normaloff>../icon/uninstall.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + </item> + <item row="1" column="0" colspan="5"> + <widget class="QTableWidget" name="database"> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QAbstractScrollArea::AdjustToContents</enum> + </property> + <property name="editTriggers"> + <set>QAbstractItemView::NoEditTriggers</set> + </property> + <property name="dragDropOverwriteMode"> + <bool>false</bool> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::SingleSelection</enum> + </property> + <property name="selectionBehavior"> + <enum>QAbstractItemView::SelectRows</enum> + </property> + <attribute name="horizontalHeaderCascadingSectionResizes"> + <bool>true</bool> + </attribute> + <attribute name="horizontalHeaderDefaultSectionSize"> + <number>125</number> + </attribute> + <attribute name="horizontalHeaderStretchLastSection"> + <bool>true</bool> + </attribute> + <attribute name="verticalHeaderVisible"> + <bool>false</bool> + </attribute> + <attribute name="verticalHeaderHighlightSections"> + <bool>false</bool> + </attribute> + <column> + <property name="text"> + <string>Category</string> + </property> + </column> + <column> + <property name="text"> + <string>Name</string> + </property> + </column> + <column> + <property name="text"> + <string>Available Version</string> + </property> + </column> + <column> + <property name="text"> + <string>Installed Version</string> + </property> + </column> + <column> + <property name="text"> + <string>Description</string> + </property> + </column> + </widget> + </item> + <item row="2" column="4"> + <widget class="QPushButton" name="abort"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>25</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p align="center">Exit Sisyphus</p></body></html></string> + </property> + <property name="icon"> + <iconset> + <normaloff>../icon/exit.png</normaloff>../icon/exit.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QPushButton" name="install"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>25</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p align="center">Install package</p></body></html></string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset> + <normaloff>../icon/install.png</normaloff>../icon/install.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + </item> + </layout> </item> - <item row="2" column="0"> - <widget class="QPushButton" name="install"> - <property name="toolTip"> - <string><html><head/><body><p align="center">Install package</p></body></html></string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset> - <normaloff>../icon/install.png</normaloff>../icon/install.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QPushButton" name="uninstall"> - <property name="toolTip"> - <string><html><head/><body><p align="center">Uninstall package</p></body></html></string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset> - <normaloff>../icon/uninstall.png</normaloff>../icon/uninstall.png</iconset> - </property> - <property name="iconSize"> + <item row="1" column="0"> + <widget class="QProgressBar" name="progress"> + <property name="maximumSize"> <size> - <width>32</width> - <height>32</height> + <width>16777215</width> + <height>25</height> </size> </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QPushButton" name="orphans"> - <property name="toolTip"> - <string><html><head/><body><p align="center">Remove orphan packages</p></body></html></string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset> - <normaloff>../icon/orphans.png</normaloff>../icon/orphans.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QPushButton" name="upgrade"> - <property name="toolTip"> - <string><html><head/><body><p align="center">Upgrade system</p></body></html></string> - </property> - <property name="icon"> - <iconset> - <normaloff>../icon/upgrade.png</normaloff>../icon/upgrade.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - </widget> - </item> - <item row="2" column="4"> - <widget class="QPushButton" name="abort"> - <property name="toolTip"> - <string><html><head/><body><p align="center">Exit Sisyphus</p></body></html></string> - </property> - <property name="icon"> - <iconset> - <normaloff>../icon/exit.png</normaloff>../icon/exit.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> + <property name="value"> + <number>24</number> </property> </widget> </item> |