slightly better example of using the signals (eButton::selected -> Button::onClick...
[enigma2.git] / components.py
index 315ae44c0c54efbe640303fe4157131fde17817f..7c7932316f0feddcf36c13ed9f718e997ef56a5d 100644 (file)
@@ -97,12 +97,20 @@ class Clock(HTMLComponent, GUIComponent, VariableText):
                return self.getText()
 
 class Button(HTMLComponent, GUIComponent, VariableText):
-       onClick = {}
-       
        def __init__(self, text=""):
                GUIComponent.__init__(self)
                VariableText.__init__(self)
                self.setText(text)
+               self.onClick = [ ]
+       
+       def clicked(self):
+               for x in self.onClick:
+                       x()
+               return 0
+
+       def GUIcreate(self, priv, parent, skindata):
+               GUIComponent.GUIcreate(self, priv,parent, skindata)
+               priv["instance"].selected.get().append(self.clicked)
        
        def click(self):
                for x in self.onClick: