1 from Components.Pixmap import MovingPixmap, MultiPixmap
2 from Tools.Directories import resolveFilename, SCOPE_SKIN
3 from xml.etree.ElementTree import ElementTree
4 from Components.config import config, ConfigInteger
6 config.misc.rcused = ConfigInteger(default = 1)
10 self["rc"] = MultiPixmap()
11 self["arrowdown"] = MovingPixmap()
12 self["arrowdown2"] = MovingPixmap()
13 self["arrowup"] = MovingPixmap()
14 self["arrowup2"] = MovingPixmap()
17 self.rcheighthalf = 250
20 self.selectpics.append((self.rcheighthalf, ["arrowdown", "arrowdown2"], (-18,-70)))
21 self.selectpics.append((self.rcheight, ["arrowup", "arrowup2"], (-18,0)))
24 self.clearSelectedKeys()
25 self.onShown.append(self.initRc)
28 self["rc"].setPixmapNum(config.misc.rcused.value)
31 def readPositions(self):
32 tree = ElementTree(file = resolveFilename(SCOPE_SKIN, "rcpositions.xml"))
36 id = int(rc.attrib["id"])
40 name = key.attrib["name"]
41 pos = key.attrib["pos"].split(",")
44 self.rcs[id][name] = (int(pos[0]), int(pos[1]))
46 def getSelectPic(self, pos):
47 for selectPic in self.selectpics:
48 if pos[1] <= selectPic[0]:
49 print "pos[1]:", pos[1]
50 print "selectPic[0]:", selectPic[0]
51 return (selectPic[1], selectPic[2])
61 def selectKey(self, key):
62 rc = self.rcs[config.misc.rcused.value]
64 rcpos = self["rc"].getPosition()
66 selectPics = self.getSelectPic(pos)
68 for x in selectPics[0]:
69 if x not in self.selectedKeys:
72 if selectPic is not None:
73 print "selectPic:", selectPic
74 self[selectPic].show()
75 self[selectPic].moveTo(rcpos[0] + pos[0] + selectPics[1][0], rcpos[1] + pos[1] + selectPics[1][1], 1)
76 self[selectPic].startMoving()
77 self.selectedKeys.append(selectPic)
79 def clearSelectedKeys(self):
81 self.selectedKeys = []
84 def hideSelectPics(self):
85 for selectPic in self.selectpics:
86 for pic in selectPic[1]: