From 3a582f243a8294ed87f40a7f8e0453a4b0637fcc Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 26 Mar 2018 16:56:54 +0100 Subject: merge mirror settings window into main application --- src/frontend/gui/sisyphus-gui.py | 61 +++++-- src/frontend/gui/sisyphusconfig.py | 44 ----- src/frontend/gui/ui/mirrorcfg.ui | 129 +++++++++++++ src/frontend/gui/ui/sisyphus-config.ui | 129 ------------- src/frontend/gui/ui/sisyphus-gui.ui | 320 --------------------------------- src/frontend/gui/ui/sisyphus.ui | 320 +++++++++++++++++++++++++++++++++ 6 files changed, 499 insertions(+), 504 deletions(-) delete mode 100755 src/frontend/gui/sisyphusconfig.py create mode 100644 src/frontend/gui/ui/mirrorcfg.ui delete mode 100644 src/frontend/gui/ui/sisyphus-config.ui delete mode 100644 src/frontend/gui/ui/sisyphus-gui.ui create mode 100644 src/frontend/gui/ui/sisyphus.ui diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 9ef3550..0edc1be 100755 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -7,13 +7,12 @@ import atexit from collections import OrderedDict from PyQt5 import QtCore, QtGui, QtWidgets, uic from libsisyphus import * -from sisyphusconfig import SisyphusConfig - +# main window class Sisyphus(QtWidgets.QMainWindow): def __init__(self): super(Sisyphus, self).__init__() - uic.loadUi('ui/sisyphus-gui.ui', self) + uic.loadUi('ui/sisyphus.ui', self) self.centerOnScreen() self.show() @@ -45,7 +44,7 @@ class Sisyphus(QtWidgets.QMainWindow): self.inputBox.textEdited.connect(self.searchDatabase) - self.settingsButton.clicked.connect(self.sisyphusSettings) + self.settingsButton.clicked.connect(self.mirrorSettings) self.updateWorker = UpdateWorker() self.updateThread = QtCore.QThread() @@ -301,14 +300,54 @@ class Sisyphus(QtWidgets.QMainWindow): def updateStatusBar(self, workerMessage): self.statusBar().showMessage(workerMessage) - def sisyphusSettings(self): - self.window = SisyphusConfig() + def mirrorSettings(self): + self.window = MirrorCfg() self.window.show() def sisyphusExit(self): self.close() +# mirror config window +class MirrorCfg(QtWidgets.QMainWindow): + def __init__(self): + super(MirrorCfg, self).__init__() + uic.loadUi('ui/mirrorcfg.ui', self) + self.centerOnScreen() + self.MIRRORLIST = getMirrors() + self.updateMirrorList() + self.applyButton.pressed.connect(self.mirrorCfgApply) + self.applyButton.released.connect(self.mirrorCfgExit) + self.mirrorCombo.activated.connect(self.setMirrorList) + def centerOnScreen(self): + resolution = QtWidgets.QDesktopWidget().screenGeometry() + self.move((resolution.width() / 2) - (self.frameSize().width() / 2), + (resolution.height() / 2) - (self.frameSize().height() / 2)) + + def updateMirrorList(self): + model = QtGui.QStandardItemModel() + for row in self.MIRRORLIST: + indx = self.MIRRORLIST.index(row) + item = QtGui.QStandardItem() + item.setText(row['Url']) + model.setItem(indx, item) + if row['isActive'] : + self.ACTIVEMIRRORINDEX = indx + self.mirrorCombo.setModel(model) + self.mirrorCombo.setCurrentIndex(self.ACTIVEMIRRORINDEX) + + def setMirrorList(self): + self.MIRRORLIST[self.ACTIVEMIRRORINDEX]['isActive'] = False + self.ACTIVEMIRRORINDEX = self.mirrorCombo.currentIndex() + self.MIRRORLIST[self.ACTIVEMIRRORINDEX]['isActive'] = True + + def mirrorCfgApply(self): + setActiveMirror(self.MIRRORLIST) + + def mirrorCfgExit(self): + self.close() + +# update worker class UpdateWorker(QtCore.QObject): started = QtCore.pyqtSignal() finished = QtCore.pyqtSignal() @@ -319,7 +358,7 @@ class UpdateWorker(QtCore.QObject): sisyphus_pkg_system_update() self.finished.emit() - +# install worker class InstallWorker(QtCore.QObject): started = QtCore.pyqtSignal() finished = QtCore.pyqtSignal() @@ -340,7 +379,7 @@ class InstallWorker(QtCore.QObject): sync_sisyphus_local_packages_table_csv() self.finished.emit() - +# uninstall worker class UninstallWorker(QtCore.QObject): started = QtCore.pyqtSignal() finished = QtCore.pyqtSignal() @@ -361,7 +400,7 @@ class UninstallWorker(QtCore.QObject): sync_sisyphus_local_packages_table_csv() self.finished.emit() - +# upgrade worker class UpgradeWorker(QtCore.QObject): started = QtCore.pyqtSignal() finished = QtCore.pyqtSignal() @@ -381,7 +420,7 @@ class UpgradeWorker(QtCore.QObject): sync_sisyphus_local_packages_table_csv() self.finished.emit() - +# orphans worker class OrphansWorker(QtCore.QObject): started = QtCore.pyqtSignal() finished = QtCore.pyqtSignal() @@ -401,7 +440,7 @@ class OrphansWorker(QtCore.QObject): sync_sisyphus_local_packages_table_csv() self.finished.emit() - +# launch application if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) window = Sisyphus() diff --git a/src/frontend/gui/sisyphusconfig.py b/src/frontend/gui/sisyphusconfig.py deleted file mode 100755 index 35e50fe..0000000 --- a/src/frontend/gui/sisyphusconfig.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/python3 -import sys -from PyQt5 import QtCore, QtGui, QtWidgets, uic -from libsisyphus import getMirrors, setActiveMirror - -class SisyphusConfig(QtWidgets.QMainWindow): - def __init__(self): - super(SisyphusConfig, self).__init__() - uic.loadUi('ui/sisyphus-config.ui', self) - self.centerOnScreen() - self.MIRRORLIST = getMirrors() - self.updateMirrorList() - self.show() - self.applyButton.pressed.connect(self.SisyphusConfigApply) - self.applyButton.released.connect(self.SisyphusConfigExit) - self.mirrorCombo.activated.connect(self.setMirrorList) - - def centerOnScreen(self): - resolution = QtWidgets.QDesktopWidget().screenGeometry() - self.move((resolution.width() / 2) - (self.frameSize().width() / 2), - (resolution.height() / 2) - (self.frameSize().height() / 2)) - - def updateMirrorList(self): - model = QtGui.QStandardItemModel() - for row in self.MIRRORLIST: - indx = self.MIRRORLIST.index(row) - item = QtGui.QStandardItem() - item.setText(row['Url']) - model.setItem(indx, item) - if row['isActive'] : - self.ACTIVEMIRRORINDEX = indx - self.mirrorCombo.setModel(model) - self.mirrorCombo.setCurrentIndex(self.ACTIVEMIRRORINDEX) - - def setMirrorList(self): - self.MIRRORLIST[self.ACTIVEMIRRORINDEX]['isActive'] = False - self.ACTIVEMIRRORINDEX = self.mirrorCombo.currentIndex() - self.MIRRORLIST[self.ACTIVEMIRRORINDEX]['isActive'] = True - - def SisyphusConfigApply(self): - setActiveMirror(self.MIRRORLIST) - - def SisyphusConfigExit(self): - self.close() diff --git a/src/frontend/gui/ui/mirrorcfg.ui b/src/frontend/gui/ui/mirrorcfg.ui new file mode 100644 index 0000000..d196d88 --- /dev/null +++ b/src/frontend/gui/ui/mirrorcfg.ui @@ -0,0 +1,129 @@ + + + MainWindow + + + Qt::ApplicationModal + + + + 0 + 0 + 640 + 480 + + + + + 640 + 480 + + + + + 640 + 480 + + + + Configure mirrors + + + + ../icon/sisyphus.png../icon/sisyphus.png + + + + + + + Select active mirror + + + + + + + + + + + + + + + + About + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Noto Sans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Sisyphus is the package manager used in Redcore Linux.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">In it's essence Sisyphus is a simple wrapper around portage, gentoolkit, and portage-utils</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">which provides an apt-get/yum-alike interface to these commands, to assist newcomer people transitioning from Debian/RedHat-based systems to Gentoo.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt; font-weight:600;">Author:</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Ghiunhan Mamut &lt;V3n3RiX&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; text-decoration: underline;">venerix [at] redcorelinux [dot] org</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt; font-weight:600;">Contributors:</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Ionel Busuioc &lt;bionel&gt;</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> +<p align="right" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:9pt;">Copyleft (ɔ) 2016 - 2018 Redcore Linux Project</span></p></body></html> + + + + + + + + + + + + Qt::Horizontal + + + + 338 + 20 + + + + + + + + Apply + + + + .. + + + + + + + + + + + + diff --git a/src/frontend/gui/ui/sisyphus-config.ui b/src/frontend/gui/ui/sisyphus-config.ui deleted file mode 100644 index ecd7ea6..0000000 --- a/src/frontend/gui/ui/sisyphus-config.ui +++ /dev/null @@ -1,129 +0,0 @@ - - - MainWindow - - - Qt::ApplicationModal - - - - 0 - 0 - 640 - 480 - - - - - 640 - 480 - - - - - 640 - 480 - - - - Sisyphus settings - - - - ../icon/sisyphus.png../icon/sisyphus.png - - - - - - - Select Mirror - - - - - - - - - - - - - - - - About - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Noto Sans'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Sisyphus is the package manager used in Redcore Linux.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">In it's essence Sisyphus is a simple wrapper around portage, gentoolkit, and portage-utils</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">which provides an apt-get/yum-alike interface to these commands, to assist newcomer people transitioning from Debian/RedHat-based systems to Gentoo.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt; font-weight:600;">Author:</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Ghiunhan Mamut &lt;V3n3RiX&gt;</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; text-decoration: underline;">venerix [at] redcorelinux [dot] org</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt; font-weight:600;">Contributors:</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Ionel Busuioc &lt;bionel&gt;</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p> -<p align="right" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:9pt;">Copyleft (ɔ) 2016 - 2018 Redcore Linux Project</span></p></body></html> - - - - - - - - - - - - Qt::Horizontal - - - - 338 - 20 - - - - - - - - Apply - - - - .. - - - - - - - - - - - - diff --git a/src/frontend/gui/ui/sisyphus-gui.ui b/src/frontend/gui/ui/sisyphus-gui.ui deleted file mode 100644 index fdfb763..0000000 --- a/src/frontend/gui/ui/sisyphus-gui.ui +++ /dev/null @@ -1,320 +0,0 @@ - - - Sisyphus - - - Qt::NonModal - - - - 0 - 0 - 1000 - 600 - - - - - 0 - 0 - - - - - 1000 - 600 - - - - Sisyphus : Graphical User Interface - - - - ../icon/sisyphus.png../icon/sisyphus.png - - - - - 25 - - - 25 - - - 25 - - - 25 - - - 25 - - - - - 25 - - - 25 - - - 25 - - - - - - 25 - 25 - - - - <html><head/><body><p align="center">Configure Mirrors</p></body></html> - - - - ../icon/settings.png../icon/settings.png - - - - 16 - 16 - - - - - - - - - - - <html><head/><body><p align="center">Write package name and press Enter</p></body></html> - - - true - - - - - - - - - - - - - 16777215 - 25 - - - - 24 - - - - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - QAbstractScrollArea::AdjustToContents - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - QAbstractItemView::MultiSelection - - - QAbstractItemView::SelectRows - - - Qt::DashLine - - - true - - - 150 - - - 150 - - - true - - - false - - - false - - - - - - - 25 - - - 25 - - - 25 - - - - - - 16777215 - 25 - - - - <html><head/><body><p align="center">Install package</p></body></html> - - - - - - - ../icon/install.png../icon/install.png - - - - 16 - 16 - - - - - - - - - 16777215 - 25 - - - - <html><head/><body><p align="center">Uninstall package</p></body></html> - - - - - - - ../icon/uninstall.png../icon/uninstall.png - - - - 16 - 16 - - - - - - - - - 16777215 - 25 - - - - <html><head/><body><p align="center">Upgrade system</p></body></html> - - - - ../icon/upgrade.png../icon/upgrade.png - - - - 16 - 16 - - - - - - - - - 16777215 - 25 - - - - <html><head/><body><p align="center">Remove orphan packages</p></body></html> - - - - - - - ../icon/orphans.png../icon/orphans.png - - - - 16 - 16 - - - - - - - - - 16777215 - 25 - - - - <html><head/><body><p align="center">Exit Sisyphus</p></body></html> - - - - ../icon/exit.png../icon/exit.png - - - - 16 - 16 - - - - - - - - - - - settingsButton - applicationFilter - inputBox - databaseFilter - databaseTable - installButton - uninstallButton - upgradeButton - orphansButton - exitButton - - - - diff --git a/src/frontend/gui/ui/sisyphus.ui b/src/frontend/gui/ui/sisyphus.ui new file mode 100644 index 0000000..fdfb763 --- /dev/null +++ b/src/frontend/gui/ui/sisyphus.ui @@ -0,0 +1,320 @@ + + + Sisyphus + + + Qt::NonModal + + + + 0 + 0 + 1000 + 600 + + + + + 0 + 0 + + + + + 1000 + 600 + + + + Sisyphus : Graphical User Interface + + + + ../icon/sisyphus.png../icon/sisyphus.png + + + + + 25 + + + 25 + + + 25 + + + 25 + + + 25 + + + + + 25 + + + 25 + + + 25 + + + + + + 25 + 25 + + + + <html><head/><body><p align="center">Configure Mirrors</p></body></html> + + + + ../icon/settings.png../icon/settings.png + + + + 16 + 16 + + + + + + + + + + + <html><head/><body><p align="center">Write package name and press Enter</p></body></html> + + + true + + + + + + + + + + + + + 16777215 + 25 + + + + 24 + + + + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + QAbstractScrollArea::AdjustToContents + + + QAbstractItemView::NoEditTriggers + + + false + + + true + + + QAbstractItemView::MultiSelection + + + QAbstractItemView::SelectRows + + + Qt::DashLine + + + true + + + 150 + + + 150 + + + true + + + false + + + false + + + + + + + 25 + + + 25 + + + 25 + + + + + + 16777215 + 25 + + + + <html><head/><body><p align="center">Install package</p></body></html> + + + + + + + ../icon/install.png../icon/install.png + + + + 16 + 16 + + + + + + + + + 16777215 + 25 + + + + <html><head/><body><p align="center">Uninstall package</p></body></html> + + + + + + + ../icon/uninstall.png../icon/uninstall.png + + + + 16 + 16 + + + + + + + + + 16777215 + 25 + + + + <html><head/><body><p align="center">Upgrade system</p></body></html> + + + + ../icon/upgrade.png../icon/upgrade.png + + + + 16 + 16 + + + + + + + + + 16777215 + 25 + + + + <html><head/><body><p align="center">Remove orphan packages</p></body></html> + + + + + + + ../icon/orphans.png../icon/orphans.png + + + + 16 + 16 + + + + + + + + + 16777215 + 25 + + + + <html><head/><body><p align="center">Exit Sisyphus</p></body></html> + + + + ../icon/exit.png../icon/exit.png + + + + 16 + 16 + + + + + + + + + + + settingsButton + applicationFilter + inputBox + databaseFilter + databaseTable + installButton + uninstallButton + upgradeButton + orphansButton + exitButton + + + + -- cgit v1.2.3