summaryrefslogtreecommitdiff
path: root/examples/gobject
diff options
context:
space:
mode:
authorJames Henstridge <james@daa.com.au>2001-03-30 06:35:41 +0000
committerJames Henstridge <jamesh@src.gnome.org>2001-03-30 06:35:41 +0000
commitc6b603a599e81889a1cef0541ee99c629e090c02 (patch)
tree1e9d0d35a6c78e8544330cfb5c526a7a4d2fb9df /examples/gobject
parent58dd3fade17ae683237464daf5e4ec8c7d723477 (diff)
downloadpygtk-c6b603a599e81889a1cef0541ee99c629e090c02.tar.gz
moved rewritten testgtk demo here
2001-03-30 James Henstridge <james@daa.com.au> * examples/pygtk-demo: moved rewritten testgtk demo here * gobjectmodule.c (pygobject_set_property): initialise the GValue to { 0, }, so set_property actually works. (pygobject_get_property): same here. * gtk/gtk.defs: updated enum/flag defs. * gtk/gdk.defs: updated enum/flag defs. * examples/gobject/signal.py (D.do_my_signal): add small example of overriding class closure for a signal introduced from python code. * codegen/h2def.py: add --onlyenums flag to only output enum defs.
Diffstat (limited to 'examples/gobject')
-rw-r--r--examples/gobject/signal.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/gobject/signal.py b/examples/gobject/signal.py
index 6fd622d2..b98bca77 100644
--- a/examples/gobject/signal.py
+++ b/examples/gobject/signal.py
@@ -3,18 +3,25 @@ import gobject
class C(gobject.GObject):
def do_my_signal(self, arg):
- print "class closure for `my_signal' called with argument", arg
+ print "C: class closure for `my_signal' called with argument", arg
gobject.signal_new("my_signal", C, gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, (gobject.TYPE_INT, ))
+class D(C):
+ def do_my_signal(self, arg):
+ print "D: class closure for `my_signal' called. Chaining up to C"
+ C.do_my_signal(self, arg)
+
def my_signal_handler(object, arg, *extra):
print "handler for `my_signal' called with argument", arg, \
"and extra args", extra
inst = C()
+inst2 = D()
print "instance id 0x%x" % id(inst)
inst.connect("my_signal", my_signal_handler, 1, 2, 3)
inst.emit("my_signal", 42)
+inst2.emit("my_signal", 42)