def ImageList(self): imagedict = getImagelist() self.saveImageList = imagedict list = [] currentimageslot = getCurrentImage() or 1 print "[Image Backup] Current Image Slot %s, Imagelist %s" % ( currentimageslot, imagedict) if imagedict: for x in sorted(imagedict.keys()): if imagedict[x]["imagename"] != _("Empty slot"): if x == 1 and currentimageslot == 1 and SystemInfo[ "canRecovery"]: list.append( ChoiceEntryComponent( '', (_("slot%s - %s as USB Recovery") % (x, imagedict[x]["imagename"]), x, True))) list.append( ChoiceEntryComponent( '', ((_("slot%s - %s (current image)") if x == currentimageslot else _("slot%s - %s")) % (x, imagedict[x]["imagename"]), x, False))) else: if SystemInfo["canRecovery"]: list.append( ChoiceEntryComponent( '', (_("internal flash: %s %s as USB Recovery") % (getImageDistro(), getImageVersion()), "x", True))) list.append( ChoiceEntryComponent( '', (_("internal flash: %s %s ") % (getImageDistro(), getImageVersion()), "x", False))) self["config"].setList(list)
def getImagesList(self): list = [] imagesList = getImagelist() mode = getCurrentImageMode() or 0 self.deletedImagesExists = False if imagesList: for index, x in enumerate(sorted(imagesList.keys())): if imagesList[x]["imagename"] == _("Deleted image"): self.deletedImagesExists = True elif imagesList[x]["imagename"] != _("Empty slot"): if SystemInfo["canMode12"]: list.insert( index, ChoiceEntryComponent( '', ((_("slot%s - %s mode 1 (current image)") if x == self.currentimageslot and mode != 12 else _("slot%s - %s mode 1")) % (x, imagesList[x]['imagename']), (x, 1)))) list.append( ChoiceEntryComponent( '', ((_("slot%s - %s mode 12 (current image)") if x == self.currentimageslot and mode == 12 else _("slot%s - %s mode 12")) % (x, imagesList[x]['imagename']), (x, 12)))) else: list.append( ChoiceEntryComponent( '', ((_("slot%s - %s (current image)") if x == self.currentimageslot and mode != 12 else _("slot%s - %s")) % (x, imagesList[x]['imagename']), (x, 1)))) if os.path.isfile(os.path.join(self.tmp_dir, "STARTUP_RECOVERY")): list.append( ChoiceEntryComponent( '', ((_("Boot to Recovery menu")), "Recovery"))) if os.path.isfile(os.path.join(self.tmp_dir, "STARTUP_ANDROID")): list.append( ChoiceEntryComponent( '', ((_("Boot to Android image")), "Android"))) if not list: list.append( ChoiceEntryComponent('', ((_("No images found")), "Waiter"))) self["list"].setList(list) self.selectionChanged()
def confirmation(self): if self.reasons: self.message = _("%s\nDo you still want to flash image\n%s?") % (self.reasons, self.imagename) else: self.message = _("Do you want to flash image\n%s") % self.imagename if SystemInfo["canMultiBoot"]: imagesList = getImagelist() currentimageslot = getCurrentImage() choices = [] for x in range(1, len(SystemInfo["canMultiBoot"]) + 1): choices.append(((_("slot%s - %s (current image) with, backup") if x == currentimageslot else _("slot%s - %s, with backup")) % (x, imagesList[x]['imagename']), (x, "with backup"))) for x in range(1, len(SystemInfo["canMultiBoot"]) + 1): choices.append(((_("slot%s - %s (current image), without backup") if x == currentimageslot else _("slot%s - %s, without backup")) % (x, imagesList[x]['imagename']), (x, "without backup"))) choices.append((_("No, do not flash image"), False)) self.session.openWithCallback(self.checkMedia, MessageBox, self.message, list=choices, default=currentimageslot, simple=True) else: choices = [(_("Yes, with backup"), "with backup"), (_("Yes, without backup"), "without backup"), (_("No, do not flash image"), False)] self.session.openWithCallback(self.checkMedia, MessageBox, self.message , list=choices, default=False, simple=True)