Re: Fwd: registering Gtk.EventButton as argument to custom signal



Op 03-05-16 om 19:57 schreef Krister Swenson:


Hello,

I'm trying to port my open source
(https://bitbucket.org/thekswenson/alpha) GTK 2 code to GTK 3.

A have defined a custom signal as follows:

__gsignals__ = {'clicked' : (GObject.SignalFlags.RUN_LAST, None,
                             (GObject.TYPE_STRING, Gdk.Event))}

I later emit this signal:

self.emit('clicked', None, event)

where "event" is a Gdk.EventButton.

This code worked under GTK 2 but apparently an EventButton is not an
Event anymore.  I've tried registering the event with Gdk.EventButton
instead of Gdk.Event but I get an error:

...
/usr/lib/python2.7/dist-packages/gi/types.py:205: Warning:
/build/glib2.0-t9oPgV/glib2.0-2.48.0/./gobject/gsignal.c:1674:
parameter 2 of type 'void' for signal "xdot+DotWidget::clicked" is not
a value type
  _gobject.type_register(cls, namespace.get('__gtype_name__'))
...
Looking at this error, are you using the xdot library by any chance? I had to port this to Python3 and GTK3 a year or two ago for our application. I looked it up and this is the line in my xdot port with a special GTK3 comment that I had to change the type.

    __gsignals__ = {
        'clicked' : (GObject.SIGNAL_RUN_LAST, None, (str, object))
    }

Hope this helps,
Timo


Any chance somebody could explain to me what's going on here?

I appreciate the help, thank you.

kms



_______________________________________________
python-hackers-list mailing list
python-hackers-list gnome org
https://mail.gnome.org/mailman/listinfo/python-hackers-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]