introduce the movingPixmap and use it to position the arrow in the start-wizard ...
[enigma2.git] / lib / python / Screens / Wizard.py
1 from Screen import Screen
2
3 from Screens.HelpMenu import HelpableScreen
4 from Components.Label import Label
5 from Components.Slider import Slider
6 from Components.ActionMap import HelpableActionMap
7 from Components.config import config, configElementBoolean
8 from Components.Pixmap import *
9
10 config.misc.firstrun = configElementBoolean("config.misc.firstrun", 1);
11
12 class WelcomeWizard(Screen, HelpableScreen):
13
14         skin = """
15                 <screen position="0,0" size="720,560" title="Welcome..." flags="wfNoBorder" >
16                         <widget name="text" position="50,100" size="440,300" font="Arial;23" />
17                         <widget name="step" position="50,50" size="440,25" font="Arial;23" />
18                         <widget name="stepslider" position="50,500" zPosition="1" size="440,20" backgroundColor="dark" />
19                         <widget name="rc" pixmap="/usr/share/enigma2/rc.png" position="500,50" size="154,475" transparent="1" alphatest="on"/>
20                         <widget name="arrowdown" pixmap="/usr/share/enigma2/arrowdown.png" position="0,0" zPosition="1" size="37,70" transparent="1" alphatest="on"/>
21                 </screen>"""
22                 
23         text = [_("Hello User.\n\nThis start-wizard will guide you through the basic setup of your Dreambox."), 
24                         _("Bla"),
25                         _("Blub")]
26
27         def __init__(self, session):
28                 self.skin = WelcomeWizard.skin
29                 self.numSteps = 3
30                 self.currStep = 1
31
32                 Screen.__init__(self, session)
33                 HelpableScreen.__init__(self)
34
35
36                 self["text"] = Label()
37                 self["rc"] = Pixmap()
38                 self["arrowdown"] = MovingPixmap()
39                 self["arrowdown"].moveTo(557, 232, 100)
40                 
41                 self.onShown.append(self["arrowdown"].startMoving)
42
43                 self["step"] = Label()
44                                 
45                 self["stepslider"] = Slider(1, self.numSteps)
46
47                 self.updateValues()
48                 
49                 self["actions"] = HelpableActionMap(self, "OkCancelActions",
50                         {
51                                 "ok": (self.ok, _("Close this Screen...")),
52                         })
53
54         def updateValues(self):
55                 self["text"].setText(self.text[self.currStep - 1])
56                 self["step"].setText(_("Step ") + str(self.currStep) + "/" + str(self.numSteps))
57                 self["stepslider"].setValue(self.currStep)
58                 
59         def ok(self):
60                 if (self.currStep == self.numSteps): # wizard finished
61                         config.misc.firstrun.value = 0;
62                         config.misc.firstrun.save()
63                         self.session.close()
64                 else:
65                         self.currStep += 1
66                         self.updateValues()
67
68 def listActiveWizards():
69         wizards = [ ]
70
71         if config.misc.firstrun.value:
72                 wizards.append(WelcomeWizard)
73         
74         return wizards