summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/frontend/gui/sisyphus-gui.py61
-rwxr-xr-xsrc/frontend/gui/sisyphusconfig.py44
-rw-r--r--src/frontend/gui/ui/mirrorcfg.ui (renamed from src/frontend/gui/ui/sisyphus-config.ui)4
-rw-r--r--src/frontend/gui/ui/sisyphus.ui (renamed from src/frontend/gui/ui/sisyphus-gui.ui)0
4 files changed, 52 insertions, 57 deletions
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/sisyphus-config.ui b/src/frontend/gui/ui/mirrorcfg.ui
index ecd7ea6..d196d88 100644
--- a/src/frontend/gui/ui/sisyphus-config.ui
+++ b/src/frontend/gui/ui/mirrorcfg.ui
@@ -26,7 +26,7 @@
</size>
</property>
<property name="windowTitle">
- <string>Sisyphus settings</string>
+ <string>Configure mirrors</string>
</property>
<property name="windowIcon">
<iconset>
@@ -37,7 +37,7 @@
<item>
<widget class="QGroupBox" name="mirrorGroupBox">
<property name="title">
- <string>Select Mirror</string>
+ <string>Select active mirror</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
diff --git a/src/frontend/gui/ui/sisyphus-gui.ui b/src/frontend/gui/ui/sisyphus.ui
index fdfb763..fdfb763 100644
--- a/src/frontend/gui/ui/sisyphus-gui.ui
+++ b/src/frontend/gui/ui/sisyphus.ui