introduce the movingPixmap and use it to position the arrow in the start-wizard ...
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Wed, 7 Dec 2005 15:11:02 +0000 (15:11 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Wed, 7 Dec 2005 15:11:02 +0000 (15:11 +0000)
lib/python/Components/Pixmap.py
lib/python/Screens/Wizard.py

index 5f4b969..fc7bfe2 100644 (file)
@@ -25,3 +25,36 @@ class PixmapConditional(ConditionalWidget, Pixmap):
                ConditionalWidget.__init__(self)
                Pixmap.__init__(self)
 
+class MovingPixmap(Pixmap):
+       def __init__(self):
+               Pixmap.__init__(self)
+               
+               self.moving = False
+               
+               # TODO: get real values
+               self.x = 0.0
+               self.y = 0.0
+               
+               self.moveTimer = eTimer()
+               self.moveTimer.timeout.get().append(self.doMove)
+               
+       def moveTo(self, x, y, time = 20):
+               self.time = time
+               self.destX = x
+               self.destY = y
+               self.stepX = (self.destX - self.x) / float(time)
+               self.stepY = (self.destY - self.y) / float(time)
+               
+       def startMoving(self):
+               if not self.moving:
+                       self.moving = True
+                       self.moveTimer.start(10)
+               
+       def doMove(self):
+               self.x += self.stepX
+               self.y += self.stepY
+               self.time -= 1
+               self.move(int(self.x), int(self.y))
+               if (self.time == 0):
+                       self.moveTimer.stop()
+                       self.moving = False
\ No newline at end of file
index b199634..7c223b5 100644 (file)
@@ -5,19 +5,19 @@ from Components.Label import Label
 from Components.Slider import Slider
 from Components.ActionMap import HelpableActionMap
 from Components.config import config, configElementBoolean
-from Components.Pixmap import Pixmap
+from Components.Pixmap import *
 
 config.misc.firstrun = configElementBoolean("config.misc.firstrun", 1);
 
 class WelcomeWizard(Screen, HelpableScreen):
 
        skin = """
-               <screen position="0,0" size="720,560" title="Welcome..." flags="wfNoBorder">
+               <screen position="0,0" size="720,560" title="Welcome..." flags="wfNoBorder" >
                        <widget name="text" position="50,100" size="440,300" font="Arial;23" />
                        <widget name="step" position="50,50" size="440,25" font="Arial;23" />
                        <widget name="stepslider" position="50,500" zPosition="1" size="440,20" backgroundColor="dark" />
-                       <widget name="rc" pixmap="/usr/share/enigma2/rc.png" position="500,50" size="154,475" alphatest="on" />
-                       <widget name="arrowdown" pixmap="/usr/share/enigma2/arrowdown.png" position="557,232" zPosition="1" size="37,70" alphatest="on" />
+                       <widget name="rc" pixmap="/usr/share/enigma2/rc.png" position="500,50" size="154,475" transparent="1" alphatest="on"/>
+                       <widget name="arrowdown" pixmap="/usr/share/enigma2/arrowdown.png" position="0,0" zPosition="1" size="37,70" transparent="1" alphatest="on"/>
                </screen>"""
                
        text = [_("Hello User.\n\nThis start-wizard will guide you through the basic setup of your Dreambox."), 
@@ -35,7 +35,10 @@ class WelcomeWizard(Screen, HelpableScreen):
 
                self["text"] = Label()
                self["rc"] = Pixmap()
-               self["arrowdown"] = Pixmap()
+               self["arrowdown"] = MovingPixmap()
+               self["arrowdown"].moveTo(557, 232, 100)
+               
+               self.onShown.append(self["arrowdown"].startMoving)
 
                self["step"] = Label()