From d19d18a79e0352485851e372442d2ae87dbbd171 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 3 Sep 2009 14:30:40 +0200 Subject: Add 0 to NumericalTextInputHelpDialog. Check your plugins if the larger help matrix still fits into your screens. --- lib/python/Screens/NumericalTextInputHelpDialog.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/NumericalTextInputHelpDialog.py b/lib/python/Screens/NumericalTextInputHelpDialog.py index e0979587..de8e8d66 100644 --- a/lib/python/Screens/NumericalTextInputHelpDialog.py +++ b/lib/python/Screens/NumericalTextInputHelpDialog.py @@ -4,13 +4,15 @@ from Components.Label import Label class NumericalTextInputHelpDialog(Screen): def __init__(self, session, textinput): Screen.__init__(self, session) - for x in (1, 2, 3, 4, 5, 6, 7, 8, 9): + self["help1"] = Label(text="<") + self["help2"] = Label(text=">") + for x in (1, 2, 3, 4, 5, 6, 7, 8, 9, 0): self["key%d" % x] = Label(text=textinput.mapping[x].encode("utf-8")) self.last_marked = 0 def update(self, textinput): - if 1 <= self.last_marked <= 9: + if 0 <= self.last_marked <= 9: self["key%d" % self.last_marked].setMarkedPos(-1) - if 1 <= textinput.lastKey <= 9: + if 0 <= textinput.lastKey <= 9: self["key%d" % textinput.lastKey].setMarkedPos(textinput.pos) self.last_marked = textinput.lastKey -- cgit v1.2.3 From 2387b343fc5e7147cf6e5f00afefb8a4fca4e475 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Thu, 3 Sep 2009 14:34:03 +0200 Subject: fix exec-begin after timer stop --- lib/python/Screens/MessageBox.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/python/Screens/MessageBox.py b/lib/python/Screens/MessageBox.py index 10485680..86bf07d3 100644 --- a/lib/python/Screens/MessageBox.py +++ b/lib/python/Screens/MessageBox.py @@ -88,6 +88,7 @@ class MessageBox(Screen): def stopTimer(self): if self.timerRunning: del self.timer + self.onExecBegin.remove(self.startTimer) self.setTitle(self.origTitle) self.timerRunning = False -- cgit v1.2.3 From 53a6eecb41d1a7f0f926eb5bc0dd7322580f0e0c Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 3 Sep 2009 15:05:18 +0200 Subject: allow exiting wizards with exit key if there is no step history (i.e. user is in the first step of the wizard) --- lib/python/Screens/Wizard.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 555110a4..6833c525 100755 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -1,6 +1,7 @@ from Screen import Screen from Screens.HelpMenu import HelpableScreen +from Screens.MessageBox import MessageBox from Components.config import config, KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS from Components.Label import Label @@ -284,6 +285,8 @@ class Wizard(Screen): if len(self.stepHistory) > 1: self.currStep = self.stepHistory[-2] self.stepHistory = self.stepHistory[:-2] + else: + self.session.openWithCallback(self.exitWizardQuestion, MessageBox, (_("Are you sure you want to exit this wizard?") ) ) if self.currStep < 1: self.currStep = 1 print "currStep:", self.currStep @@ -291,6 +294,11 @@ class Wizard(Screen): self.updateValues() print "after updateValues stepHistory:", self.stepHistory + def exitWizardQuestion(self, ret = False): + if (ret): + self.markDone() + self.close() + def markDone(self): pass -- cgit v1.2.3 From a053f35db7edbd467bf01b9054d90dad3ce12803 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 3 Sep 2009 16:25:07 +0200 Subject: allow skipping of end screens in wizards just add self.condition = self.isLastWizard to the last screen in your wizard furthermore you need to update the -tag of your last step according to the following example: ... --- data/startwizard.xml | 5 ++++- lib/python/Screens/Wizard.py | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/data/startwizard.xml b/data/startwizard.xml index 8fcf8f41..c004a5e6 100644 --- a/data/startwizard.xml +++ b/data/startwizard.xml @@ -160,7 +160,10 @@ config.ParentalControl.setuppin.save() - + + +self.condition = self.isLastWizard + diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 6833c525..74219eb1 100755 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -85,6 +85,8 @@ class Wizard(Screen): else: timeoutstep = '' self.wizard[self.lastStep] = {"id": id, "condition": "", "text": "", "timeout": timeout, "timeoutaction": timeoutaction, "timeoutstep": timeoutstep, "list": [], "config": {"screen": None, "args": None, "type": "" }, "code": "", "codeafter": "", "code_async": "", "codeafter_async": "", "nextstep": nextstep} + if attrs.has_key('laststep'): + self.wizard[self.lastStep]["laststep"] = str(attrs.get('laststep')) elif (name == "text"): self.wizard[self.lastStep]["text"] = str(attrs.get('value')).replace("\\n", "\n") elif (name == "displaytext"): @@ -163,6 +165,8 @@ class Wizard(Screen): def __init__(self, session, showSteps = True, showStepSlider = True, showList = True, showConfig = True): Screen.__init__(self, session) + + self.isLastWizard = False # can be used to skip a "goodbye"-screen in a wizard self.stepHistory = [] @@ -480,8 +484,14 @@ class Wizard(Screen): self.condition = True exec (self.wizard[self.currStep]["condition"]) if not self.condition: - self.currStep += 1 - self.updateValues() + print "keys*******************:", self.wizard[self.currStep].keys() + if self.wizard[self.currStep].has_key("laststep"): # exit wizard, if condition of laststep doesn't hold + self.markDone() + self.close() + return + else: + self.currStep += 1 + self.updateValues() else: if self.wizard[self.currStep].has_key("displaytext"): displaytext = self.wizard[self.currStep]["displaytext"] @@ -613,6 +623,10 @@ class WizardManager: def getWizards(self): # x[1] is precondition + for wizard in self.wizards: + wizard[0].isLastWizard = False + if len(self.wizards) > 0: + self.wizards[-1][0].isLastWizard = True return [(x[2], x[0]) for x in self.wizards if x[1] == 1] wizardManager = WizardManager() -- cgit v1.2.3