some work on the wizard:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Sat, 17 Dec 2005 17:13:43 +0000 (17:13 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Sat, 17 Dec 2005 17:13:43 +0000 (17:13 +0000)
- each wizard has its own precondition now
- the steps label and the step slider is hidable for each wizard
- add a tutorial wizard

data/tutorialwizard.xml [new file with mode: 0644]
lib/python/Screens/Makefile.am
lib/python/Screens/StartWizard.py
lib/python/Screens/TutorialWizard.py [new file with mode: 0644]
lib/python/Screens/Wizard.py
mytest.py
po/de.po

diff --git a/data/tutorialwizard.xml b/data/tutorialwizard.xml
new file mode 100644 (file)
index 0000000..f48812d
--- /dev/null
@@ -0,0 +1,5 @@
+<wizard>
+               <step number="1">
+                       <text value="Your dreambox is a very powerful digital receiver." />
+               </step>
+</wizard>
index 0f873d9..15b56d4 100644 (file)
@@ -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
index 501ea6c..56a09ab 100644 (file)
@@ -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 (file)
index 0000000..234047d
--- /dev/null
@@ -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
index 10bb9f5..20aa497 100644 (file)
@@ -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()
index 242f19e..571747c 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -18,6 +18,7 @@ from skin import readSkin, applyAllAttributes
 from Components.config import configfile
 from Screens.Wizard import wizardManager
 from Screens.StartWizard import *
+from Screens.TutorialWizard import *
 from Tools.BoundFunction import boundFunction
 
 had = dict()
index 605e764..6c27c5d 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: tuxbox-enigma 0.0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-12-17 01:09+0100\n"
+"POT-Creation-Date: 2005-12-17 17:40+0100\n"
 "PO-Revision-Date: 2005-12-14 03:29+0100\n"
 "Last-Translator: Stefan Pluecken <stefan.pluecken@multimedia-labs.de>\n"
 "Language-Team: none\n"
@@ -19,13 +19,13 @@ msgstr ""
 "X-Poedit-Country: GERMANY\n"
 "X-Poedit-SourceCharset: iso-8859-15\n"
 
-#: ../lib/python/Screens/EventView.py:89
+#: ../lib/python/Screens/EventView.py:72
 #, python-format
 msgid "%d min"
 msgstr ""
 
-#: ../lib/python/Screens/TimerEntry.py:85
-#: ../lib/python/Screens/TimerEntry.py:88
+#: ../lib/python/Screens/TimerEntry.py:86
+#: ../lib/python/Screens/TimerEntry.py:89
 msgid "%d.%B %Y"
 msgstr ""
 
@@ -43,6 +43,7 @@ msgid "All"
 msgstr "Alle"
 
 #: ../lib/python/Screens/ScanSetup.py:170
+#: ../lib/python/Screens/ScanSetup.py:173
 #: ../lib/python/Screens/ScanSetup.py:177
 #: ../lib/python/Screens/ScanSetup.py:178
 #: ../lib/python/Screens/ScanSetup.py:179
@@ -77,7 +78,7 @@ msgstr "Kabelanbieter"
 msgid "Capacity: "
 msgstr "Kapazität: "
 
-#: ../lib/python/Screens/TimerEntry.py:168 ../data/
+#: ../lib/python/Screens/TimerEntry.py:170 ../data/
 msgid "Channel"
 msgstr "Kanal"
 
@@ -113,7 +114,7 @@ msgstr "Standard"
 msgid "Delete"
 msgstr "Löschen"
 
-#: ../lib/python/Screens/TimerEntry.py:129
+#: ../lib/python/Screens/TimerEntry.py:131
 msgid "Description"
 msgstr "Beschreibung"
 
@@ -149,7 +150,7 @@ msgstr "DiSEqC-Modus"
 msgid "Disable"
 msgstr "Aus"
 
-#: ../lib/python/Screens/InfoBarGenerics.py:625
+#: ../lib/python/Screens/InfoBarGenerics.py:633
 msgid ""
 "Do you want to stop the current\n"
 "(instant) recording?"
@@ -178,11 +179,11 @@ msgstr "Ost"
 msgid "Enable"
 msgstr "Ein"
 
-#: ../lib/python/Screens/TimerEntry.py:163
+#: ../lib/python/Screens/TimerEntry.py:165
 msgid "End"
 msgstr "Ende"
 
-#: ../lib/python/Screens/TimerEntry.py:166
+#: ../lib/python/Screens/TimerEntry.py:168
 msgid "EndTime"
 msgstr "Endzeit"
 
@@ -204,12 +205,12 @@ msgstr "Favoriten"
 #: ../lib/python/Screens/ScanSetup.py:87
 #: ../lib/python/Screens/ScanSetup.py:114
 #: ../lib/python/Screens/ScanSetup.py:124
-#: ../lib/python/Screens/TimerEntry.py:136
+#: ../lib/python/Screens/TimerEntry.py:138
 msgid "Frequency"
 msgstr "Frequenz"
 
-#: ../lib/python/Screens/TimerEntry.py:91
-#: ../lib/python/Screens/TimerEntry.py:150
+#: ../lib/python/Screens/TimerEntry.py:92
+#: ../lib/python/Screens/TimerEntry.py:152
 msgid "Friday"
 msgstr "Freitag"
 
@@ -273,12 +274,12 @@ msgstr "Modell:"
 msgid "Modulation"
 msgstr ""
 
-#: ../lib/python/Screens/TimerEntry.py:83
+#: ../lib/python/Screens/TimerEntry.py:84
 msgid "Mon-Fri"
 msgstr "Montag bis Freitag"
 
-#: ../lib/python/Screens/TimerEntry.py:91
-#: ../lib/python/Screens/TimerEntry.py:146
+#: ../lib/python/Screens/TimerEntry.py:92
+#: ../lib/python/Screens/TimerEntry.py:148
 msgid "Monday"
 msgstr "Montag"
 
@@ -286,6 +287,10 @@ msgstr "Montag"
 msgid "N/A"
 msgstr "Nicht verfügbar"
 
+#: ../lib/python/Screens/TimerEntry.py:130
+msgid "Name"
+msgstr ""
+
 #: ../lib/python/Screens/NetworkSetup.py:46 ../data/
 msgid "Nameserver"
 msgstr ""
@@ -294,6 +299,7 @@ msgstr ""
 msgid "Netmask"
 msgstr "Netzmaske"
 
+#: ../lib/python/Screens/ScanSetup.py:173
 #: ../lib/python/Screens/ScanSetup.py:179
 #: ../lib/python/Screens/ScanSetup.py:186
 #: ../lib/python/Screens/ScanSetup.py:187
@@ -353,7 +359,7 @@ msgstr "Zum Starten der Suche OK drücken."
 msgid "Provider"
 msgstr "Provider"
 
-#: ../lib/python/Screens/InfoBarGenerics.py:682
+#: ../lib/python/Screens/InfoBarGenerics.py:690
 msgid "Record"
 msgstr "Aufnahme"
 
@@ -366,12 +372,12 @@ msgstr "Satellit"
 msgid "Satellites"
 msgstr "Satelliten"
 
-#: ../lib/python/Screens/TimerEntry.py:91
-#: ../lib/python/Screens/TimerEntry.py:151
+#: ../lib/python/Screens/TimerEntry.py:92
+#: ../lib/python/Screens/TimerEntry.py:153
 msgid "Saturday"
 msgstr "Samstag"
 
-#: ../lib/python/Screens/TimerEntry.py:206
+#: ../lib/python/Screens/TimerEntry.py:208
 msgid "Select channel to record from"
 msgstr "Kanal auswahlen, von dem aufgenommen werden soll"
 
@@ -395,19 +401,19 @@ msgstr "Sockel "
 msgid "South"
 msgstr "Süd"
 
-#: ../lib/python/Screens/TimerEntry.py:158
+#: ../lib/python/Screens/TimerEntry.py:160
 msgid "Start"
 msgstr ""
 
-#: ../lib/python/Screens/InfoBarGenerics.py:627
+#: ../lib/python/Screens/InfoBarGenerics.py:635
 msgid "Start recording?"
 msgstr "Aufnahme beginnen?"
 
-#: ../lib/python/Screens/TimerEntry.py:161
+#: ../lib/python/Screens/TimerEntry.py:163
 msgid "StartTime"
 msgstr "Startzeit"
 
-#: ../lib/python/Screens/Wizard.py:178
+#: ../lib/python/Screens/Wizard.py:177
 msgid "Step "
 msgstr "Schritt "
 
@@ -415,12 +421,12 @@ msgstr "Schritt "
 msgid "Stop playing this movie?"
 msgstr "Das Abspielen dieses Films beenden?"
 
-#: ../lib/python/Screens/InfoBarGenerics.py:688 ../data/
+#: ../lib/python/Screens/InfoBarGenerics.py:696 ../data/
 msgid "Subservices"
 msgstr "Unterkanäle"
 
-#: ../lib/python/Screens/TimerEntry.py:91
-#: ../lib/python/Screens/TimerEntry.py:152
+#: ../lib/python/Screens/TimerEntry.py:92
+#: ../lib/python/Screens/TimerEntry.py:154
 msgid "Sunday"
 msgstr "Sonntag"
 
@@ -433,12 +439,12 @@ msgstr "Symbolrate"
 msgid "Terrestrial provider"
 msgstr "Region"
 
-#: ../lib/python/Screens/TimerEntry.py:91
-#: ../lib/python/Screens/TimerEntry.py:149
+#: ../lib/python/Screens/TimerEntry.py:92
+#: ../lib/python/Screens/TimerEntry.py:151
 msgid "Thursday"
 msgstr "Donnerstag"
 
-#: ../lib/python/Screens/TimerEntry.py:130
+#: ../lib/python/Screens/TimerEntry.py:132
 msgid "Timer Type"
 msgstr "Timer-Art"
 
@@ -450,8 +456,8 @@ msgstr "Toneburst A/B"
 msgid "Transmission mode"
 msgstr "Übertragungstyp"
 
-#: ../lib/python/Screens/TimerEntry.py:91
-#: ../lib/python/Screens/TimerEntry.py:147
+#: ../lib/python/Screens/TimerEntry.py:92
+#: ../lib/python/Screens/TimerEntry.py:149
 msgid "Tuesday"
 msgstr "Dienstag"
 
@@ -484,12 +490,12 @@ msgstr ""
 msgid "Use DHCP"
 msgstr "Adresse automatisch beziehen (DHCP)"
 
-#: ../lib/python/Screens/TimerEntry.py:91
-#: ../lib/python/Screens/TimerEntry.py:148
+#: ../lib/python/Screens/TimerEntry.py:92
+#: ../lib/python/Screens/TimerEntry.py:150
 msgid "Wednesday"
 msgstr "Mittwoch"
 
-#: ../lib/python/Screens/TimerEntry.py:143
+#: ../lib/python/Screens/TimerEntry.py:145
 msgid "Weekday"
 msgstr "Wochentag"
 
@@ -517,7 +523,7 @@ msgstr ""
 msgid "circular right"
 msgstr ""
 
-#: ../lib/python/Screens/TimerEntry.py:83
+#: ../lib/python/Screens/TimerEntry.py:84
 msgid "daily"
 msgstr "täglich"
 
@@ -558,7 +564,7 @@ msgid "next channel"
 msgstr "nächster Kanal"
 
 #: ../lib/python/Screens/ScanSetup.py:196
-#: ../lib/python/Screens/TimerEntry.py:95
+#: ../lib/python/Screens/TimerEntry.py:96
 #: ../lib/python/Components/Network.py:140
 msgid "no"
 msgstr "nein"
@@ -620,15 +626,15 @@ msgstr "Status"
 msgid "show EPG..."
 msgstr "zeige EPG..."
 
-#: ../lib/python/Screens/Wizard.py:181 ../lib/python/Screens/Wizard.py:182
+#: ../lib/python/Screens/Wizard.py:180 ../lib/python/Screens/Wizard.py:181
 msgid "text"
 msgstr ""
 
-#: ../lib/python/Screens/EventView.py:73
+#: ../lib/python/Screens/EventView.py:56
 msgid "unknown service"
 msgstr "unbekannter Service"
 
-#: ../lib/python/Screens/TimerEntry.py:83
+#: ../lib/python/Screens/TimerEntry.py:84
 msgid "user defined"
 msgstr "benutzerdefiniert"
 
@@ -636,12 +642,12 @@ msgstr "benutzerdefiniert"
 msgid "vertical"
 msgstr "vertikal"
 
-#: ../lib/python/Screens/TimerEntry.py:83
+#: ../lib/python/Screens/TimerEntry.py:84
 msgid "weekly"
 msgstr "wöchentlich"
 
 #: ../lib/python/Screens/ScanSetup.py:196
-#: ../lib/python/Screens/TimerEntry.py:95
+#: ../lib/python/Screens/TimerEntry.py:96
 #: ../lib/python/Components/Network.py:15
 #: ../lib/python/Components/Network.py:140
 msgid "yes"
@@ -1106,4 +1112,3 @@ msgstr ""
 #: ../data/
 msgid "Satelliteconfig"
 msgstr "Satelliteneinstellungen"
-