From 48775bb7bb51674c03707774b7073373ab270107 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 9 Jan 2021 04:10:15 +0000 Subject: * use .join rather than str to convert lists to strings * fix output message when multiple source packages are requested * minor UI tweaks --- src/backend/installbinary.py | 4 ++-- src/backend/installebuild.py | 8 ++++---- src/backend/upgradebinary.py | 2 +- src/backend/upgradeebuild.py | 8 ++++---- src/frontend/gui/sisyphus-gui.py | 34 +++++++++++++++++----------------- src/frontend/gui/ui/sisyphus.ui | 14 +++++++------- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/backend/installbinary.py b/src/backend/installbinary.py index d762ef9..9658bf9 100644 --- a/src/backend/installbinary.py +++ b/src/backend/installbinary.py @@ -24,7 +24,7 @@ def start(pkgname): if len(areSources) == 0: if not len(areBinaries) == 0: os.chdir(sisyphus.filesystem.portageCacheDir) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + " ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): print(">>> Fetching" + " " + binhostURL + binary) @@ -60,6 +60,6 @@ def start(pkgname): else: sys.exit("\n" + "No package found; Quitting." + "\n") else: - sys.exit("\n" + "Source package(s) found in the mix;" + " " + "Use" + " " + "'" + "sisyphus install" + " " + ''.join(pkgname) + " " + "--ebuild" + "'" + ";" + " " + "Quitting." + "\n") + sys.exit("\n" + "Source package(s) found in the mix;" + " " + "Use" + " " + "'" + "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'" + ";" + " " + "Quitting." + "\n") else: sys.exit("\nYou need root permissions to do this, exiting!\n") diff --git a/src/backend/installebuild.py b/src/backend/installebuild.py index 62e7fc2..27062bf 100644 --- a/src/backend/installebuild.py +++ b/src/backend/installebuild.py @@ -24,7 +24,7 @@ def start(pkgname): if len(areSources) == 0: if not len(areBinaries) == 0: os.chdir(sisyphus.filesystem.portageCacheDir) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + " ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): print(">>> Fetching" + " " + binhostURL + binary) @@ -62,8 +62,8 @@ def start(pkgname): else: if not len(areBinaries) == 0: os.chdir(sisyphus.filesystem.portageCacheDir) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") - print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + " ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") + print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + " ".join(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): print(">>> Fetching" + " " + binhostURL + binary) @@ -97,7 +97,7 @@ def start(pkgname): else: sys.exit("\n" + "Ok; Quitting." + "\n") else: - print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") + print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + " ".join(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": portageExec = subprocess.Popen(['emerge', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE) diff --git a/src/backend/upgradebinary.py b/src/backend/upgradebinary.py index b3d68b6..2bb7905 100644 --- a/src/backend/upgradebinary.py +++ b/src/backend/upgradebinary.py @@ -24,7 +24,7 @@ def start(): if len(areSources) == 0: if not len(areBinaries) == 0: os.chdir(sisyphus.filesystem.portageCacheDir) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + " ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): print(">>> Fetching" + " " + binhostURL + binary) diff --git a/src/backend/upgradeebuild.py b/src/backend/upgradeebuild.py index 952bde7..21add70 100644 --- a/src/backend/upgradeebuild.py +++ b/src/backend/upgradeebuild.py @@ -24,7 +24,7 @@ def start(): if len(areSources) == 0: if not len(areBinaries) == 0: os.chdir(sisyphus.filesystem.portageCacheDir) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + " ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): print(">>> Fetching" + " " + binhostURL + binary) @@ -62,8 +62,8 @@ def start(): else: if not len(areBinaries) == 0: os.chdir(sisyphus.filesystem.portageCacheDir) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") - print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + " ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") + print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + " ".join(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): print(">>> Fetching" + " " + binhostURL + binary) @@ -97,7 +97,7 @@ def start(): else: sys.exit("\n" + "Ok; Quitting." + "\n") else: - print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") + print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + " ".join(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": portageExec = subprocess.Popen(['emerge', '--update', '--deep', '--newuse', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE) diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 5cc4fc8..4e9a8b1 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -93,16 +93,16 @@ class Sisyphus(QtWidgets.QMainWindow): self.upgradeThread.finished.connect(self.jobDone) self.upgradeWorker.finished.connect(self.upgradeThread.quit) - self.orphansButton.clicked.connect(self.orphansRemove) - self.orphansWorker = MainWorker() - self.orphansThread = QtCore.QThread() - self.orphansWorker.moveToThread(self.orphansThread) - self.orphansWorker.started.connect(self.showProgressBar) - self.orphansWorker.started.connect(self.clearProgressBox) - self.orphansThread.started.connect(self.orphansWorker.cleanOrphans) - self.orphansWorker.workerOutput.connect(self.updateStatusBox) - self.orphansThread.finished.connect(self.jobDone) - self.orphansWorker.finished.connect(self.orphansThread.quit) + self.autoremoveButton.clicked.connect(self.autoRemove) + self.autoremoveWorker = MainWorker() + self.autoremoveThread = QtCore.QThread() + self.autoremoveWorker.moveToThread(self.autoremoveThread) + self.autoremoveWorker.started.connect(self.showProgressBar) + self.autoremoveWorker.started.connect(self.clearProgressBox) + self.autoremoveThread.started.connect(self.autoremoveWorker.startAutoremove) + self.autoremoveWorker.workerOutput.connect(self.updateStatusBox) + self.autoremoveThread.finished.connect(self.jobDone) + self.autoremoveWorker.finished.connect(self.autoremoveThread.quit) self.updateSystem() self.progressBar.hide() @@ -261,9 +261,9 @@ class Sisyphus(QtWidgets.QMainWindow): self.statusBar().showMessage("I am upgrading the system, please be patient ...") self.upgradeThread.start() - def orphansRemove(self): + def autoRemove(self): self.statusBar().showMessage("I am busy with some cleaning, please don't rush me ...") - self.orphansThread.start() + self.autoremoveThread.start() def jobDone(self): self.hideProgressBar() @@ -285,14 +285,14 @@ class Sisyphus(QtWidgets.QMainWindow): def hideButtons(self): self.installButton.hide() self.uninstallButton.hide() - self.orphansButton.hide() + self.autoremoveButton.hide() self.upgradeButton.hide() self.exitButton.hide() def showButtons(self): self.installButton.show() self.uninstallButton.show() - self.orphansButton.show() + self.autoremoveButton.show() self.upgradeButton.show() self.exitButton.show() @@ -403,7 +403,7 @@ class MainWorker(QtCore.QObject): areBinaries,areSources,needsConfig = sisyphus.solvedeps.package.__wrapped__(pkgname) #undecorate os.chdir(sisyphus.filesystem.portageCacheDir) - self.workerOutput.emit("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n") + self.workerOutput.emit("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + " ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n") for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): self.workerOutput.emit(">>> Fetching" + " " + binhostURL + binary) wget.download(binhostURL + binary) @@ -465,7 +465,7 @@ class MainWorker(QtCore.QObject): self.workerOutput.emit("\n" + "Source package upgrades detected; Use sisyphus CLI to perform the upgrade; Aborting." + "\n") else: if not len(areBinaries) == 0: - self.workerOutput.emit("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n") + self.workerOutput.emit("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + " ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n") os.chdir(sisyphus.filesystem.portageCacheDir) for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): self.workerOutput.emit(">>> Fetching" + " " + binhostURL + binary) @@ -505,7 +505,7 @@ class MainWorker(QtCore.QObject): self.finished.emit() @QtCore.pyqtSlot() - def cleanOrphans(self): + def startAutoremove(self): self.started.emit() portageExec = subprocess.Popen(['emerge', '--depclean'], stdout=subprocess.PIPE) diff --git a/src/frontend/gui/ui/sisyphus.ui b/src/frontend/gui/ui/sisyphus.ui index 23cf906..2831d55 100644 --- a/src/frontend/gui/ui/sisyphus.ui +++ b/src/frontend/gui/ui/sisyphus.ui @@ -196,7 +196,7 @@ - <html><head/><body><p align="center">Install package</p></body></html> + <html><head/><body><p align="center">Install the selected package(s)</p></body></html> @@ -222,7 +222,7 @@ - <html><head/><body><p align="center">Uninstall package</p></body></html> + <html><head/><body><p align="center">Uninstall the selected package(s)</p></body></html> @@ -248,7 +248,7 @@ - <html><head/><body><p align="center">Upgrade system</p></body></html> + <html><head/><body><p align="center">Upgrade the system</p></body></html> @@ -263,7 +263,7 @@ - + 16777215 @@ -271,7 +271,7 @@ - <html><head/><body><p align="center">Remove orphan packages</p></body></html> + <html><head/><body><p align="center">Uninstall no longer needed package(s)</p></body></html> @@ -297,7 +297,7 @@ - <html><head/><body><p align="center">Exit Sisyphus</p></body></html> + <html><head/><body><p align="center">Quit program</p></body></html> @@ -365,7 +365,7 @@ installButton uninstallButton upgradeButton - orphansButton + autoremoveButton exitButton -- cgit v1.2.3