aboutsummaryrefslogtreecommitdiffstats
path: root/examples/signal_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/signal_test.py')
-rw-r--r--examples/signal_test.py62
1 files changed, 36 insertions, 26 deletions
diff --git a/examples/signal_test.py b/examples/signal_test.py
index 0f3dc9c..e86b3c3 100644
--- a/examples/signal_test.py
+++ b/examples/signal_test.py
@@ -1,52 +1,63 @@
# -*- coding: UTF-8 -*-
-from base.eodefault import *
-from eobase import EoBase
-from signals.signals_py import Simple
+from eoeoeo.eodefault import *#for CALLBACK_STOP
+from eoeoeo.eobase import EoBase
+from eoeoeo.signals_py import Simple
-def cb_del(o):
+def cb_del(o, d):
print "OBJECT DELETED"
-def cb_free(o):
+_o_cb_del = (cb_del, None)
+
+def cb_free(o, d):
print "OBJECT FREED"
-def cb_a_changed(o):
+_o_cb_free = (cb_free, None)
+
+def cb_a_changed(o, d):
print "A_CHANGED"
-def cb_a_changed_stop(o):
+_o_cb_a_changed = (cb_a_changed, None)
+
+def cb_a_changed_stop(o, d):
print "A_CHANGED_STOP"
return CALLBACK_STOP
+_o_cb_a_changed_stop = (cb_a_changed_stop, None)
-def cb_add(o):
+def cb_add(o, d):
print "CALBACK_ADD"
-def cb_del(o):
+
+_o_cb_add = (cb_add, None)
+
+def cb_del(o, d):
print "CALBACK_DEL"
+_o_cb_del = (cb_del, None)
+
print "Creating Simple object"
sobj = Simple(None)
-
print "adding event on EV_DELETING"
-sobj.event_callback_priority_add(EoBase.DEL, 0, cb_del)
+sobj.event_callback_priority_add(EoBase.DEL, 0, _o_cb_del)
print "adding event on CHANGING"
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
print "adding event on EV_ADDING"
-sobj.event_callback_priority_add(EoBase.CALLBACK_ADD, 0, cb_add)
+sobj.event_callback_priority_add(EoBase.CALLBACK_ADD, 0, _o_cb_add)
print "adding 2 events on EV_DELETING"
-sobj.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, cb_del)
-sobj.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, cb_del)
+sobj.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, _o_cb_del)
+sobj.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, _o_cb_del)
print "adding event on CHANGING"
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
print "adding 2nd event on ADDING"
-sobj.event_callback_priority_add(EoBase.CALLBACK_ADD, 0, cb_add)
+sobj.event_callback_priority_add(EoBase.CALLBACK_ADD, 0, _o_cb_add)
-sobj.a_set(4)
+sobj.simple_a_set(4)
print "deleting event on EV_ADDING"
sobj.event_callback_del(EoBase.CALLBACK_ADD, cb_add)
@@ -55,16 +66,15 @@ print "deleting event on EV_DELETING"
sobj.event_callback_del(EoBase.CALLBACK_DEL, cb_del)
print "adding 4 events on CHANGING, second is STOP"
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed)
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed_stop)
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed)
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed)
-
-sobj.a_set(5)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed_stop)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
+sobj.simple_a_set(5)
print "deleting event on CHANGING"
-res = sobj.event_callback_del(Simple.A_CHANGED, cb_a_changed)
+res = sobj.event_callback_del(Simple.A_CHANGED, _o_cb_a_changed)
print "Res:", res
print "explicitly calling ON_CHANGE"
@@ -74,7 +84,7 @@ print "Res:", res
sobj.event_global_freeze()
-sobj.a_set(89)
+sobj.simple_a_set(89)
#sobj.b_set(8)
#res = sobj.c_get()