Check that network is online before checking and asking the user about network SRPMS updates
This commit is contained in:
parent
c60d78329a
commit
3a42a59ee9
@ -32,11 +32,12 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
|||||||
desktop_session = QtCore.QString('kde')
|
desktop_session = QtCore.QString('kde')
|
||||||
|
|
||||||
# refresh packages cache timer
|
# refresh packages cache timer
|
||||||
global refreshPackagesTimer, refreshPackagesCacheProcess, checkSRPMSUpdatesTimer, SRPMUpdateProcess
|
global refreshPackagesTimer, refreshPackagesCacheProcess, checkSRPMSUpdatesTimer, SRPMUpdateProcess, networkOnlineProcess
|
||||||
refreshPackagesTimer = QtCore.QTimer(self)
|
refreshPackagesTimer = QtCore.QTimer(self)
|
||||||
checkSRPMSUpdatesTimer = QtCore.QTimer(self)
|
checkSRPMSUpdatesTimer = QtCore.QTimer(self)
|
||||||
refreshPackagesCacheProcess = QtCore.QProcess(self)
|
refreshPackagesCacheProcess = QtCore.QProcess(self)
|
||||||
SRPMUpdateProcess = QtCore.QProcess(self)
|
SRPMUpdateProcess = QtCore.QProcess(self)
|
||||||
|
networkOnlineProcess = QtCore.QProcess(self)
|
||||||
self.connect(refreshPackagesTimer, SIGNAL("timeout()"), self.refreshPackagesCache)
|
self.connect(refreshPackagesTimer, SIGNAL("timeout()"), self.refreshPackagesCache)
|
||||||
self.connect(refreshPackagesCacheProcess, SIGNAL("finished(int,QProcess::ExitStatus)"), self.restartRefreshPackagesTimer)
|
self.connect(refreshPackagesCacheProcess, SIGNAL("finished(int,QProcess::ExitStatus)"), self.restartRefreshPackagesTimer)
|
||||||
self.connect(checkSRPMSUpdatesTimer, SIGNAL("timeout()"), self.SRPMSCheckUpgradeList)
|
self.connect(checkSRPMSUpdatesTimer, SIGNAL("timeout()"), self.SRPMSCheckUpgradeList)
|
||||||
@ -138,6 +139,9 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
|||||||
result.append(v[ v.find("for")+4 : v.find("(") ])
|
result.append(v[ v.find("for")+4 : v.find("(") ])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def networkOnline(self):
|
||||||
|
return networkOnlineProcess.execute("/usr/bin/nm-online",['-q','-x'])
|
||||||
|
|
||||||
def softwareManager(self):
|
def softwareManager(self):
|
||||||
self.setProxyForSmart()
|
self.setProxyForSmart()
|
||||||
if desktop_session == 'kde':
|
if desktop_session == 'kde':
|
||||||
@ -199,17 +203,18 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
|||||||
def SRPMSCheckUpgradeList(self):
|
def SRPMSCheckUpgradeList(self):
|
||||||
checkSRPMSUpdatesTimer.stop()
|
checkSRPMSUpdatesTimer.stop()
|
||||||
global contatore, lista, NetsrpmsArg
|
global contatore, lista, NetsrpmsArg
|
||||||
try:
|
if (self.networkOnline() == 0):
|
||||||
SRPMUpdateProcess.start("/usr/bin/openmamba-netsrpms",[NetsrpmsArg,srpm[contatore]])
|
try:
|
||||||
except: #supera il limite dell'indice nella lista
|
SRPMUpdateProcess.start("/usr/bin/openmamba-netsrpms",[NetsrpmsArg,srpm[contatore]])
|
||||||
contatore = 0
|
except: #supera il limite dell'indice nella lista
|
||||||
if NetsrpmsArg == '-c':
|
contatore = 0
|
||||||
self.SRPMSAskAndInstall()
|
if NetsrpmsArg == '-c':
|
||||||
else:
|
self.SRPMSAskAndInstall()
|
||||||
lista = []
|
else:
|
||||||
NetsrpmsArg = '-c'
|
lista = []
|
||||||
checkSRPMSUpdatesTimer.start((nOre * 60) * 60000)
|
NetsrpmsArg = '-c'
|
||||||
|
checkSRPMSUpdatesTimer.start((nOre * 60) * 60000)
|
||||||
|
|
||||||
#viene eseguita per ogni SRPM al termine del processo SRPMUpdateProcess
|
#viene eseguita per ogni SRPM al termine del processo SRPMUpdateProcess
|
||||||
def SRPMSCheckUpgrade(self, status):
|
def SRPMSCheckUpgrade(self, status):
|
||||||
global contatore, lista
|
global contatore, lista
|
||||||
|
Loading…
Reference in New Issue
Block a user