From c69b8438832bf2c3f36784f5f576950b5f30580e Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sun, 19 Jun 2022 19:05:43 +0200 Subject: [PATCH] Use correct icon for mambabase; improve About box --- mambatray.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/mambatray.py b/mambatray.py index e3fc006..8d1a272 100755 --- a/mambatray.py +++ b/mambatray.py @@ -9,12 +9,15 @@ import os import gettext import libproxy import distro -from PyQt5.QtCore import pyqtSignal +from PyQt5 import uic +from PyQt5.QtCore import pyqtSignal, Qt from PyQt5.QtGui import QIcon, QCursor from PyQt5.QtWidgets import QSystemTrayIcon, QApplication, QMenu, QMainWindow,\ QMessageBox, QWidget from PyQt5.QtCore import QTimer, QProcess +DATADIR = os.path.dirname(os.path.realpath((__file__))) + "/" + class SystemTrayIcon(QSystemTrayIcon): @@ -71,7 +74,7 @@ class SystemTrayIcon(QSystemTrayIcon): softwareCheckUpgradesAction = softwareMenu.addAction(QIcon.fromTheme("system-software-update"),_("Check for updates now...")) softwareCheckUpgradesAction.triggered.connect(self.softwareCheckUpgrades) - softwareBaseInstallsAction = softwareMenu.addAction(QIcon.fromTheme("system-logo"),_("{} components...").format(distro.name())) + softwareBaseInstallsAction = softwareMenu.addAction(QIcon.fromTheme("mambabase"),_("{} components...").format(distro.name())) softwareBaseInstallsAction.triggered.connect(self.softwareBaseInstalls) # network menu @@ -99,7 +102,7 @@ class SystemTrayIcon(QSystemTrayIcon): # about box aboutAction = self.menu.addSeparator() - aboutAction = self.menu.addAction(QIcon.fromTheme("help-about"),_("About")) + aboutAction = self.menu.addAction(QIcon.fromTheme("system-logo"),_("About")) aboutAction.triggered.connect(self.about) self.setToolTip(_("{} control center").format(distro.name())) @@ -131,9 +134,19 @@ class SystemTrayIcon(QSystemTrayIcon): self.contextMenu().popup(QCursor.pos()) def about(self): - QMessageBox.about(self.menu, _("About"), + aboutBox = QMessageBox(self.menu) + aboutBox.setWindowIcon(QIcon.fromTheme("mambatray")) + aboutBox.setWindowTitle(_("About")) + aboutBox.setText( "
"+_("{} control center").format(distro.name()+"" - "

"+distro.name(pretty=True)+"
")) + "

"+distro.name(pretty=True)+ + "

" + distro.os_release_info()['home_url'] + "" + "")) + aboutBox.setTextFormat(Qt.RichText) + aboutBox.setIconPixmap(QIcon.fromTheme("system-logo").pixmap(32)); + aboutBox.setWindowModality(Qt.NonModal); + aboutBox.exec() def networkOnline(self): return networkOnlineProcess.execute("/usr/bin/nm-online",['-q','-x']) @@ -234,7 +247,7 @@ class SystemTrayIcon(QSystemTrayIcon): def Lista(self): testo = '' for a in lista: - testo = testo + a + ', ' + testo = testo + a + ', ' return testo[0:len(testo)-2]