def getImageListCallback(self, imageDictionary): self.getImageList = None currentSlotCode = MultiBoot.getCurrentSlotCode() print("[FlashManager] Current image slot is '%s'." % currentSlotCode) choices = [] default = 0 for index, slotCode in enumerate(sorted(imageDictionary.keys())): print("[FlashManager] Image Slot '%s': %s." % (slotCode, str(imageDictionary[slotCode]))) if slotCode == currentSlotCode: choices.append( (_("Slot '%s': %s - Current") % (slotCode, imageDictionary[slotCode]["imagename"]), (slotCode, True))) default = index else: choices.append( (_("Slot '%s': %s") % (slotCode, imageDictionary[slotCode]["imagename"]), (slotCode, True))) choices.append((_("No, don't flash this image"), False)) self.session.openWithCallback( self.checkMedia, MessageBox, _("Do you want to flash the image '%s'?") % self.imageName, list=choices, default=default, windowTitle=self.getTitle())
def selectionChanged(self): slotCode = MultiBoot.getCurrentSlotCode() currentSelected = self["slotlist"].l.getCurrentSelection()[0] slot = currentSelected[1][0] status = currentSelected[1][2] ubi = currentSelected[1][3] current = currentSelected[1][4] if slot == slotCode or status in ("android", "androidlinuxse", "recovery"): self["key_green"].setText(_("Reboot")) self["key_yellow"].setText("") self["key_blue"].setText("") self["restartActions"].setEnabled(True) self["deleteActions"].setEnabled(False) self["restoreActions"].setEnabled(False) elif status == "unknown": self["key_green"].setText("") self["key_yellow"].setText("") self["key_blue"].setText("") self["restartActions"].setEnabled(False) self["deleteActions"].setEnabled(False) self["restoreActions"].setEnabled(False) elif status == "empty": self["key_green"].setText("") self["key_yellow"].setText("") self["key_blue"].setText(_("Restore")) self["restartActions"].setEnabled(False) self["deleteActions"].setEnabled(False) self["restoreActions"].setEnabled(True) elif ubi: self["key_green"].setText(_("Reboot")) self["key_yellow"].setText(_("Wipe")) self["key_blue"].setText("") self["restartActions"].setEnabled(True) self["deleteActions"].setEnabled(True) self["restoreActions"].setEnabled(False) else: self["key_green"].setText(_("Reboot")) self["key_yellow"].setText(_("Delete")) self["key_blue"].setText("") self["restartActions"].setEnabled(True) self["deleteActions"].setEnabled(True) self["restoreActions"].setEnabled(False)
def getImagelistCallback(self, imagedict): self.getImageList = None choices = [] for item in imagedict.copy(): if not item.isdecimal(): imagedict.pop(item) currentimageslot = int(MultiBoot.getCurrentSlotCode()) print("[FlashOnline] Current image slot %s." % currentimageslot) for slotCode in imagedict.keys(): print("[FlashOnline] Image Slot %s: %s" % (slotCode, str(imagedict))) choices.append( ((_("slot%s - %s (current image)") if slotCode == currentimageslot else _("slot%s - %s")) % (slotCode, imagedict[slotCode]['imagename']), (slotCode, True))) choices.append((_("No, do not flash an image"), False)) self.session.openWithCallback(self.checkMedia, MessageBox, self.message, list=choices, default=currentimageslot, simple=True)