From 53a6eecb41d1a7f0f926eb5bc0dd7322580f0e0c Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 3 Sep 2009 15:05:18 +0200 Subject: [PATCH] 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(+) 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 -- 2.30.2