diff options
author | bionel <ionel.busuioc@gmail.com> | 2018-03-24 23:06:03 +0200 |
---|---|---|
committer | bionel <ionel.busuioc@gmail.com> | 2018-03-24 23:06:03 +0200 |
commit | 9a1341e32e82dd13e7b584e484b169817b4da2c6 (patch) | |
tree | f1acad77cfd35e275fee849b8a1da94f097ea2c4 | |
parent | 3a9714df4681b5cf022a8c469d0e79fbe9bc677c (diff) |
add config gui
-rw-r--r-- | src/frontend/gui/mirrors.conf.sample | 13 | ||||
-rwxr-xr-x | src/frontend/gui/sisyphus-config.py | 49 | ||||
-rw-r--r-- | src/frontend/gui/ui/sisyphus-config.ui | 137 |
3 files changed, 199 insertions, 0 deletions
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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>640</width> + <height>480</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>640</width> + <height>480</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>640</width> + <height>480</height> + </size> + </property> + <property name="windowTitle"> + <string>Sisyphus settings</string> + </property> + <property name="windowIcon"> + <iconset theme="applications-utilities"> + <normaloff>.</normaloff>.</iconset> + </property> + <widget class="QWidget" name="centralWidget"> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QGroupBox" name="mirrorGroupBox"> + <property name="title"> + <string>Select Mirror</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QComboBox" name="mirrorCombo"> + <property name="currentText"> + <string notr="true"/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="aboutGroupBox"> + <property name="title"> + <string>About</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QTextBrowser" name="aboutText"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="html"> + <string><!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></string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>338</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="closeButton"> + <property name="text"> + <string>Close</string> + </property> + <property name="icon"> + <iconset theme="dialog-close"> + <normaloff>.</normaloff>.</iconset> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="applyButton"> + <property name="text"> + <string>Apply</string> + </property> + <property name="icon"> + <iconset theme="dialog-ok-apply"> + <normaloff>.</normaloff>.</iconset> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections/> +</ui> |