diff options
| author | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2008-07-14 22:11:03 +0000 |
|---|---|---|
| committer | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2008-07-14 22:11:03 +0000 |
| commit | b4f98a4602ab1b51bf03f989ece928214cafd46b (patch) | |
| tree | 0d7f715dec4fd70af9312fb9bae419e847d5a8ed | |
| parent | 1ee48d3a425205e488ce9b24e81dfdba126538ce (diff) | |
| download | enigma2-b4f98a4602ab1b51bf03f989ece928214cafd46b.tar.gz enigma2-b4f98a4602ab1b51bf03f989ece928214cafd46b.zip | |
add new box depending rc visualization
| -rw-r--r-- | data/skin_default.xml | 11 | ||||
| -rw-r--r-- | data/startwizard.xml | 77 | ||||
| -rw-r--r-- | lib/python/Components/GUIComponent.py | 8 | ||||
| -rw-r--r-- | lib/python/Screens/Rc.py | 88 | ||||
| -rw-r--r-- | lib/python/Screens/StartWizard.py | 12 |
5 files changed, 126 insertions, 70 deletions
diff --git a/data/skin_default.xml b/data/skin_default.xml index c7f5bcce..b3d102b0 100644 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -205,7 +205,7 @@ self.instance.move(ePoint((720-wsizex)/2, (576-wsizey)/(count > 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 > 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 > 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> diff --git a/data/startwizard.xml b/data/startwizard.xml index 8e054fb6..c5afe700 100644 --- a/data/startwizard.xml +++ b/data/startwizard.xml @@ -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" /> diff --git a/lib/python/Components/GUIComponent.py b/lib/python/Components/GUIComponent.py index b67937e4..7e1bafb9 100644 --- a/lib/python/Components/GUIComponent.py +++ b/lib/python/Components/GUIComponent.py @@ -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 index 00000000..49ee1d75 --- /dev/null +++ b/lib/python/Screens/Rc.py @@ -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 diff --git a/lib/python/Screens/StartWizard.py b/lib/python/Screens/StartWizard.py index 1c4cfb24..ae806ab6 100644 --- a/lib/python/Screens/StartWizard.py +++ b/lib/python/Screens/StartWizard.py @@ -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() |
