aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2005-12-17 17:13:43 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2005-12-17 17:13:43 +0000
commita377b6ea97e78df6256d23fc128c17c680574d44 (patch)
tree3c3daca669329d2848fc13e4c340cbfa8cfc0f29 /lib/python
parent7eab308715ea1130166915574e3b691e08eb4482 (diff)
downloadenigma2-a377b6ea97e78df6256d23fc128c17c680574d44.tar.gz
enigma2-a377b6ea97e78df6256d23fc128c17c680574d44.zip
some work on the wizard:
- each wizard has its own precondition now - the steps label and the step slider is hidable for each wizard - add a tutorial wizard
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Screens/Makefile.am3
-rw-r--r--lib/python/Screens/StartWizard.py11
-rw-r--r--lib/python/Screens/TutorialWizard.py37
-rw-r--r--lib/python/Screens/Wizard.py43
4 files changed, 73 insertions, 21 deletions
diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am
index 0f873d9d..15b56d41 100644
--- a/lib/python/Screens/Makefile.am
+++ b/lib/python/Screens/Makefile.am
@@ -7,4 +7,5 @@ install_PYTHON = \
Satconfig.py ScanSetup.py NetworkSetup.py Ci.py TimerEntry.py Volume.py \
EpgSelection.py EventView.py Mute.py Standby.py ServiceInfo.py \
AudioSelection.py InfoBarGenerics.py HelpMenu.py Wizard.py __init__.py \
- Dish.py SubserviceSelection.py LanguageSelection.py StartWizard.py
+ Dish.py SubserviceSelection.py LanguageSelection.py StartWizard.py \
+ TutorialWizard.py
diff --git a/lib/python/Screens/StartWizard.py b/lib/python/Screens/StartWizard.py
index 501ea6c5..56a09abe 100644
--- a/lib/python/Screens/StartWizard.py
+++ b/lib/python/Screens/StartWizard.py
@@ -1,9 +1,12 @@
from Wizard import Wizard, wizardManager
from Components.Pixmap import *
+from Components.config import configElementBoolean, config
from LanguageSelection import LanguageSelection
+config.misc.firstrun = configElementBoolean("config.misc.firstrun", 1);
+
class StartWizard(Wizard):
skin = """
<screen position="0,0" size="720,560" title="Welcome..." flags="wfNoBorder" >
@@ -28,5 +31,9 @@ class StartWizard(Wizard):
self["arrowup"] = MovingPixmap()
self["arrowup2"] = MovingPixmap()
-wizardManager.registerWizard(LanguageSelection)
-wizardManager.registerWizard(StartWizard)
+ def markDone(self):
+ config.misc.firstrun.value = 0;
+ config.misc.firstrun.save()
+
+wizardManager.registerWizard(LanguageSelection, config.misc.firstrun.value)
+wizardManager.registerWizard(StartWizard, config.misc.firstrun.value)
diff --git a/lib/python/Screens/TutorialWizard.py b/lib/python/Screens/TutorialWizard.py
new file mode 100644
index 00000000..234047d0
--- /dev/null
+++ b/lib/python/Screens/TutorialWizard.py
@@ -0,0 +1,37 @@
+from Wizard import Wizard, wizardManager
+
+from Components.config import configElementBoolean, config
+from Components.Pixmap import *
+
+from LanguageSelection import LanguageSelection
+
+
+config.misc.firstruntutorial = configElementBoolean("config.misc.firstruntutorial", 1);
+
+class TutorialWizard(Wizard):
+ skin = """
+ <screen position="0,0" size="720,560" title="Welcome..." flags="wfNoBorder" >
+ <widget name="text" position="50,100" size="440,200" font="Arial;23" />
+ <widget name="list" position="50,300" zPosition="1" size="440,200" />
+ <widget name="config" position="50,300" zPosition="1" size="440,200" transparent="1" />
+ <widget name="rc" pixmap="/usr/share/enigma2/rc.png" position="500,600" zPosition="10" size="154,475" transparent="1" alphatest="on"/>
+ <widget name="arrowdown" pixmap="/usr/share/enigma2/arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
+ <widget name="arrowup" pixmap="/usr/share/enigma2/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
+ <widget name="arrowup2" pixmap="/usr/share/enigma2/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
+ </screen>"""
+
+ def __init__(self, session):
+ self.skin = TutorialWizard.skin
+ self.xmlfile = "tutorialwizard.xml"
+
+ Wizard.__init__(self, session, showSteps=False, showStepSlider=False)
+ self["rc"] = MovingPixmap()
+ self["arrowdown"] = MovingPixmap()
+ self["arrowup"] = MovingPixmap()
+ self["arrowup2"] = MovingPixmap()
+
+ def markDone(self):
+ config.misc.firstruntutorial.value = 1;
+ config.misc.firstruntutorial.save()
+
+#wizardManager.registerWizard(TutorialWizard, config.misc.firstruntutorial.value) \ No newline at end of file
diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py
index 10bb9f50..20aa4970 100644
--- a/lib/python/Screens/Wizard.py
+++ b/lib/python/Screens/Wizard.py
@@ -6,7 +6,6 @@ from Screens.HelpMenu import HelpableScreen
from Components.Label import Label
from Components.Slider import Slider
from Components.ActionMap import HelpableActionMap, NumberActionMap
-from Components.config import config, configElementBoolean
from Components.Pixmap import *
from Components.MenuList import MenuList
from Components.ConfigList import ConfigList
@@ -14,8 +13,6 @@ from Components.ConfigList import ConfigList
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
-config.misc.firstrun = configElementBoolean("config.misc.firstrun", 1);
-
class Wizard(Screen, HelpableScreen):
class parseWizard(ContentHandler):
@@ -55,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):
+ def __init__(self, session, showSteps = True, showStepSlider = True):
Screen.__init__(self, session)
HelpableScreen.__init__(self)
@@ -65,7 +62,10 @@ class Wizard(Screen, HelpableScreen):
wizardHandler = self.parseWizard(self.wizard)
parser.setContentHandler(wizardHandler)
parser.parse('/usr/share/enigma2/' + self.xmlfile)
-
+
+ self.showSteps = showSteps
+ self.showStepSlider = showStepSlider
+
self.numSteps = len(self.wizard)
self.currStep = 1
@@ -73,9 +73,11 @@ class Wizard(Screen, HelpableScreen):
self["config"] = ConfigList([])
- self["step"] = Label()
-
- self["stepslider"] = Slider(1, self.numSteps)
+ if self.showSteps:
+ self["step"] = Label()
+
+ if self.showStepSlider:
+ self["stepslider"] = Slider(1, self.numSteps)
self.list = []
self["list"] = MenuList(self.list)
@@ -113,6 +115,9 @@ class Wizard(Screen, HelpableScreen):
self.currStep = 1
self.updateValues()
+ def markDone(self):
+ pass
+
def ok(self):
print "OK"
if (self.wizard[self.currStep]["config"]["screen"] != None):
@@ -131,8 +136,7 @@ class Wizard(Screen, HelpableScreen):
self.currStep = int(nextStep) - 1
if (self.currStep == self.numSteps): # wizard finished
- config.misc.firstrun.value = 0;
- config.misc.firstrun.save()
+ self.markDone()
self.session.close()
else:
self.currStep += 1
@@ -174,8 +178,10 @@ class Wizard(Screen, HelpableScreen):
self.condition = True
exec (self.wizard[self.currStep]["condition"])
if self.condition:
- self["step"].setText(_("Step ") + str(self.currStep) + "/" + str(self.numSteps))
- self["stepslider"].setValue(self.currStep)
+ if self.showSteps:
+ self["step"].setText(_("Step ") + str(self.currStep) + "/" + str(self.numSteps))
+ if self.showStepSlider:
+ self["stepslider"].setValue(self.currStep)
print _(self.wizard[self.currStep]["text"])
self["text"].setText(_(self.wizard[self.currStep]["text"]))
@@ -216,13 +222,14 @@ class WizardManager:
def __init__(self):
self.wizards = []
- def registerWizard(self, wizard):
- self.wizards.append(wizard)
+ def registerWizard(self, wizard, precondition):
+ self.wizards.append((wizard, precondition))
def getWizards(self):
- if config.misc.firstrun.value:
- return self.wizards
- else:
- return []
+ list = []
+ for x in self.wizards:
+ if x[1] == 1: # precondition
+ list.append(x[0])
+ return list
wizardManager = WizardManager()