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,6 +203,7 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
|||||||
def SRPMSCheckUpgradeList(self):
|
def SRPMSCheckUpgradeList(self):
|
||||||
checkSRPMSUpdatesTimer.stop()
|
checkSRPMSUpdatesTimer.stop()
|
||||||
global contatore, lista, NetsrpmsArg
|
global contatore, lista, NetsrpmsArg
|
||||||
|
if (self.networkOnline() == 0):
|
||||||
try:
|
try:
|
||||||
SRPMUpdateProcess.start("/usr/bin/openmamba-netsrpms",[NetsrpmsArg,srpm[contatore]])
|
SRPMUpdateProcess.start("/usr/bin/openmamba-netsrpms",[NetsrpmsArg,srpm[contatore]])
|
||||||
except: #supera il limite dell'indice nella lista
|
except: #supera il limite dell'indice nella lista
|
||||||
|
Loading…
Reference in New Issue
Block a user