Add System Info

This commit is contained in:
Filippo Bedendo Bordon 2011-07-01 17:57:47 +02:00
parent dbfb774546
commit 8e97d10fde

View File

@ -5,6 +5,7 @@
# Distributed under the terms of the GPL version 3 FLOSS License # Distributed under the terms of the GPL version 3 FLOSS License
# #
import sys import sys
import os
import gettext import gettext
from PyQt4.QtCore import SIGNAL from PyQt4.QtCore import SIGNAL
from PyQt4 import QtGui from PyQt4 import QtGui
@ -15,7 +16,7 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
def __init__(self, icon, parent=None): def __init__(self, icon, parent=None):
global w, menu, contatore, srpm, lista, NetsrpmsArg, nOre global w, menu, contatore, srpm, lista, NetsrpmsArg, nOre
nOre = 2 nOre = 2
srpm = ["skype", "flashplugin", "win32codecs"] srpm = ["skype", "flashplugin", "win32codecs", "msttcorefonts", "b43-firmware"]
NetsrpmsArg = "-c" NetsrpmsArg = "-c"
lista = [] lista = []
contatore = 0 contatore = 0
@ -90,10 +91,31 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
menu.popup(self.geometry().center()) menu.popup(self.geometry().center())
def about(self): def about(self):
global version
path = '/etc/openmamba-release'
if os.path.exists(path):
v = open(path, 'r')
version = v.read()
a = self.FormattaInfo()
version = "<ul><li>"+_("<font color=\"green\">open</font>mamba version:")+" <i>"+a[0]+"</i><li>"+_("Platform: ")+"<i>"+a[1]+"</i></ul>"
v.close()
else:
version = "Error: Unable to find /etc/openmamba-release"
QtGui.QMessageBox.about(menu, _("About"), QtGui.QMessageBox.about(menu, _("About"),
"<center><b>"+_("openmamba control center")+"</b>" "<center><b>"+_("openmamba control center")+"</b>"
"<br><br>Copyright(c) 2011 by Silvan Calarco" "<br><br>Copyright(c) 2011 by Silvan Calarco"
"<br><br><a href=\"http://www.openmamba.org\">http://www.openmamba.org</a></center>") "<br>Copyright(c) 2011 by michiamophil"
"<br><br><b>"+_("System info:")+"</b></center>"
""+_(version)+"<center><a href=\"http://www.openmamba.org\">http://www.openmamba.org</a></center>")
def FormattaInfo(self):
result = []
v = version
#result[0]=versione
result.append(v[ v.find("openmamba ")+10 : v.find(" for") ] + " " + v[ v.find("(") : v.find(")")+1 ])
#result[1] = piattaforma
result.append(v[ v.find("for")+4 : v.find("(") ])
return result
def softwareManager(self): def softwareManager(self):
softwareManagerProcess.execute("/opt/kde/bin/kpackagekit") softwareManagerProcess.execute("/opt/kde/bin/kpackagekit")