Skip to content

Commit

Permalink
moved rewritten testgtk demo here
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
James Henstridge authored and James Henstridge committed Mar 30, 2001
1 parent 5d67cea commit 2fa1a29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion examples/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@

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)
4 changes: 2 additions & 2 deletions gobject/gobjectmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ pygobject_get_property(PyGObject *self, PyObject *args)
{
gchar *param_name;
GParamSpec *pspec;
GValue value;
GValue value = { 0, };
PyObject *ret;

if (!PyArg_ParseTuple(args, "s:GObject.get_property", &param_name))
Expand All @@ -965,7 +965,7 @@ pygobject_set_property(PyGObject *self, PyObject *args)
{
gchar *param_name;
GParamSpec *pspec;
GValue value;
GValue value = { 0, };
PyObject *pvalue;

if (!PyArg_ParseTuple(args, "sO:GObject.set_property", &param_name,
Expand Down

0 comments on commit 2fa1a29

Please sign in to comment.