From 9a1341e32e82dd13e7b584e484b169817b4da2c6 Mon Sep 17 00:00:00 2001 From: bionel Date: Sat, 24 Mar 2018 23:06:03 +0200 Subject: add config gui --- src/frontend/gui/mirrors.conf.sample | 13 ++++ src/frontend/gui/sisyphus-config.py | 49 ++++++++++++ src/frontend/gui/ui/sisyphus-config.ui | 137 +++++++++++++++++++++++++++++++++ 3 files changed, 199 insertions(+) create mode 100644 src/frontend/gui/mirrors.conf.sample create mode 100755 src/frontend/gui/sisyphus-config.py create mode 100644 src/frontend/gui/ui/sisyphus-config.ui (limited to 'src/frontend/gui') diff --git a/src/frontend/gui/mirrors.conf.sample b/src/frontend/gui/mirrors.conf.sample new file mode 100644 index 0000000..6be0b29 --- /dev/null +++ b/src/frontend/gui/mirrors.conf.sample @@ -0,0 +1,13 @@ +####################################################### +# Support for multiple mirrors is somewhat incomplete # +# Uncomment only one mirror from the list bellow # +####################################################### + +# Princeton University (USA) mirror +# PORTAGE_BINHOST="http://mirror.math.princeton.edu/pub/redcorelinux/packages/" + +# Alpix.eu (Germany) mirror +PORTAGE_BINHOST="http://mirror.alpix.eu/redcorelinux/packages/" + +# Yandex.ru (Russia) mirror +# PORTAGE_BINHOST="http://mirror.yandex.ru/mirrors/redcorelinux/packages/" diff --git a/src/frontend/gui/sisyphus-config.py b/src/frontend/gui/sisyphus-config.py new file mode 100755 index 0000000..35afccc --- /dev/null +++ b/src/frontend/gui/sisyphus-config.py @@ -0,0 +1,49 @@ +#!/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.closeButton.clicked.connect(self.SisyphusConfigExit) + self.applyButton.clicked.connect(self.SisyphusConfigApply) + 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() + +if __name__ == '__main__': + app = QtWidgets.QApplication(sys.argv) + window = SisyphusConfig() + sys.exit(app.exec_()) diff --git a/src/frontend/gui/ui/sisyphus-config.ui b/src/frontend/gui/ui/sisyphus-config.ui new file mode 100644 index 0000000..0ec2a33 --- /dev/null +++ b/src/frontend/gui/ui/sisyphus-config.ui @@ -0,0 +1,137 @@ + + + MainWindow + + + + 0 + 0 + 640 + 480 + + + + + 640 + 480 + + + + + 640 + 480 + + + + Sisyphus settings + + + + .. + + + + + + + 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:'Sans'; font-size:10pt; 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;">Sisyphus is the package manager used in Redcore Linux.</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;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">In it's essence Sisyphus is a simple wrapper around portage, gentoolkit, and portage-utils</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">that provides an apt-get/yum-alike interface to these commands, to assist newcomer people transitioning from Debian/RedHat-based systems to Gentoo.</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;"><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;"><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-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;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Ghiunhan Mamut &lt;v3n3rix&gt;</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="mailto:venerix@redcorelinux.org"><span style=" text-decoration: underline; color:#0000ff;">venerix@redcorelinux.org</span></a></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;"><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-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;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Ionel Busuioc &lt;bionel&gt;</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;"><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;"><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-size:9pt;">Copyleft (ɔ) 2016 - 2018 Redcore Linux Project</span></p></body></html> + + + + + + + + + + + + Qt::Horizontal + + + + 338 + 20 + + + + + + + + Close + + + + .. + + + + + + + Apply + + + + .. + + + + + + + + + + + + -- cgit v1.2.3