Add code to use kpackagekit or gnome-packagekit according to DESKTOP_SESSION environment variable
This commit is contained in:
parent
7a19d554b3
commit
90ff748b8e
@ -14,7 +14,7 @@ from PyQt4 import QtCore
|
|||||||
class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
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, desktop_session
|
||||||
nOre = 2
|
nOre = 2
|
||||||
srpm = ["skype", "flashplugin", "win32codecs", "msttcorefonts", "b43-firmware"]
|
srpm = ["skype", "flashplugin", "win32codecs", "msttcorefonts", "b43-firmware"]
|
||||||
NetsrpmsArg = "-c"
|
NetsrpmsArg = "-c"
|
||||||
@ -24,6 +24,12 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
|||||||
QtGui.QSystemTrayIcon.__init__(self, icon, parent)
|
QtGui.QSystemTrayIcon.__init__(self, icon, parent)
|
||||||
menu = QtGui.QMenu(parent)
|
menu = QtGui.QMenu(parent)
|
||||||
|
|
||||||
|
desktop_session = QtCore.QString(os.getenv('DESKTOP_SESSION'))
|
||||||
|
if desktop_session == 'default':
|
||||||
|
desktop_session = QtCore.QString('kde')
|
||||||
|
if desktop_session.left(3) == 'kde':
|
||||||
|
desktop_session = QtCore.QString('kde')
|
||||||
|
|
||||||
# refresh packages cache timer
|
# refresh packages cache timer
|
||||||
global refreshPackagesTimer, refreshPackagesCacheProcess, checkSRPMSUpdatesTimer, SRPMUpdateProcess
|
global refreshPackagesTimer, refreshPackagesCacheProcess, checkSRPMSUpdatesTimer, SRPMUpdateProcess
|
||||||
refreshPackagesTimer = QtCore.QTimer(self)
|
refreshPackagesTimer = QtCore.QTimer(self)
|
||||||
@ -119,11 +125,16 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def softwareManager(self):
|
def softwareManager(self):
|
||||||
|
if desktop_session == 'kde':
|
||||||
softwareManagerProcess.execute("/opt/kde/bin/kpackagekit")
|
softwareManagerProcess.execute("/opt/kde/bin/kpackagekit")
|
||||||
|
else:
|
||||||
|
softwareManagerProcess.execute("/usr/bin/gpk-application")
|
||||||
|
|
||||||
def softwareCheckUpgrades(self):
|
def softwareCheckUpgrades(self):
|
||||||
|
if desktop_session == 'kde':
|
||||||
softwareCheckUpgradesProcess.start("/opt/kde/bin/kpackagekit", ['--updates'])
|
softwareCheckUpgradesProcess.start("/opt/kde/bin/kpackagekit", ['--updates'])
|
||||||
|
else:
|
||||||
|
softwareCheckUpgradesProcess.start("/usr/bin/gpk-update-viewer")
|
||||||
def refreshPackagesCache(self):
|
def refreshPackagesCache(self):
|
||||||
refreshPackagesTimer.stop()
|
refreshPackagesTimer.stop()
|
||||||
refreshPackagesCacheProcess.start("/usr/bin/pkcon", ['refresh'])
|
refreshPackagesCacheProcess.start("/usr/bin/pkcon", ['refresh'])
|
||||||
|
Loading…
Reference in New Issue
Block a user