3 from enigma import ePoint, eSize
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, parent):
36 if self.skinAttributes is None:
39 skin.applyAllAttributes(self.instance, desktop, self.skinAttributes, parent.scale)
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, x, y = None):
53 self.instance.resize(x)
55 self.instance.resize(eSize(int(x), int(y)))
57 def setZPosition(self, z):
58 self.instance.setZPosition(z)
63 if self.instance is not None:
65 if old != self.__visible:
66 for fnc in self.onVisibilityChange:
72 if self.instance is not None:
74 if old != self.__visible:
75 for fnc in self.onVisibilityChange:
81 def setVisible(self, visible):
87 visible = property(getVisible, setVisible)
89 def setPosition(self, x, y):
90 self.instance.move(ePoint(int(x), int(y)))
92 def getPosition(self):
93 p = self.instance.position()
102 position = property(getPosition, setPosition)
104 # default implementation for only one widget per component
105 # feel free to override!
106 def GUIcreate(self, parent):
107 self.instance = self.createWidget(parent)
108 self.postWidgetCreate(self.instance)
111 self.preWidgetRemove(self.instance)
114 # default for argumentless widget constructor
115 def createWidget(self, parent):
116 return self.GUI_WIDGET(parent)
118 def postWidgetCreate(self, instance):
121 def preWidgetRemove(self, instance):