Use correct icon for mambabase; improve About box
This commit is contained in:
parent
3d9e14a5d9
commit
c69b843883
25
mambatray.py
25
mambatray.py
@ -9,12 +9,15 @@ import os
|
|||||||
import gettext
|
import gettext
|
||||||
import libproxy
|
import libproxy
|
||||||
import distro
|
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.QtGui import QIcon, QCursor
|
||||||
from PyQt5.QtWidgets import QSystemTrayIcon, QApplication, QMenu, QMainWindow,\
|
from PyQt5.QtWidgets import QSystemTrayIcon, QApplication, QMenu, QMainWindow,\
|
||||||
QMessageBox, QWidget
|
QMessageBox, QWidget
|
||||||
from PyQt5.QtCore import QTimer, QProcess
|
from PyQt5.QtCore import QTimer, QProcess
|
||||||
|
|
||||||
|
DATADIR = os.path.dirname(os.path.realpath((__file__))) + "/"
|
||||||
|
|
||||||
|
|
||||||
class SystemTrayIcon(QSystemTrayIcon):
|
class SystemTrayIcon(QSystemTrayIcon):
|
||||||
|
|
||||||
@ -71,7 +74,7 @@ class SystemTrayIcon(QSystemTrayIcon):
|
|||||||
softwareCheckUpgradesAction = softwareMenu.addAction(QIcon.fromTheme("system-software-update"),_("Check for updates now..."))
|
softwareCheckUpgradesAction = softwareMenu.addAction(QIcon.fromTheme("system-software-update"),_("Check for updates now..."))
|
||||||
softwareCheckUpgradesAction.triggered.connect(self.softwareCheckUpgrades)
|
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)
|
softwareBaseInstallsAction.triggered.connect(self.softwareBaseInstalls)
|
||||||
|
|
||||||
# network menu
|
# network menu
|
||||||
@ -99,7 +102,7 @@ class SystemTrayIcon(QSystemTrayIcon):
|
|||||||
|
|
||||||
# about box
|
# about box
|
||||||
aboutAction = self.menu.addSeparator()
|
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)
|
aboutAction.triggered.connect(self.about)
|
||||||
|
|
||||||
self.setToolTip(_("{} control center").format(distro.name()))
|
self.setToolTip(_("{} control center").format(distro.name()))
|
||||||
@ -131,9 +134,19 @@ class SystemTrayIcon(QSystemTrayIcon):
|
|||||||
self.contextMenu().popup(QCursor.pos())
|
self.contextMenu().popup(QCursor.pos())
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
QMessageBox.about(self.menu, _("About"),
|
aboutBox = QMessageBox(self.menu)
|
||||||
|
aboutBox.setWindowIcon(QIcon.fromTheme("mambatray"))
|
||||||
|
aboutBox.setWindowTitle(_("About"))
|
||||||
|
aboutBox.setText(
|
||||||
"<center><b>"+_("{} control center").format(distro.name()+"</b>"
|
"<center><b>"+_("{} control center").format(distro.name()+"</b>"
|
||||||
"<br/></br/>"+distro.name(pretty=True)+"</center>"))
|
"<br/><br/>"+distro.name(pretty=True)+
|
||||||
|
"<br/><br/><a href=\""+distro.os_release_info()['home_url']+
|
||||||
|
"\">" + distro.os_release_info()['home_url'] + "</a>"
|
||||||
|
"</center>"))
|
||||||
|
aboutBox.setTextFormat(Qt.RichText)
|
||||||
|
aboutBox.setIconPixmap(QIcon.fromTheme("system-logo").pixmap(32));
|
||||||
|
aboutBox.setWindowModality(Qt.NonModal);
|
||||||
|
aboutBox.exec()
|
||||||
|
|
||||||
def networkOnline(self):
|
def networkOnline(self):
|
||||||
return networkOnlineProcess.execute("/usr/bin/nm-online",['-q','-x'])
|
return networkOnlineProcess.execute("/usr/bin/nm-online",['-q','-x'])
|
||||||
@ -234,7 +247,7 @@ class SystemTrayIcon(QSystemTrayIcon):
|
|||||||
def Lista(self):
|
def Lista(self):
|
||||||
testo = ''
|
testo = ''
|
||||||
for a in lista:
|
for a in lista:
|
||||||
testo = testo + a + ', '
|
testo = testo + a + ', '
|
||||||
return testo[0:len(testo)-2]
|
return testo[0:len(testo)-2]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user