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 /lib/python | |
| parent | 1ee48d3a425205e488ce9b24e81dfdba126538ce (diff) | |
| download | enigma2-b4f98a4602ab1b51bf03f989ece928214cafd46b.tar.gz enigma2-b4f98a4602ab1b51bf03f989ece928214cafd46b.zip | |
add new box depending rc visualization
Diffstat (limited to 'lib/python')
| -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 |
3 files changed, 101 insertions, 7 deletions
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() |
