Added periodic package cache refresh command execution (pkcon refresh)
This commit is contained in:
parent
2f0bd89c19
commit
1ada2eaeb0
@ -17,6 +17,13 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
|||||||
QtGui.QSystemTrayIcon.__init__(self, icon, parent)
|
QtGui.QSystemTrayIcon.__init__(self, icon, parent)
|
||||||
menu = QtGui.QMenu(parent)
|
menu = QtGui.QMenu(parent)
|
||||||
|
|
||||||
|
# refresh packages cache timer
|
||||||
|
global refreshPackagesTimer, refreshPackagesCacheProcess
|
||||||
|
refreshPackagesTimer = QtCore.QTimer(self)
|
||||||
|
refreshPackagesCacheProcess = QtCore.QProcess(self)
|
||||||
|
self.connect(refreshPackagesTimer, SIGNAL("timeout()"), self.refreshPackagesCache)
|
||||||
|
self.connect(refreshPackagesCacheProcess, SIGNAL("finished(int,QProcess::ExitStatus)"), self.restartRefreshPackagesTimer)
|
||||||
|
|
||||||
# software menu
|
# software menu
|
||||||
global softwareManagerProcess, softwareCheckUpgradesProcess, softwareBaseInstallsProcess, dcopServerProcess
|
global softwareManagerProcess, softwareCheckUpgradesProcess, softwareBaseInstallsProcess, dcopServerProcess
|
||||||
softwareManagerProcess = QtCore.QProcess(self)
|
softwareManagerProcess = QtCore.QProcess(self)
|
||||||
@ -63,6 +70,9 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
|||||||
self.setToolTip(_("openmamba control center"))
|
self.setToolTip(_("openmamba control center"))
|
||||||
self.activated.connect(self.iconActivated)
|
self.activated.connect(self.iconActivated)
|
||||||
|
|
||||||
|
# the first time refresh packages cache after 5 minutes
|
||||||
|
refreshPackagesTimer.start( 5 * 60000 )
|
||||||
|
|
||||||
def iconActivated(self, reason):
|
def iconActivated(self, reason):
|
||||||
if reason in (QtGui.QSystemTrayIcon.Trigger, QtGui.QSystemTrayIcon.DoubleClick):
|
if reason in (QtGui.QSystemTrayIcon.Trigger, QtGui.QSystemTrayIcon.DoubleClick):
|
||||||
menu.popup(self.geometry().center())
|
menu.popup(self.geometry().center())
|
||||||
@ -77,7 +87,15 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
|||||||
softwareManagerProcess.execute("/opt/kde/bin/kpackagekit")
|
softwareManagerProcess.execute("/opt/kde/bin/kpackagekit")
|
||||||
|
|
||||||
def softwareCheckUpgrades(self):
|
def softwareCheckUpgrades(self):
|
||||||
softwareCheckUpgradesProcess.execute("/opt/kde/bin/kpackagekit", QtCore.QStringList(list(set(['--updates']))))
|
softwareCheckUpgradesProcess.start("/opt/kde/bin/kpackagekit", ['--updates'])
|
||||||
|
|
||||||
|
def refreshPackagesCache(self):
|
||||||
|
refreshPackagesTimer.stop()
|
||||||
|
refreshPackagesCacheProcess.start("/usr/bin/pkcon", ['refresh'])
|
||||||
|
|
||||||
|
def restartRefreshPackagesTimer(self,status):
|
||||||
|
# check every 4 hours and 31 minutes */
|
||||||
|
refreshPackagesTimer.start( (4 * 60 + 31) * 60000)
|
||||||
|
|
||||||
def softwareBaseInstalls(self):
|
def softwareBaseInstalls(self):
|
||||||
dcopServerProcess.startDetached("/opt/kde3/bin/dcopserver")
|
dcopServerProcess.startDetached("/opt/kde3/bin/dcopserver")
|
||||||
|
Loading…
Reference in New Issue
Block a user