X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/6f3208500f3b07aaa3733b0b47f2e7a00426ed3e..416240a4aeda1eb0f3e44abb2e1bb672665b363e:/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index 6292a46f..6463f179 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -9,6 +9,7 @@ from Components.Sources.Progress import Progress from Components.Label import Label from Components.FileList import FileList from Components.MultiContent import MultiContentEntryText +from Components.ScrollLabel import ScrollLabel from Tools.Directories import fileExists from Tools.HardwareInfo import HardwareInfo from enigma import eConsoleAppContainer, eListbox, gFont, eListboxPythonMultiContent, \ @@ -53,7 +54,7 @@ class Feedlist(MenuList): def isValid(self): l = self.l.getCurrentSelection() - if l[0] == 0: + if not l or l[0] == 0: return False else: return True @@ -62,6 +63,34 @@ class Feedlist(MenuList): if self.instance is not None: self.instance.moveSelectionTo(idx) +class NFOViewer(Screen): + skin = """ + + + """ + + def __init__(self, session, nfo): + Screen.__init__(self, session) + self["changelog"] = ScrollLabel(nfo) + + self["ViewerActions"] = ActionMap(["SetupActions", "ColorActions", "DirectionActions"], + { + "green": self.exit, + "red": self.exit, + "ok": self.exit, + "cancel": self.exit, + "down": self.pageDown, + "up": self.pageUp + }) + def pageUp(self): + self["changelog"].pageUp() + + def pageDown(self): + self["changelog"].pageDown() + + def exit(self): + self.close(False) + class NFIDownload(Screen): LIST_SOURCE = 1 LIST_DEST = 2 @@ -230,6 +259,8 @@ class NFIDownload(Screen): self["destlist"].pageDown() def ok(self): + if self.focus is self.LIST_SOURCE and self.nfo: + self.session.open(NFOViewer, self.nfo) if self.download: return if self.focus is self.LIST_DEST: @@ -249,7 +280,7 @@ class NFIDownload(Screen): def feed_finished(self, feedhtml): print "[feed_finished] " + str(feedhtml) self.downloading(False) - fileresultmask = re.compile(".*?)[\'\"]>(?P.*?.nfi)", re.DOTALL) + fileresultmask = re.compile(".*?)[\'\"]>(?P.*?.nfi)", re.DOTALL) searchresults = fileresultmask.finditer(feedhtml) fileresultlist = [] if searchresults: @@ -308,7 +339,7 @@ class NFIDownload(Screen): else: self.nfofilename = "" self["infolabel"].text = _("No details for this image file") - self["statusbar"].text = "" + self["statusbar"].text = _("Press OK to view full changelog") def nfi_download(self): if self["destlist"].getCurrentDirectory() is None: @@ -622,11 +653,11 @@ class NFIDownload(Screen): self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) def closeCB(self): - if self.download: + try: self.download.stop() #self.nfi_failed(None, "Cancelled by user request") self.downloading(False) - else: + except AttributeError: self.close() def main(session, **kwargs):