slightly better example of using the signals (eButton::selected -> Button::onClick...
authorFelix Domke <tmbinc@elitedvb.net>
Tue, 18 Jan 2005 06:56:52 +0000 (06:56 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Tue, 18 Jan 2005 06:56:52 +0000 (06:56 +0000)
components.py
mytest.py
screens.py

index 315ae44c0c54efbe640303fe4157131fde17817f..7c7932316f0feddcf36c13ed9f718e997ef56a5d 100644 (file)
@@ -97,12 +97,20 @@ class Clock(HTMLComponent, GUIComponent, VariableText):
                return self.getText()
 
 class Button(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)
        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:
        
        def click(self):
                for x in self.onClick:
index e5dd7e964c5a3ded0eb201e83b112c6cc4b6cbc7..53a398edc8f4acb1ae1f262fe709353347d58fc4 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -108,6 +108,8 @@ def test():
 #      button.resize(eSize(80, 50)) 
 
        wnd.show()
 #      button.resize(eSize(80, 50)) 
 
        wnd.show()
+       
+       components["$002"].data["okbutton"]["instance"].push()  
 
        for x in range(200):
                time.sleep(0.1)
 
        for x in range(200):
                time.sleep(0.1)
@@ -116,7 +118,7 @@ def test():
                        r = 200 - x
                else:
                        r = x
                        r = 200 - x
                else:
                        r = x
-               components["$002"]["okbutton"].setValue(r)
+#              components["$002"]["okbutton"].setValue(r)
                desktop.paint()
        
 #      
                desktop.paint()
        
 #      
@@ -131,3 +133,15 @@ def test():
        
        
        return 0
        
        
        return 0
+
+def testI2(a):
+       print "PYTHON says: it's a " + str(a) + "!!!"
+       return 0
+
+def testI(a = 0):
+       print "magic integer is " + str(a)
+       
+       list = testsignal.get()
+       print "list -> " + str(list)
+       list.append(testI2)
+       return 1
index bd0f6fc423bed4fe09a28424460c9e0360f14336..7287898db4d673cf970519d79831396a1455deca 100644 (file)
@@ -31,7 +31,6 @@ class clockDisplay(Screen):
                b = Button("bye")
                b.onClick = [ self.okbutton ]
                self["okbutton"] = b
                b = Button("bye")
                b.onClick = [ self.okbutton ]
                self["okbutton"] = b
-               #VolumeBar()
                self["title"] = Header("clock dialog: here you see the current uhrzeit!")
 
 # defined screens
                self["title"] = Header("clock dialog: here you see the current uhrzeit!")
 
 # defined screens