summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/setbranch.py97
-rw-r--r--src/backend/syncall.py1
-rwxr-xr-xsrc/frontend/cli/sisyphus-cli.py5
-rw-r--r--src/frontend/gui/sisyphus-qt5.py176
-rw-r--r--src/frontend/gui/sisyphus-qt6.py175
-rw-r--r--src/frontend/gui/ui/settings.ui152
6 files changed, 443 insertions, 163 deletions
diff --git a/src/backend/setbranch.py b/src/backend/setbranch.py
index adff88a..8220589 100644
--- a/src/backend/setbranch.py
+++ b/src/backend/setbranch.py
@@ -6,6 +6,7 @@ import os
import random
import signal
import sys
+import time
import sisyphus.checkenv
import sisyphus.getclr
import sisyphus.getfs
@@ -55,31 +56,64 @@ def get_brch_rmt(branch, remote):
@animation.wait('injecting Gentoo Linux portage tree')
-def ins_g_repo(branch, remote):
+def ins_g_repo(branch, remote, gfx_ui=False):
g_rmt, r_rmt, p_cfg_rmt = get_brch_rmt(branch, remote)
+ if gfx_ui:
+ print("\ninjecting Gentoo Linux portage tree", flush=True)
+ else:
+ pass
+
if not os.path.isdir(os.path.join(sisyphus.getfs.g_src_dir, '.git')):
git.Repo.clone_from(
"/".join(g_rmt), sisyphus.getfs.g_src_dir, depth=1, branch=branch)
+ if gfx_ui:
+ print("\r" + " " * len("injecting Gentoo Linux portage tree") +
+ "\r", end='', flush=True)
+ else:
+ pass
+
@animation.wait('injecting Redcore Linux ebuild overlay')
-def ins_r_repo(branch, remote):
+def ins_r_repo(branch, remote, gfx_ui=False):
g_rmt, r_rmt, p_cfg_rmt = get_brch_rmt(branch, remote)
+ if gfx_ui:
+ print("\ninjecting Rentoo Linux ebuild overlay", flush=True)
+ else:
+ pass
+
if not os.path.isdir(os.path.join(sisyphus.getfs.r_src_dir, '.git')):
git.Repo.clone_from(
"/".join(r_rmt), sisyphus.getfs.r_src_dir, depth=1, branch=branch)
+ if gfx_ui:
+ print("\r" + " " * len("injecting Redcore Linux ebuild overlay") +
+ "\r", end='', flush=True)
+ else:
+ pass
+
@animation.wait('injecting Redcore Linux portage config')
-def ins_p_cfg_repo(branch, remote):
+def ins_p_cfg_repo(branch, remote, gfx_ui=False):
g_rmt, r_rmt, p_cfg_rmt = get_brch_rmt(branch, remote)
+ if gfx_ui:
+ print("\ninjecting Redcore Linux portage config", flush=True)
+ else:
+ pass
+
if not os.path.isdir(os.path.join(sisyphus.getfs.p_cfg_dir, '.git')):
git.Repo.clone_from("/".join(p_cfg_rmt),
sisyphus.getfs.p_cfg_dir, depth=1, branch=branch)
+ if gfx_ui:
+ print("\r" + " " * len("injecting Redcore Linux portage config") +
+ "\r", end='', flush=True)
+ else:
+ pass
+
def set_brch_master_index():
mirrorList = sisyphus.setmirror.getList()
@@ -95,34 +129,51 @@ def set_brch_next_index():
sisyphus.setmirror.setActive(chosen_index)
-def set_bhst_index(branch, remote):
- if "master" in branch:
+def set_bhst_index(branch, remote, gfx_ui=False):
+ if gfx_ui:
+ print(f"\nThe active branch has been switched to '{branch}'")
+ print(f"\nThe active remote has been switched to '{remote}'")
+ else:
print(f"{sisyphus.getclr.green}\nThe active branch has been switched to '{branch}'{sisyphus.getclr.reset}")
- print(f"{sisyphus.getclr.green}The active remote has been switched to '{remote}'{sisyphus.getclr.reset}")
- set_brch_master_index() # Set binhost index for branch 'master' (random odd index)
+ print(f"{sisyphus.getclr.green}\nThe active remote has been switched to '{remote}'{sisyphus.getclr.reset}")
+
+ if "master" in branch:
+ set_brch_master_index()
elif "next" in branch:
- print(f"{sisyphus.getclr.green}\nThe active branch has been switched to '{branch}'{sisyphus.getclr.reset}")
- print(f"{sisyphus.getclr.green}The active remote has been switched to '{remote}'{sisyphus.getclr.reset}")
- set_brch_next_index() # Set binhost index for branch 'next' (random even index)
+ set_brch_next_index()
-def start(branch, remote):
+def start(branch, remote, gfx_ui=False):
is_online = sisyphus.checkenv.connectivity()
- if sisyphus.checkenv.root():
- if is_online == 1:
- sisyphus.purgeenv.branch()
- sisyphus.purgeenv.metadata()
- ins_g_repo(branch, remote)
- ins_r_repo(branch, remote)
- ins_p_cfg_repo(branch, remote)
- sisyphus.setjobs.start()
- sisyphus.setprofile.start()
- set_bhst_index(branch, remote)
+ if is_online != 1:
+ if gfx_ui:
+ print("\nNo internet connection detected. Aborting!\n")
+ for i in range(9, 0, -1):
+ print(f"Killing application in : {i} seconds!")
+ time.sleep(1)
+
+ os.kill(os.getpid(), signal.SIGTERM) # kill GUI window
else:
print(
f"{sisyphus.getclr.bright_red}\nNo internet connection detected; Aborting!\n{sisyphus.getclr.reset}")
sys.exit()
else:
- print(f"{sisyphus.getclr.bright_red}\nRoot permissions are required to perform this action.\n{sisyphus.getclr.reset}")
- sys.exit()
+ if gfx_ui:
+ sisyphus.purgeenv.branch.__wrapped__()
+ sisyphus.purgeenv.metadata.__wrapped__()
+ ins_g_repo.__wrapped__(branch, remote, gfx_ui=True)
+ ins_r_repo.__wrapped__(branch, remote, gfx_ui=True)
+ ins_p_cfg_repo.__wrapped__(branch, remote, gfx_ui=True)
+ set_bhst_index(branch, remote, gfx_ui=True)
+ sisyphus.setprofile.start.__wrapped__()
+ sisyphus.setjobs.start()
+ else:
+ sisyphus.purgeenv.branch()
+ sisyphus.purgeenv.metadata()
+ ins_g_repo(branch, remote, gfx_ui=False)
+ ins_r_repo(branch, remote, gfx_ui=False)
+ ins_p_cfg_repo(branch, remote, gfx_ui=False)
+ set_bhst_index(branch, remote, gfx_ui=False)
+ sisyphus.setprofile.start()
+ sisyphus.setjobs.start()
diff --git a/src/backend/syncall.py b/src/backend/syncall.py
index c024a37..5cbcd8f 100644
--- a/src/backend/syncall.py
+++ b/src/backend/syncall.py
@@ -8,7 +8,6 @@ import time
import sisyphus.checkenv
import sisyphus.getclr
import sisyphus.getenv
-import sisyphus.purgeenv
import sisyphus.syncdb
import sisyphus.syncenv
diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py
index 4e7d856..18af382 100755
--- a/src/frontend/cli/sisyphus-cli.py
+++ b/src/frontend/cli/sisyphus-cli.py
@@ -307,7 +307,10 @@ def branch(branch: Branch = typer.Argument(...), remote: Remote = typer.Option(R
sisyphus mirror set 2\n
sisyphus mirror set 8\n
"""
- sisyphus.setbranch.start(branch.value, remote.value)
+ if sisyphus.checkenv.root():
+ sisyphus.setbranch.start(branch.value, remote.value, gfx_ui=False)
+ else:
+ sys.exit("\nYou need root permissions to do this, exiting!\n")
@app.command("sysinfo")
diff --git a/src/frontend/gui/sisyphus-qt5.py b/src/frontend/gui/sisyphus-qt5.py
index 45a076f..067fe7a 100644
--- a/src/frontend/gui/sisyphus-qt5.py
+++ b/src/frontend/gui/sisyphus-qt5.py
@@ -11,6 +11,8 @@ from PyQt5 import QtCore, QtGui, QtWidgets, uic
class Sisyphus(QtWidgets.QMainWindow):
def __init__(self):
super(Sisyphus, self).__init__()
+ self.progressWindow = None
+ self.settingsWindow = None
uic.loadUi('/usr/share/sisyphus/ui/sisyphus.ui', self)
signal.signal(signal.SIGTERM, self.handleSigterm)
self.centerOnScreen()
@@ -40,7 +42,6 @@ class Sisyphus(QtWidgets.QMainWindow):
Sisyphus.dbFilter = self.filterDatabases['All Packages']
Sisyphus.searchTerm = "'%%'"
- self.progressWindow = None
self.databaseTable.clicked.connect(self.rowClicked)
self.inputBox.textEdited.connect(self.searchDatabase)
@@ -97,15 +98,6 @@ class Sisyphus(QtWidgets.QMainWindow):
self.exitButton.clicked.connect(self.closeMainWindow)
- def centerOnScreen(self):
- screenGeometry = QtWidgets.QDesktopWidget().screenGeometry()
- windowGeometry = self.geometry()
- horizontalPosition = int(
- (screenGeometry.width() - windowGeometry.width()) / 2)
- verticalPosition = int(
- (screenGeometry.height() - windowGeometry.height()) / 2)
- self.move(horizontalPosition, verticalPosition)
-
def rowClicked(self):
Sisyphus.pkgSelect = len(
self.databaseTable.selectionModel().selectedRows())
@@ -200,17 +192,17 @@ class Sisyphus(QtWidgets.QMainWindow):
self.statusBar().showMessage("I am busy with some cleaning, please don't rush me ...")
self.autoremoveThread.start()
- def hideProgressButton(self):
- self.progressButton.hide()
+ def disableProgressButton(self):
+ self.progressButton.setEnabled(False)
- def showProgressButton(self):
- self.progressButton.show()
+ def enableProgressButton(self):
+ self.progressButton.setEnabled(True)
- def hideSettingsButton(self):
- self.settingsButton.hide()
+ def disableSettingsButton(self):
+ self.settingsButton.setEnabled(False)
- def showSettingsButton(self):
- self.settingsButton.show()
+ def enableSettingsButton(self):
+ self.settingsButton.setEnabled(True)
def hideUiButtons(self):
self.installButton.hide()
@@ -240,15 +232,15 @@ class Sisyphus(QtWidgets.QMainWindow):
def showProgress(self):
self.hideUiButtons()
- self.hideSettingsButton()
- self.showProgressButton()
+ self.disableSettingsButton()
+ self.enableProgressButton()
self.showProgressBar()
self.setInputFocus()
def hideProgress(self):
self.showUiButtons()
- self.showSettingsButton()
- self.hideProgressButton()
+ self.enableSettingsButton()
+ self.disableProgressButton()
self.hideProgressBar()
self.setInputFocus()
self.loadDatabase()
@@ -269,7 +261,9 @@ class Sisyphus(QtWidgets.QMainWindow):
self.progressWindow.show()
def showSettingsWindow(self):
- self.settingsWindow = SettingsWindow(self)
+ if self.settingsWindow is None:
+ self.settingsWindow = SettingsWindow(self, self.progressWindow)
+
self.settingsWindow.show()
def closeMainWindow(self):
@@ -281,6 +275,15 @@ class Sisyphus(QtWidgets.QMainWindow):
def __del__(self):
sys.stdout = sys.__stdout__
+ def centerOnScreen(self):
+ screenGeometry = QtWidgets.QDesktopWidget().screenGeometry()
+ windowGeometry = self.geometry()
+ horizontalPosition = int(
+ (screenGeometry.width() - windowGeometry.width()) / 2)
+ verticalPosition = int(
+ (screenGeometry.height() - windowGeometry.height()) / 2)
+ self.move(horizontalPosition, verticalPosition)
+
class ProgressWindow(QtWidgets.QMainWindow):
progress_messages = []
@@ -291,20 +294,12 @@ class ProgressWindow(QtWidgets.QMainWindow):
self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
self.centerOnScreen()
self.refreshProgressWindow()
+
self.clearButton.clicked.connect(self.clearProgressWindow)
self.hideButton.clicked.connect(self.hideProgressWindow)
sys.stdout = MainWorker(workerOutput=self.updateProgressWindow)
- def centerOnScreen(self):
- screenGeometry = QtWidgets.QDesktopWidget().screenGeometry()
- windowGeometry = self.geometry()
- horizontalPosition = int(
- (screenGeometry.width() - windowGeometry.width()) / 2)
- verticalPosition = int(
- (screenGeometry.height() - windowGeometry.height()) / 2)
- self.move(horizontalPosition, verticalPosition)
-
def updateProgressWindow(self, workerMessage):
ProgressWindow.progress_messages.append(workerMessage)
self.progressBox.insertPlainText(workerMessage)
@@ -323,26 +318,66 @@ class ProgressWindow(QtWidgets.QMainWindow):
def hideProgressWindow(self):
self.hide()
+ def centerOnScreen(self):
+ screenGeometry = QtWidgets.QDesktopWidget().screenGeometry()
+ windowGeometry = self.geometry()
+ horizontalPosition = int(
+ (screenGeometry.width() - windowGeometry.width()) / 2)
+ verticalPosition = int(
+ (screenGeometry.height() - windowGeometry.height()) / 2)
+ self.move(horizontalPosition, verticalPosition)
+
class SettingsWindow(QtWidgets.QMainWindow):
- def __init__(self, parent=None):
+ def __init__(self, parent=None, progressWindow=None):
super(SettingsWindow, self).__init__(parent)
+ self.mainWindow = parent
+ self.progressWindow = progressWindow
+ selected_branch = None
+ selected_remote = None
uic.loadUi('/usr/share/sisyphus/ui/settings.ui', self)
self.centerOnScreen()
+
self.MIRRORLIST = sisyphus.setmirror.getList()
self.updateMirrorList()
- self.applyButton.pressed.connect(self.writeMirrorList)
- self.applyButton.released.connect(self.closeSettingsWindow)
self.mirrorCombo.activated.connect(self.setMirrorList)
- def centerOnScreen(self):
- screenGeometry = QtWidgets.QDesktopWidget().screenGeometry()
- windowGeometry = self.geometry()
- horizontalPosition = int(
- (screenGeometry.width() - windowGeometry.width()) / 2)
- verticalPosition = int(
- (screenGeometry.height() - windowGeometry.height()) / 2)
- self.move(horizontalPosition, verticalPosition)
+ self.branches = OrderedDict([
+ ('Branch Master (stable)', 'master'),
+ ('Branch Next (testing)', 'next')
+ ])
+
+ self.branchCombo.blockSignals(True)
+ self.branchCombo.addItems(self.branches.keys())
+ system_branch = sisyphus.getenv.sys_brch()
+ self.branchCombo.setCurrentText(next(name for name, value in self.branches.items(
+ ) if value == system_branch)) # default to current branch, we have an API for it
+ self.branchCombo.blockSignals(False)
+ self.branchCombo.currentIndexChanged.connect(self.loadBranchRemote)
+
+ self.remotes = OrderedDict([
+ ('Github Remote : https://github.com/redcorelinux', 'github'),
+ ('Gitlab Remote : https://gitlab.com/redcore', 'gitlab'),
+ ('Pagure Remote : https://pagure.io/redcore', 'pagure')
+ ])
+
+ self.remoteCombo.blockSignals(True)
+ self.remoteCombo.addItems(self.remotes.keys())
+ self.remoteCombo.setCurrentText(
+ 'Gitlab Remote : https://gitlab.com/redcore')
+ self.remoteCombo.blockSignals(False)
+ self.remoteCombo.currentIndexChanged.connect(self.loadBranchRemote)
+
+ self.mirrorButton.clicked.connect(self.writeMirrorList)
+ self.branchButton.clicked.connect(self.changeBranchRemote)
+
+ self.branchWorker = MainWorker()
+ self.branchThread = QtCore.QThread()
+ self.branchWorker.moveToThread(self.branchThread)
+ self.branchWorker.started.connect(self.showProgress)
+ self.branchThread.started.connect(self.branchWorker.setBranch)
+ self.branchThread.finished.connect(self.hideProgress)
+ self.branchWorker.finished.connect(self.branchThread.quit)
def updateMirrorList(self):
model = QtGui.QStandardItemModel()
@@ -364,8 +399,52 @@ class SettingsWindow(QtWidgets.QMainWindow):
def writeMirrorList(self):
sisyphus.setmirror.writeList(self.MIRRORLIST)
- def closeSettingsWindow(self):
- self.close()
+ def loadBranchRemote(self):
+ selected_branch = self.branches[self.branchCombo.currentText()]
+ selected_remote = self.remotes[self.remoteCombo.currentText()]
+
+ return selected_branch, selected_remote
+
+ def changeBranchRemote(self):
+ selected_branch, selected_remote = self.loadBranchRemote()
+
+ self.branchWorker.selected_branch = selected_branch
+ self.branchWorker.selected_remote = selected_remote
+
+ self.branchThread.start()
+
+ def disableUiButtons(self):
+ self.mirrorButton.setEnabled(False)
+ self.branchButton.setEnabled(False)
+
+ def enableUiButtons(self):
+ self.mirrorButton.setEnabled(True)
+ self.branchButton.setEnabled(True)
+
+ def showProgress(self):
+ self.disableUiButtons()
+ self.mainWindow.showProgress()
+
+ if self.progressWindow is None:
+ self.progressWindow = ProgressWindow(self.mainWindow)
+ self.branchWorker.workerOutput.connect(
+ self.progressWindow.updateProgressWindow)
+
+ def hideProgress(self):
+ self.mainWindow.hideProgress()
+ self.mainWindow.updateSystem()
+ self.MIRRORLIST = sisyphus.setmirror.getList()
+ self.updateMirrorList()
+ self.enableUiButtons()
+
+ def centerOnScreen(self):
+ screenGeometry = QtWidgets.QDesktopWidget().screenGeometry()
+ windowGeometry = self.geometry()
+ horizontalPosition = int(
+ (screenGeometry.width() - windowGeometry.width()) / 2)
+ verticalPosition = int(
+ (screenGeometry.height() - windowGeometry.height()) / 2)
+ self.move(horizontalPosition, verticalPosition)
class MainWorker(QtCore.QObject):
@@ -417,6 +496,13 @@ class MainWorker(QtCore.QObject):
sisyphus.sysclean.start(gfx_ui=True)
self.finished.emit()
+ @QtCore.pyqtSlot()
+ def setBranch(self):
+ self.started.emit()
+ sisyphus.setbranch.start(self.selected_branch,
+ self.selected_remote, gfx_ui=True)
+ self.finished.emit()
+
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
diff --git a/src/frontend/gui/sisyphus-qt6.py b/src/frontend/gui/sisyphus-qt6.py
index 5ffcd32..3886a7f 100644
--- a/src/frontend/gui/sisyphus-qt6.py
+++ b/src/frontend/gui/sisyphus-qt6.py
@@ -11,6 +11,8 @@ from PyQt6 import QtCore, QtGui, QtWidgets, uic
class Sisyphus(QtWidgets.QMainWindow):
def __init__(self):
super(Sisyphus, self).__init__()
+ self.progressWindow = None
+ self.settingsWindow = None
uic.loadUi('/usr/share/sisyphus/ui/sisyphus.ui', self)
signal.signal(signal.SIGTERM, self.handleSigterm)
self.centerOnScreen()
@@ -40,7 +42,6 @@ class Sisyphus(QtWidgets.QMainWindow):
Sisyphus.dbFilter = self.filterDatabases['All Packages']
Sisyphus.searchTerm = "'%%'"
- self.progressWindow = None
self.databaseTable.clicked.connect(self.rowClicked)
self.inputBox.textEdited.connect(self.searchDatabase)
@@ -97,15 +98,6 @@ class Sisyphus(QtWidgets.QMainWindow):
self.exitButton.clicked.connect(self.closeMainWindow)
- def centerOnScreen(self):
- screenGeometry = QtGui.QGuiApplication.primaryScreen().geometry()
- windowGeometry = self.geometry()
- horizontalPosition = int(
- (screenGeometry.width() - windowGeometry.width()) / 2)
- verticalPosition = int(
- (screenGeometry.height() - windowGeometry.height()) / 2)
- self.move(horizontalPosition, verticalPosition)
-
def rowClicked(self):
Sisyphus.pkgSelect = len(
self.databaseTable.selectionModel().selectedRows())
@@ -200,17 +192,17 @@ class Sisyphus(QtWidgets.QMainWindow):
self.statusBar().showMessage("I am busy with some cleaning, please don't rush me ...")
self.autoremoveThread.start()
- def hideProgressButton(self):
- self.progressButton.hide()
+ def disableProgressButton(self):
+ self.progressButton.setEnabled(False)
- def showProgressButton(self):
- self.progressButton.show()
+ def enableProgressButton(self):
+ self.progressButton.setEnabled(True)
- def hideSettingsButton(self):
- self.settingsButton.hide()
+ def disableSettingsButton(self):
+ self.settingsButton.setEnabled(False)
- def showSettingsButton(self):
- self.settingsButton.show()
+ def enableSettingsButton(self):
+ self.settingsButton.setEnabled(True)
def hideUiButtons(self):
self.installButton.hide()
@@ -240,15 +232,15 @@ class Sisyphus(QtWidgets.QMainWindow):
def showProgress(self):
self.hideUiButtons()
- self.hideSettingsButton()
- self.showProgressButton()
+ self.disableSettingsButton()
+ self.enableProgressButton()
self.showProgressBar()
self.setInputFocus()
def hideProgress(self):
self.showUiButtons()
- self.showSettingsButton()
- self.hideProgressButton()
+ self.enableSettingsButton()
+ self.disableProgressButton()
self.hideProgressBar()
self.setInputFocus()
self.loadDatabase()
@@ -269,7 +261,9 @@ class Sisyphus(QtWidgets.QMainWindow):
self.progressWindow.show()
def showSettingsWindow(self):
- self.settingsWindow = SettingsWindow(self)
+ if self.settingsWindow is None:
+ self.settingsWindow = SettingsWindow(self, self.progressWindow)
+
self.settingsWindow.show()
def closeMainWindow(self):
@@ -281,6 +275,15 @@ class Sisyphus(QtWidgets.QMainWindow):
def __del__(self):
sys.stdout = sys.__stdout__
+ def centerOnScreen(self):
+ screenGeometry = QtGui.QGuiApplication.primaryScreen().geometry()
+ windowGeometry = self.geometry()
+ horizontalPosition = int(
+ (screenGeometry.width() - windowGeometry.width()) / 2)
+ verticalPosition = int(
+ (screenGeometry.height() - windowGeometry.height()) / 2)
+ self.move(horizontalPosition, verticalPosition)
+
class ProgressWindow(QtWidgets.QMainWindow):
progress_messages = []
@@ -296,15 +299,6 @@ class ProgressWindow(QtWidgets.QMainWindow):
sys.stdout = MainWorker(workerOutput=self.updateProgressWindow)
- def centerOnScreen(self):
- screenGeometry = QtGui.QGuiApplication.primaryScreen().geometry()
- windowGeometry = self.geometry()
- horizontalPosition = int(
- (screenGeometry.width() - windowGeometry.width()) / 2)
- verticalPosition = int(
- (screenGeometry.height() - windowGeometry.height()) / 2)
- self.move(horizontalPosition, verticalPosition)
-
def updateProgressWindow(self, workerMessage):
ProgressWindow.progress_messages.append(workerMessage)
self.progressBox.insertPlainText(workerMessage)
@@ -323,26 +317,66 @@ class ProgressWindow(QtWidgets.QMainWindow):
def hideProgressWindow(self):
self.hide()
+ def centerOnScreen(self):
+ screenGeometry = QtGui.QGuiApplication.primaryScreen().geometry()
+ windowGeometry = self.geometry()
+ horizontalPosition = int(
+ (screenGeometry.width() - windowGeometry.width()) / 2)
+ verticalPosition = int(
+ (screenGeometry.height() - windowGeometry.height()) / 2)
+ self.move(horizontalPosition, verticalPosition)
+
class SettingsWindow(QtWidgets.QMainWindow):
- def __init__(self, parent=None):
+ def __init__(self, parent=None, progressWindow=None):
super(SettingsWindow, self).__init__(parent)
+ self.mainWindow = parent
+ self.progressWindow = progressWindow
+ selected_branch = None
+ selected_remote = None
uic.loadUi('/usr/share/sisyphus/ui/settings.ui', self)
self.centerOnScreen()
+
self.MIRRORLIST = sisyphus.setmirror.getList()
self.updateMirrorList()
- self.applyButton.pressed.connect(self.writeMirrorList)
- self.applyButton.released.connect(self.closeSettingsWindow)
self.mirrorCombo.activated.connect(self.setMirrorList)
- def centerOnScreen(self):
- screenGeometry = QtGui.QGuiApplication.primaryScreen().geometry()
- windowGeometry = self.geometry()
- horizontalPosition = int(
- (screenGeometry.width() - windowGeometry.width()) / 2)
- verticalPosition = int(
- (screenGeometry.height() - windowGeometry.height()) / 2)
- self.move(horizontalPosition, verticalPosition)
+ self.branches = OrderedDict([
+ ('Branch Master (stable)', 'master'),
+ ('Branch Next (testing)', 'next')
+ ])
+
+ self.branchCombo.blockSignals(True)
+ self.branchCombo.addItems(self.branches.keys())
+ system_branch = sisyphus.getenv.sys_brch()
+ self.branchCombo.setCurrentText(next(name for name, value in self.branches.items(
+ ) if value == system_branch)) # default to current branch, we have an API for it
+ self.branchCombo.blockSignals(False)
+ self.branchCombo.currentIndexChanged.connect(self.loadBranchRemote)
+
+ self.remotes = OrderedDict([
+ ('Github Remote : https://github.com/redcorelinux', 'github'),
+ ('Gitlab Remote : https://gitlab.com/redcore', 'gitlab'),
+ ('Pagure Remote : https://pagure.io/redcore', 'pagure')
+ ])
+
+ self.remoteCombo.blockSignals(True)
+ self.remoteCombo.addItems(self.remotes.keys())
+ self.remoteCombo.setCurrentText(
+ 'Gitlab Remote : https://gitlab.com/redcore')
+ self.remoteCombo.blockSignals(False)
+ self.remoteCombo.currentIndexChanged.connect(self.loadBranchRemote)
+
+ self.mirrorButton.clicked.connect(self.writeMirrorList)
+ self.branchButton.clicked.connect(self.changeBranchRemote)
+
+ self.branchWorker = MainWorker()
+ self.branchThread = QtCore.QThread()
+ self.branchWorker.moveToThread(self.branchThread)
+ self.branchWorker.started.connect(self.showProgress)
+ self.branchThread.started.connect(self.branchWorker.setBranch)
+ self.branchThread.finished.connect(self.hideProgress)
+ self.branchWorker.finished.connect(self.branchThread.quit)
def updateMirrorList(self):
model = QtGui.QStandardItemModel()
@@ -364,8 +398,52 @@ class SettingsWindow(QtWidgets.QMainWindow):
def writeMirrorList(self):
sisyphus.setmirror.writeList(self.MIRRORLIST)
- def closeSettingsWindow(self):
- self.close()
+ def loadBranchRemote(self):
+ selected_branch = self.branches[self.branchCombo.currentText()]
+ selected_remote = self.remotes[self.remoteCombo.currentText()]
+
+ return selected_branch, selected_remote
+
+ def changeBranchRemote(self):
+ selected_branch, selected_remote = self.loadBranchRemote()
+
+ self.branchWorker.selected_branch = selected_branch
+ self.branchWorker.selected_remote = selected_remote
+
+ self.branchThread.start()
+
+ def disableUiButtons(self):
+ self.mirrorButton.setEnabled(False)
+ self.branchButton.setEnabled(False)
+
+ def enableUiButtons(self):
+ self.mirrorButton.setEnabled(True)
+ self.branchButton.setEnabled(True)
+
+ def showProgress(self):
+ self.disableUiButtons()
+ self.mainWindow.showProgress()
+
+ if self.progressWindow is None:
+ self.progressWindow = ProgressWindow(self.mainWindow)
+ self.branchWorker.workerOutput.connect(
+ self.progressWindow.updateProgressWindow)
+
+ def hideProgress(self):
+ self.mainWindow.hideProgress()
+ self.mainWindow.updateSystem()
+ self.MIRRORLIST = sisyphus.setmirror.getList()
+ self.updateMirrorList()
+ self.enableUiButtons()
+
+ def centerOnScreen(self):
+ screenGeometry = QtGui.QGuiApplication.primaryScreen().geometry()
+ windowGeometry = self.geometry()
+ horizontalPosition = int(
+ (screenGeometry.width() - windowGeometry.width()) / 2)
+ verticalPosition = int(
+ (screenGeometry.height() - windowGeometry.height()) / 2)
+ self.move(horizontalPosition, verticalPosition)
class MainWorker(QtCore.QObject):
@@ -417,6 +495,13 @@ class MainWorker(QtCore.QObject):
sisyphus.sysclean.start(gfx_ui=True)
self.finished.emit()
+ @QtCore.pyqtSlot()
+ def setBranch(self):
+ self.started.emit()
+ sisyphus.setbranch.start(self.selected_branch,
+ self.selected_remote, gfx_ui=True)
+ self.finished.emit()
+
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
diff --git a/src/frontend/gui/ui/settings.ui b/src/frontend/gui/ui/settings.ui
index eb9196a..5ffa8ee 100644
--- a/src/frontend/gui/ui/settings.ui
+++ b/src/frontend/gui/ui/settings.ui
@@ -2,9 +2,6 @@
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
- <property name="windowModality">
- <enum>Qt::ApplicationModal</enum>
- </property>
<property name="geometry">
<rect>
<x>0</x>
@@ -43,7 +40,10 @@
</size>
</property>
<property name="title">
- <string>Select Active Mirror</string>
+ <string>Select Mirror</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
@@ -60,14 +60,107 @@
<height>30</height>
</size>
</property>
- <property name="currentText">
- <string notr="true"/>
+ <property name="frame">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="mirrorButton">
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>125</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Apply</string>
+ </property>
+ <property name="icon">
+ <iconset theme="dialog-ok">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="branchGroupBox">
+ <property name="title">
+ <string>Select Branch / Select Remote</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QComboBox" name="branchCombo">
+ <property name="frame">
+ <bool>false</bool>
</property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="remoteCombo">
<property name="frame">
<bool>false</bool>
</property>
</widget>
</item>
+ <item>
+ <widget class="QToolButton" name="branchButton">
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>125</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Apply</string>
+ </property>
+ <property name="icon">
+ <iconset theme="dialog-ok">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -76,14 +169,17 @@
<property name="title">
<string>About</string>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QTextBrowser" name="aboutText">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
- <enum>QFrame::Plain</enum>
+ <enum>QFrame::Sunken</enum>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
@@ -95,7 +191,6 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;In it's essence Sisyphus is a simple wrapper around portage, gentoolkit, and portage-utils&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;which provides an apt-get/yum-alike interface to these commands, to assist newcomer people transitioning from Debian/RedHat-based systems to Gentoo.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-weight:600;&quot;&gt;Author:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;Ghiunhan Mamut &amp;lt;V3n3RiX&amp;gt;&lt;/span&gt;&lt;/p&gt;
@@ -104,8 +199,6 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-weight:600;&quot;&gt;Contributors:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;Ionel Busuioc &amp;lt;bionel&amp;gt;&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
-&lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;right&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;Copyleft (ɔ) 2016 - 2024 Redcore Linux Project&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
@@ -113,43 +206,6 @@ p, li { white-space: pre-wrap; }
</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="applyButton">
- <property name="text">
- <string>Apply</string>
- </property>
- <property name="icon">
- <iconset theme="dialog-ok-apply">
- <normaloff>.</normaloff>.</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>25</width>
- <height>25</height>
- </size>
- </property>
- <property name="flat">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
</layout>
</widget>
</widget>