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()
16 config.misc.rcused = ConfigInteger(default = 1)
19 self.rcheighthalf = 250
22 self.selectpics.append((self.rcheighthalf, ["arrowdown", "arrowdown2"], (-18,-70)))
23 self.selectpics.append((self.rcheight, ["arrowup", "arrowup2"], (-18,0)))
26 self.clearSelectedKeys()
27 self.onShown.append(self.initRc)
30 self["rc"].setPixmapNum(config.misc.rcused.value)
32 def readPositions(self):
33 tree = ElementTree(file = resolveFilename(SCOPE_SKIN, "rcpositions.xml"))
37 id = int(rc.attrib["id"])
40 name = key.attrib["name"]
41 pos = key.attrib["pos"].split(",")
42 self.rcs[id][name] = (int(pos[0]), int(pos[1]))
44 def getSelectPic(self, pos):
45 for selectPic in self.selectpics:
46 if pos[1] <= selectPic[0]:
47 return (selectPic[1], selectPic[2])
57 def selectKey(self, key):
58 rc = self.rcs[config.misc.rcused.value]
60 rcpos = self["rc"].getPosition()
62 selectPics = self.getSelectPic(pos)
64 for x in selectPics[0]:
65 if x not in self.selectedKeys:
68 if selectPic is not None:
69 print "selectPic:", selectPic
70 self[selectPic].moveTo(rcpos[0] + pos[0] + selectPics[1][0], rcpos[1] + pos[1] + selectPics[1][1], 1)
71 self[selectPic].startMoving()
72 self[selectPic].show()
73 self.selectedKeys.append(selectPic)
75 def clearSelectedKeys(self):
77 self.selectedKeys = []
80 def hideSelectPics(self):
81 for selectPic in self.selectpics:
82 for pic in selectPic[1]: