From: Stefan Pluecken Date: Sat, 17 Dec 2005 17:34:16 +0000 (+0000) Subject: add ability to remove list and config from a wizard X-Git-Tag: 2.6.0~4677 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/1e1c01fece5a4a86a762af265e382da5dbb2d8cb?ds=sidebyside add ability to remove list and config from a wizard --- diff --git a/lib/python/Screens/TutorialWizard.py b/lib/python/Screens/TutorialWizard.py index 234047d0..2d30b012 100644 --- a/lib/python/Screens/TutorialWizard.py +++ b/lib/python/Screens/TutorialWizard.py @@ -12,8 +12,6 @@ class TutorialWizard(Wizard): skin = """ - - @@ -24,7 +22,7 @@ class TutorialWizard(Wizard): self.skin = TutorialWizard.skin self.xmlfile = "tutorialwizard.xml" - Wizard.__init__(self, session, showSteps=False, showStepSlider=False) + Wizard.__init__(self, session, showSteps=False, showStepSlider=False, showList=False, showConfig=False) self["rc"] = MovingPixmap() self["arrowdown"] = MovingPixmap() self["arrowup"] = MovingPixmap() diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 20aa4970..d652ec21 100644 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -52,7 +52,7 @@ class Wizard(Screen, HelpableScreen): self.wizard[self.lastStep]["code"] = self.wizard[self.lastStep]["code"] + ch elif self.currContent == "condition": self.wizard[self.lastStep]["condition"] = self.wizard[self.lastStep]["condition"] + ch - def __init__(self, session, showSteps = True, showStepSlider = True): + def __init__(self, session, showSteps = True, showStepSlider = True, showList = True, showConfig = True): Screen.__init__(self, session) HelpableScreen.__init__(self) @@ -65,13 +65,16 @@ class Wizard(Screen, HelpableScreen): self.showSteps = showSteps self.showStepSlider = showStepSlider + self.showList = showList + self.showConfig = showConfig self.numSteps = len(self.wizard) self.currStep = 1 self["text"] = Label() - self["config"] = ConfigList([]) + if showConfig: + self["config"] = ConfigList([]) if self.showSteps: self["step"] = Label() @@ -79,8 +82,9 @@ class Wizard(Screen, HelpableScreen): if self.showStepSlider: self["stepslider"] = Slider(1, self.numSteps) - self.list = [] - self["list"] = MenuList(self.list) + if self.showList: + self.list = [] + self["list"] = MenuList(self.list) self.onShown.append(self.updateValues) @@ -120,20 +124,22 @@ class Wizard(Screen, HelpableScreen): def ok(self): print "OK" - if (self.wizard[self.currStep]["config"]["screen"] != None): - try: # don't die, if no run() is available - self.configInstance.run() - except: - print "Failed to run configInstance" + if self.showConfig: + if (self.wizard[self.currStep]["config"]["screen"] != None): + try: # don't die, if no run() is available + self.configInstance.run() + except: + print "Failed to run configInstance" - if (len(self.wizard[self.currStep]["list"]) > 0): - nextStep = self.wizard[self.currStep]["list"][self["list"].l.getCurrentSelectionIndex()][1] - if nextStep == "end": - self.currStep = self.numSteps - elif nextStep == "next": - pass - else: - self.currStep = int(nextStep) - 1 + if self.showList: + if (len(self.wizard[self.currStep]["list"]) > 0): + nextStep = self.wizard[self.currStep]["list"][self["list"].l.getCurrentSelectionIndex()][1] + if nextStep == "end": + self.currStep = self.numSteps + elif nextStep == "next": + pass + else: + self.currStep = int(nextStep) - 1 if (self.currStep == self.numSteps): # wizard finished self.markDone() @@ -159,16 +165,16 @@ class Wizard(Screen, HelpableScreen): print "right" def up(self): - if (self.wizard[self.currStep]["config"]["screen"] != None): - self["config"].instance.moveSelection(self["config"].instance.moveUp) - elif (len(self.wizard[self.currStep]["list"]) > 0): + if (self.showConfig and self.wizard[self.currStep]["config"]["screen"] != None): + self["config"].instance.moveSelection(self["config"].instance.moveUp) + elif (self.showList and len(self.wizard[self.currStep]["list"]) > 0): self["list"].instance.moveSelection(self["list"].instance.moveUp) print "up" def down(self): - if (self.wizard[self.currStep]["config"]["screen"] != None): + if (self.showConfig and self.wizard[self.currStep]["config"]["screen"] != None): self["config"].instance.moveSelection(self["config"].instance.moveDown) - elif (len(self.wizard[self.currStep]["list"]) > 0): + elif (self.showList and len(self.wizard[self.currStep]["list"]) > 0): self["list"].instance.moveSelection(self["list"].instance.moveDown) print "down" @@ -190,30 +196,32 @@ class Wizard(Screen, HelpableScreen): print self.wizard[self.currStep]["code"] exec(self.wizard[self.currStep]["code"]) - self["list"].instance.setZPosition(1) - self.list = [] - if (len(self.wizard[self.currStep]["list"]) > 0): - self["list"].instance.setZPosition(2) - for x in self.wizard[self.currStep]["list"]: - self.list.append((_(x[0]), None)) - self["list"].l.setList(self.list) + if self.showList: + self["list"].instance.setZPosition(1) + self.list = [] + if (len(self.wizard[self.currStep]["list"]) > 0): + self["list"].instance.setZPosition(2) + for x in self.wizard[self.currStep]["list"]: + self.list.append((_(x[0]), None)) + self["list"].l.setList(self.list) - self["config"].instance.setZPosition(1) - if (self.wizard[self.currStep]["config"]["screen"] != None): - if self.wizard[self.currStep]["config"]["type"] == "standalone": - print "Type is standalone" - self.session.openWithCallback(self.ok, self.wizard[self.currStep]["config"]["screen"]) - else: - self["config"].instance.setZPosition(2) - print self.wizard[self.currStep]["config"]["screen"] - if self.wizard[self.currStep]["config"]["args"] == None: - self.configInstance = self.session.instantiateDialog(self.wizard[self.currStep]["config"]["screen"]) + if self.showConfig: + self["config"].instance.setZPosition(1) + if (self.wizard[self.currStep]["config"]["screen"] != None): + if self.wizard[self.currStep]["config"]["type"] == "standalone": + print "Type is standalone" + self.session.openWithCallback(self.ok, self.wizard[self.currStep]["config"]["screen"]) else: - self.configInstance = self.session.instantiateDialog(self.wizard[self.currStep]["config"]["screen"], eval(self.wizard[self.currStep]["config"]["args"])) - self["config"].l.setList(self.configInstance["config"].list) - self.configInstance["config"] = self["config"] - else: - self["config"].l.setList([]) + self["config"].instance.setZPosition(2) + print self.wizard[self.currStep]["config"]["screen"] + if self.wizard[self.currStep]["config"]["args"] == None: + self.configInstance = self.session.instantiateDialog(self.wizard[self.currStep]["config"]["screen"]) + else: + self.configInstance = self.session.instantiateDialog(self.wizard[self.currStep]["config"]["screen"], eval(self.wizard[self.currStep]["config"]["args"])) + self["config"].l.setList(self.configInstance["config"].list) + self.configInstance["config"] = self["config"] + else: + self["config"].l.setList([]) else: # condition false self.currStep += 1 self.updateValues()