コード例 #1
0
 def getUpdateInfosCB(self, callback, errback, retval=None):
     if retval is not None:
         if retval is True:
             if iSoftwareTools.available_updates != 0:
                 # _("There are at least ") + str(iSoftwareTools.available_updates) + _(" updates available.")
                 print("Updates available.")
                 return self.buildList(callback, errback)
             else:
                 # _("There are no updates available.")
                 print("There are no updates available.")
                 return callback()
         elif retval is False:
             if iSoftwareTools.lastDownloadDate is None:
                 if iSoftwareTools.NetworkConnectionAvailable:
                     # _("Updatefeed not available.")
                     print("Updatefeed not available.")
                     return errback(_("Updatefeed not available."))
                 else:
                     # _("No network connection available.")
                     print("No network connection available.")
                     return errback(_("No network connection available."))
             else:
                 print("IPKGUpdateNotification getUpdates")
                 # Call update
                 iSoftwareTools.lastDownloadDate = time()
                 iSoftwareTools.list_updating = True
                 iSoftwareTools.getUpdates(
                     boundFunction(self.getUpdateInfosCB, callback,
                                   errback))
                 return
     callback()
コード例 #2
0
	def getUpdateInfosCB(self, callback, errback, retval = None):
		if retval is not None:
			if retval is True:
				if iSoftwareTools.available_updates is not 0:
					# _("There are at least ") + str(iSoftwareTools.available_updates) + _(" updates available.")
					log.debug( "Updates available." )
					return self.buildList(callback, errback)
				else:
					# _("There are no updates available.")
					log.debug( "There are no updates available." )
					return callback()
			elif retval is False:
				if iSoftwareTools.lastDownloadDate is None:
					if iSoftwareTools.NetworkConnectionAvailable:
						# _("Updatefeed not available.")
						log.debug( "Updatefeed not available." )
						return errback(_("Updatefeed not available."))
					else:
						# _("No network connection available.")
						log.debug( "No network connection available." )
						return errback(_("No network connection available."))
				else:
					log.debug( "IPKGUpdateNotification getUpdates" )
					# Call update
					iSoftwareTools.lastDownloadDate = time()
					iSoftwareTools.list_updating = True
					iSoftwareTools.getUpdates( boundFunction(self.getUpdateInfosCB, callback, errback) )
					return
		callback()