Exemplo n.º 1
0
	def install(self):
		if len(self.devices) == 0:
			return
			
		index = self["menu"].getIndex()
		if index == None:
			index = 0
		
		if len(self.devices[index].getPackage()) == 0 or smstack.checkIfPending(self.devices[index].getPackage()):
			return
			
		if fileExists("/usr/lib/opkg/info/%s.control" % self.devices[index].getPackage()):
			smstack.add(SMStack.REMOVE, self.devices[index].getPackage())
			self.devices[index].setStatus(2)
		else:
			smstack.add(SMStack.UPDATE, "")
			api = SAPCL()
			firmwares = api.getUsbFirmwares(self.devices[index].getPackage())
			for firmware in firmwares["firmwares"]:
				if not fileExists("/usr/lib/opkg/info/%s.control" % firmware["firmware-name"]):
					smstack.add(SMStack.INSTALL, firmware["firmware-name"])
			smstack.add(SMStack.INSTALL_WITH_REBOOT, self.devices[index].getPackage())
			self.devices[index].setStatus(3)
			
		self.drawList()
Exemplo n.º 2
0
	def msgboxCb(self, result):
		if result == 0:
			smstack.add(SMStack.UPDATE, "")
			api = SAPCL()
			firmwares = api.getUsbFirmwares(self.device.getPackage())
			for firmware in firmwares["firmwares"]:
				if not fileExists("/usr/lib/opkg/info/%s.control" % firmware["firmware-name"]):
					smstack.add(SMStack.INSTALL, firmware["firmware-name"])
			smstack.add(SMStack.INSTALL_WITH_REBOOT, self.device.getPackage())
			self.device.setStatus(3)	# mark as installed
			
			# if necessary open usbdevices view
			found = False
			for dialog in self.session.dialog_stack:
				if isinstance(dialog, UsbDevices):
					found = True
					break
			if not found:
				self.session.open(UsbDevices)
		elif result == 1:
			self.device.setStatus(1)	# mark as "ask again"
		elif result == 2:
			self.device.setStatus(2)	# mark as "never ask again"
		
		if self.callback:
			self.callback(self)
Exemplo n.º 3
0
 def green(self):
     index = self["menu"].getIndex()
     if not self.installed[index]:
         if self.daemons[index][9]:
             smstack.add(SMStack.INSTALL, self.daemons[index][9])
             self.session.openWithCallback(self.drawList, SMStatus)
Exemplo n.º 4
0
	def green(self):
		index = self["menu"].getIndex()
		if not self.installed[index]:
			if self.daemons[index][9]:
				smstack.add(SMStack.INSTALL, self.daemons[index][9])
				self.session.openWithCallback(self.drawList, SMStatus)