diff options
| author | James Henstridge <james@daa.com.au> | 2001-05-06 16:51:48 +0000 |
|---|---|---|
| committer | James Henstridge <jamesh@src.gnome.org> | 2001-05-06 16:51:48 +0000 |
| commit | 4eb6811648e5719691c913bfb8347eb9a541db7a (patch) | |
| tree | 5915582541cc66101a12252ba3ea471493fd6e56 /examples/gobject | |
| parent | befa99f054103c31c423387e89bc15455bd7335e (diff) | |
| download | pygtk-4eb6811648e5719691c913bfb8347eb9a541db7a.tar.gz | |
2001-05-06 James Henstridge <james@daa.com.au>
2001-05-07 James Henstridge <james@daa.com.au>
* examples/gobject/signal.py:
2001-05-06 James Henstridge <james@daa.com.au>
* gobjectmodule.c (pygobject__init__): make the __init__ function
choose what GType to pass to g_object_new based on the __gtype__
attribute.
(pygobject_methods): make __gobject_init__ an alias for
GObject.__init__.
(pyg_type_register): new function for registering new GTypes.
(pyg_type_register): register the type as "module+class" rather
than "module.class", as the second form is considered bad (would
like to use the second form though.
* configure.in: require 1.3.5 versions of glib and gtk+.
Diffstat (limited to 'examples/gobject')
| -rw-r--r-- | examples/gobject/signal.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/gobject/signal.py b/examples/gobject/signal.py index b98bca77..c52f0ad8 100644 --- a/examples/gobject/signal.py +++ b/examples/gobject/signal.py @@ -1,10 +1,12 @@ -import ltihooks, ExtensionClass import gobject class C(gobject.GObject): + def __init__(self): + self.__gobject_init__() # default constructor using our new GType def do_my_signal(self, arg): print "C: class closure for `my_signal' called with argument", arg +gobject.type_register(C) gobject.signal_new("my_signal", C, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_INT, )) @@ -13,6 +15,8 @@ class D(C): print "D: class closure for `my_signal' called. Chaining up to C" C.do_my_signal(self, arg) +gobject.type_register(D) + def my_signal_handler(object, arg, *extra): print "handler for `my_signal' called with argument", arg, \ "and extra args", extra @@ -20,8 +24,6 @@ def my_signal_handler(object, arg, *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) |
