3 from enigma import ePoint
5 class GUIComponent(object):
10 self.onVisibilityChange = [ ]
13 self.skinAttributes = None
14 self.deprecationInfo = None
31 # this works only with normal widgets - if you don't have self.instance, override this.
32 def applySkin(self, desktop):
36 if self.skinAttributes is None:
39 skin.applyAllAttributes(self.instance, desktop, self.skinAttributes)
42 def move(self, x, y = None):
43 # we assume, that x is already an ePoint
47 self.instance.move(ePoint(int(x), int(y)))
49 def resize(self, size):
50 self.instance.resize(size)
52 def setZPosition(self, z):
53 self.instance.setZPosition(z)
58 if self.instance is not None:
60 if old != self.__visible:
61 for fnc in self.onVisibilityChange:
67 if self.instance is not None:
69 if old != self.__visible:
70 for fnc in self.onVisibilityChange:
76 def setVisible(self, visible):
82 visible = property(getVisible, setVisible)
84 def setPosition(self, x, y):
85 self.instance.move(ePoint(int(x), int(y)))
87 def getPosition(self):
88 p = self.instance.position()
91 position = property(getPosition, setPosition)
93 # default implementation for only one widget per component
94 # feel free to override!
95 def GUIcreate(self, parent):
96 self.instance = self.createWidget(parent)
97 self.postWidgetCreate(self.instance)
100 self.preWidgetRemove(self.instance)
103 # default for argumentless widget constructor
104 def createWidget(self, parent):
105 return self.GUI_WIDGET(parent)
107 def postWidgetCreate(self, instance):
110 def preWidgetRemove(self, instance):