some logic to detect useable nims for rotor plugin
[enigma2.git] / lib / python / Components / GUIComponent.py
index bcd99d245e86fc32fb9a08e5b09b5d7c993d14ad..8f6362fdadbe88407c4b045aec8cd6042631fdc2 100644 (file)
@@ -1,12 +1,47 @@
+import skin
+
+from enigma import ePoint
+
 class GUIComponent:
        """ GUI component """
-
+       
+       SHOWN = 0
+       HIDDEN = 1
+       
        def __init__(self):
-               pass
-               
+               self.state = self.SHOWN
+               self.instance = None
+       
        def execBegin(self):
                pass
        
        def execEnd(self):
                pass
+       
+       def onShow(self):
+               pass
+
+       def onHide(self):
+               pass
+       
+       def destroy(self):
+               pass
+       
+       # this works only with normal widgets - if you don't have self.instance, override this.
+       def applySkin(self, desktop):
+               if self.state == self.HIDDEN:
+                       self.instance.hide()
+               skin.applyAllAttributes(self.instance, desktop, self.skinAttributes)
+
+       def move(self, x, y):
+               self.instance.move(ePoint(int(x), int(y)))
+
+       def show(self):
+               self.state = self.SHOWN
+               if self.instance is not None:
+                       self.instance.show()
 
+       def hide(self):
+               self.state = self.HIDDEN
+               if self.instance is not None:
+                       self.instance.hide()