3 from enigma import ePoint
5 class GUIComponent(object):
13 self.state = self.SHOWN
30 # this works only with normal widgets - if you don't have self.instance, override this.
31 def applySkin(self, desktop):
32 if self.state == self.HIDDEN:
34 skin.applyAllAttributes(self.instance, desktop, self.skinAttributes)
37 self.instance.move(ePoint(int(x), int(y)))
40 self.__state = self.SHOWN
41 if self.instance is not None:
45 self.__state = self.HIDDEN
46 if self.instance is not None:
52 def setState(self, state):
53 if state == self.SHOWN:
55 elif state == self.HIDDEN:
58 state = property(getState, setState)
60 def setPosition(self, x, y):
61 self.instance.move(ePoint(int(x), int(y)))
63 def getPosition(self):
64 p = self.instance.position()
67 position = property(getPosition, setPosition)
69 # default implementation for only one widget per component
70 # feel free to override!
71 def GUIcreate(self, parent):
72 self.instance = self.createWidget(parent)
73 self.postWidgetCreate(self.instance)
76 self.preWidgetRemove(self.instance)
79 # default for argumentless widget constructor
80 def createWidget(self, parent):
81 return self.GUI_WIDGET(parent)
83 def postWidgetCreate(self, instance):
86 def preWidgetRemove(self, instance):