diff options
author | mike <michael.jmontcalm@gmail.com> | 2009-11-06 03:06:06 (GMT) |
---|---|---|
committer | mike <michael.jmontcalm@gmail.com> | 2009-11-06 03:06:06 (GMT) |
commit | c7c7f94fc5d7e9f7e4f175c06dd52628aa357e3d (patch) | |
tree | 25008422c07d68028c0c64d8f41c0fbef54e9ade /tests/inject.py | |
parent | fe07a6fa0fa0d67d2ada6be1f3da2cb128f9038b (diff) | |
parent | 74dcbcb643cfd66df071020320ba6c0004e92c17 (diff) |
Merge branch 'lp448319' of ../mainline
Conflicts:
addons/readfile.py
tests/probetests.py
tests/run-tests.py
tutorius/TProbe.py
tutorius/constraints.py
tutorius/core.py
tutorius/engine.py
tutorius/properties.py
tutorius/service.py
Diffstat (limited to 'tests/inject.py')
-rw-r--r-- | tests/inject.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/inject.py b/tests/inject.py new file mode 100644 index 0000000..d69d6ff --- /dev/null +++ b/tests/inject.py @@ -0,0 +1,57 @@ +#Test event injection + +import gtk +import gobject +import time +import types + +class ClickMaster(): + def __init__(self): + self.event = None + + def connect(self, button): + self.id = button.connect("pressed",self.capture_event) + self.id2 = button.connect("released",self.capture_event2) + self.id3 = button.connect("clicked",self.capture_event3) + self.button = button + + def capture_event(self, *args): + print "Capture Event" + print args + self.eventPress = args[-1] + return False + + def capture_event2(self, *args): + print "Capture Release" + print args + self.eventReleased = args[-1] + return False + + def capture_event3(self, *args): + print "Capture Clicked" + print args + self.eventClicked = args[-1] + return False + + def inject_event(self): + print "Injecting" + print self.event + #self.event.put() + self.button.emit("button_press_event", self.event) + +def print_Event(event): + for att in dir(event): + if not isinstance(att, types.MethodType): + print att, getattr(event, att) + +if __name__=='__main__': + w = gtk.Window() + b = gtk.CheckButton("Auto toggle!") + c=ClickMaster() + w.add(b) + b.show() + c.connect(b) + + w.show() + + gtk.main() |