add new box depending rc visualization
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Mon, 14 Jul 2008 22:11:03 +0000 (22:11 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Mon, 14 Jul 2008 22:11:03 +0000 (22:11 +0000)
data/skin_default.xml
data/startwizard.xml
lib/python/Components/GUIComponent.py
lib/python/Screens/Rc.py [new file with mode: 0644]
lib/python/Screens/StartWizard.py

index c7f5bcce7ae1b080639c420c9c020d90f287798d..b3d102b05854121f8a4d74c012c34e40831c8fc8 100644 (file)
@@ -205,7 +205,7 @@ self.instance.move(ePoint((720-wsizex)/2, (576-wsizey)/(count &gt; 7 and 2 or 3)
                        <widget name="config" position="50,300" zPosition="1" size="440,200" transparent="1" scrollbarMode="showOnDemand" />            
                        <!--widget name="stepslider" position="50,500" zPosition="1" borderWidth="2" size="440,20" backgroundColor="dark" /-->
                        <widget name="wizard" pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
-                       <widget name="rc" pixmap="skin_default/rc.png" position="500,600" zPosition="10" size="154,475" transparent="1" alphatest="on"/>
+                       <widget name="rc" pixmap="skin_default/rc.png" position="500,600" zPosition="10" size="154,471" transparent="1" alphatest="on"/>
                        <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
                        <widget name="arrowup" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
                        <widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
@@ -220,7 +220,7 @@ self.instance.move(ePoint((720-wsizex)/2, (576-wsizey)/(count &gt; 7 and 2 or 3)
                        <widget name="config" position="50,300" zPosition="1" size="440,200" transparent="1" scrollbarMode="showOnDemand" />            
                        <!--widget name="stepslider" position="50,500" zPosition="1" borderWidth="2" size="440,20" backgroundColor="dark" /-->
                        <widget name="wizard" pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
-                       <widget name="rc" pixmap="skin_default/rc.png" position="500,600" zPosition="10" size="154,475" transparent="1" alphatest="on"/>
+                       <widget name="rc" pixmap="skin_default/rc.png" position="500,600" zPosition="10" size="154,471" transparent="1" alphatest="on"/>
                        <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
                        <widget name="arrowup" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
                        <widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
@@ -235,7 +235,7 @@ self.instance.move(ePoint((720-wsizex)/2, (576-wsizey)/(count &gt; 7 and 2 or 3)
                        <widget name="config" position="50,300" zPosition="1" size="440,200" transparent="1" scrollbarMode="showOnDemand" />            
                        <!--widget name="stepslider" position="50,500" zPosition="1" borderWidth="2" size="440,20" backgroundColor="dark" /-->
                        <widget name="wizard" pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
-                       <widget name="rc" pixmap="skin_default/rc.png" position="500,600" zPosition="10" size="154,475" transparent="1" alphatest="on"/>
+                       <widget name="rc" pixmap="skin_default/rc.png" position="500,600" zPosition="10" size="154,471" transparent="1" alphatest="on"/>
                        <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
                        <widget name="arrowup" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
                        <widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
@@ -880,8 +880,9 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y()))
                <ePixmap pixmap="skin_default/buttons/button_red.png" position="40,225" size="15,16" alphatest="on" />
                <widget name="languagetext" position="55,225" size="95,30" font="Regular;18" />
                <widget name="wizard" pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" alphatest="on" />
-               <widget name="rc" pixmap="skin_default/rc.png" position="500,600" zPosition="10" size="154,475" alphatest="on" />
-               <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="0,0" zPosition="11" size="37,70" alphatest="on" />
+               <widget name="rc" pixmaps="skin_default/rc.png,skin_default/rcold.png" position="500,50" zPosition="10" size="154,500" alphatest="on" />
+               <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+               <widget name="arrowdown2" pixmap="skin_default/arrowdown.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
                <widget name="arrowup" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
                <widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
        </screen>
index 8e054fb64f7d4e6bd022f27af8047e50e3743188..c5afe70006c87cf2eab333b830ed141a8af1255e 100644 (file)
@@ -2,12 +2,8 @@
                <step id="start" nextstep="introduction">
                        <text value="Welcome.\n\nThis start wizard will guide you through the basic setup of your Dreambox.\nPress the OK button on your remote control to move to the next step." />
                        <code>
-self["arrowdown"].moveTo(557, 232, 1)
-self["arrowdown"].startMoving()
-self["arrowup"].moveTo(800, 232, 1)
-self["arrowup"].startMoving()
-self["rc"].moveTo(500, 50, 1)
-self["rc"].startMoving()
+self.clearSelectedKeys()
+self.selectKey("OK")
                        </code>
                </step>
                <step id="introduction" >
@@ -17,14 +13,9 @@ self["rc"].startMoving()
                                <listentry caption="Exit wizard" step="end" />
                        </list>
                        <code>
-self["arrowup2"].moveTo(800, 320, 1)
-self["arrowup2"].startMoving()
-self["arrowdown"].moveTo(557, 200, 1)
-self["arrowup"].moveTo(557, 355, 1)
-self["arrowdown"].startMoving()
-self["arrowup"].startMoving()
-self["rc"].moveTo(500, 50, 1)
-self["rc"].startMoving()
+self.clearSelectedKeys()
+self.selectKey("UP")
+self.selectKey("DOWN")
                        </code>
                </step>
                <step id="nima">
@@ -35,14 +26,9 @@ self.condition = len(nimmanager.nim_slots) > 0 and not nimmanager.nim_slots[0].e
                        <text value="Use the left and right buttons to change an option.\n\nPlease set up tuner A" />
                        <config screen="NimSetup" module="Satconfig" args="0" type="ConfigList" />
                        <code>
-self["rc"].moveTo(500, 50, 1)
-self["rc"].startMoving()
-self["arrowup"].moveTo(525, 320, 1)
-self["arrowup"].startMoving()
-self["arrowup2"].moveTo(590, 320, 1)
-self["arrowup2"].startMoving()
-self["arrowdown"].moveTo(740, 355, 1)
-self["arrowdown"].startMoving()
+self.clearSelectedKeys()
+self.selectKey("LEFT")
+self.selectKey("RIGHT")
                        </code>
                </step>
                <step id="nimb">
@@ -53,14 +39,9 @@ self.condition = len(nimmanager.nim_slots) > 1 and not nimmanager.nim_slots[1].e
                        <text value="Please set up tuner B" />
                        <config screen="NimSetup" module="Satconfig" args="1" type="ConfigList" />
                        <code>
-self["rc"].moveTo(500, 50, 1)
-self["rc"].startMoving()
-self["arrowup"].moveTo(525, 320, 1)
-self["arrowup"].startMoving()
-self["arrowup2"].moveTo(590, 320, 1)
-self["arrowup2"].startMoving()
-self["arrowdown"].moveTo(740, 355, 1)
-self["arrowdown"].startMoving()
+self.clearSelectedKeys()
+self.selectKey("LEFT")
+self.selectKey("RIGHT")
                        </code>
                </step>
                <step id="nimc">
@@ -71,14 +52,9 @@ self.condition = len(nimmanager.nim_slots) > 2 and not nimmanager.nim_slots[2].e
                        <text value="Please set up tuner C" />
                        <config screen="NimSetup" module="Satconfig" args="2" type="ConfigList" />
                        <code>
-self["rc"].moveTo(500, 50, 1)
-self["rc"].startMoving()
-self["arrowup"].moveTo(525, 320, 1)
-self["arrowup"].startMoving()
-self["arrowup2"].moveTo(590, 320, 1)
-self["arrowup2"].startMoving()
-self["arrowdown"].moveTo(740, 355, 1)
-self["arrowdown"].startMoving()
+self.clearSelectedKeys()
+self.selectKey("LEFT")
+self.selectKey("RIGHT")
                        </code>
                </step>
                <step id="nimd">
@@ -89,14 +65,9 @@ self.condition = len(nimmanager.nim_slots) > 3 and not nimmanager.nim_slots[3].e
                        <text value="Please set up tuner D" />
                        <config screen="NimSetup" module="Satconfig" args="3" type="ConfigList" />
                        <code>
-self["rc"].moveTo(500, 50, 1)
-self["rc"].startMoving()
-self["arrowup"].moveTo(525, 320, 1)
-self["arrowup"].startMoving()
-self["arrowup2"].moveTo(590, 320, 1)
-self["arrowup2"].startMoving()
-self["arrowdown"].moveTo(740, 355, 1)
-self["arrowdown"].startMoving()
+self.clearSelectedKeys()
+self.selectKey("LEFT")
+self.selectKey("RIGHT")
                        </code>
                </step>
                <step id="satlistsquestion">
@@ -105,12 +76,7 @@ self["arrowdown"].startMoving()
 self.condition = config.misc.startwizard.doservicescan.value
                        </condition>
                        <code>
-self["rc"].moveTo(800, 50, 1)
-self["rc"].startMoving()
-self["arrowup"].moveTo(800, 310, 1)
-self["arrowup"].startMoving()
-self["arrowup2"].moveTo(800, 310, 1)
-self["arrowup2"].startMoving()
+self.hideRc()
                        </code>
                        <list>
                                <listentry caption="Yes" step="startdefaultlists" />
@@ -124,12 +90,7 @@ self["arrowup2"].startMoving()
 self.condition = config.misc.startwizard.doservicescan.value
                        </condition>
                        <code>
-self["rc"].moveTo(800, 50, 1)
-self["rc"].startMoving()
-self["arrowup"].moveTo(800, 310, 1)
-self["arrowup"].startMoving()
-self["arrowup2"].moveTo(800, 310, 1)
-self["arrowup2"].startMoving()
+self.hideRc()
                        </code>
                        <list>
                                <listentry caption="Yes, do an automatic scan now" step="scan" />
index b67937e4cac0f0f9f16ac6474670e1f84bab13a6..7e1bafb977bac95fefebb197c7063faeab6d41c1 100644 (file)
@@ -47,6 +47,8 @@ class GUIComponent(object):
                        self.instance.move(ePoint(int(x), int(y)))
 
        def resize(self, x, y = None):
+               self.width = x
+               self.height = y
                if y is None:
                        self.instance.resize(x)
                else:
@@ -90,6 +92,12 @@ class GUIComponent(object):
        def getPosition(self):
                p = self.instance.position()
                return (p.x(), p.y())
+       
+       def getWidth(self):
+               return self.width
+       
+       def getHeight(self):
+               return self.height
 
        position = property(getPosition, setPosition)
 
diff --git a/lib/python/Screens/Rc.py b/lib/python/Screens/Rc.py
new file mode 100644 (file)
index 0000000..49ee1d7
--- /dev/null
@@ -0,0 +1,88 @@
+from Components.Pixmap import MovingPixmap, MultiPixmap
+from Tools.Directories import resolveFilename, SCOPE_SKIN
+from xml.etree.ElementTree import ElementTree
+from Components.config import config, ConfigInteger
+
+config.misc.rcused = ConfigInteger(default = 1)
+
+class Rc:
+       def __init__(self):
+               self["rc"] = MultiPixmap()
+               self["arrowdown"] = MovingPixmap()
+               self["arrowdown2"] = MovingPixmap()
+               self["arrowup"] = MovingPixmap()
+               self["arrowup2"] = MovingPixmap()
+               
+               self.rcheight = 500
+               self.rcheighthalf = 250
+               
+               self.selectpics = []
+               self.selectpics.append((self.rcheighthalf, ["arrowdown", "arrowdown2"], (-18,-70)))
+               self.selectpics.append((self.rcheight, ["arrowup", "arrowup2"], (-18,0)))
+               
+               self.readPositions()
+               self.clearSelectedKeys()
+               self.onShown.append(self.initRc)
+
+       def initRc(self):
+               self["rc"].setPixmapNum(config.misc.rcused.value)
+               
+                               
+       def readPositions(self):
+               tree = ElementTree(file = resolveFilename(SCOPE_SKIN, "rcpositions.xml"))
+               rcs = tree.getroot()
+               self.rcs = {}
+               for rc in rcs:
+                       id = int(rc.attrib["id"])
+                       self.rcs[id] = {}
+                       print "id:", id
+                       for key in rc:
+                               name = key.attrib["name"]
+                               pos = key.attrib["pos"].split(",")
+                               print "name:", name
+                               print "pos:", pos
+                               self.rcs[id][name] = (int(pos[0]), int(pos[1]))
+               
+       def getSelectPic(self, pos):
+               for selectPic in self.selectpics:
+                       if pos[1] <= selectPic[0]:
+                               print "pos[1]:", pos[1]
+                               print "selectPic[0]:", selectPic[0]
+                               return (selectPic[1], selectPic[2])
+               return None
+       
+       def hideRc(self):
+               self["rc"].hide()
+               self.hideSelectPics()
+               
+       def showRc(self):
+               self["rc"].show()
+
+       def selectKey(self, key):
+               rc = self.rcs[config.misc.rcused.value]
+               if rc.has_key(key):
+                       rcpos = self["rc"].getPosition()
+                       pos = rc[key]
+                       selectPics = self.getSelectPic(pos)
+                       selectPic = None
+                       for x in selectPics[0]:
+                               if x not in self.selectedKeys:
+                                       selectPic = x
+                                       break
+                       if selectPic is not None:
+                               print "selectPic:", selectPic
+                               self[selectPic].show()
+                               self[selectPic].moveTo(rcpos[0] + pos[0] + selectPics[1][0], rcpos[1] + pos[1] + selectPics[1][1], 1)
+                               self[selectPic].startMoving()
+                               self.selectedKeys.append(selectPic)
+       
+       def clearSelectedKeys(self):
+               self.showRc()
+               self.selectedKeys = []
+               self.hideSelectPics()
+               
+       def hideSelectPics(self):
+               for selectPic in self.selectpics:
+                       for pic in selectPic[1]:
+                               self[pic].hide()
+       
\ No newline at end of file
index 1c4cfb2485929cfb3ee97287de20b3ed92b1d047..ae806ab64dd6d8c6ddba153d4d5393e7f3265e93 100644 (file)
@@ -2,8 +2,9 @@ from Wizard import wizardManager
 from Screens.WizardLanguage import WizardLanguage
 from Screens.ScanSetup import DefaultSatLists
 from Screens.DefaultWizard import DefaultWizard
+from Screens.Rc import Rc
 
-from Components.Pixmap import Pixmap, MovingPixmap
+from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap
 from Components.config import config, ConfigBoolean, configfile, ConfigSubsection
 
 from LanguageSelection import LanguageSelection
@@ -14,17 +15,14 @@ config.misc.startwizard.shownimconfig = ConfigBoolean(default = True)
 config.misc.startwizard.doservicescan = ConfigBoolean(default = True)
 config.misc.languageselected = ConfigBoolean(default = True)
 
-class StartWizard(DefaultSatLists):
+class StartWizard(DefaultSatLists, Rc):
        def __init__(self, session, silent = True, showSteps = False, neededTag = None):
                self.xmlfile = ["startwizard.xml", "defaultsatlists.xml"]
                WizardLanguage.__init__(self, session, showSteps = False)
                DefaultWizard.__init__(self, session, silent, showSteps, neededTag = "services")
+               Rc.__init__(self)
                self["wizard"] = Pixmap()
-               self["rc"] = MovingPixmap()
-               self["arrowdown"] = MovingPixmap()
-               self["arrowup"] = MovingPixmap()
-               self["arrowup2"] = MovingPixmap()
-               
+                               
        def markDone(self):
                config.misc.firstrun.value = 0
                config.misc.firstrun.save()