Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to port a library from PyGTK to use GI and GTK3. The problem is I can't find any resources specific to the gobject imports, but only for GTK. I was hoping that if someone would translate the following for me, I would get a grasp of how to do this stuff. The GTK things itself seems to be fairly well documented, but I can't find anything about this.

__gsignals__ = {'cell-edited' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
    (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT, 
    gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT)), 'selection-changed' : 
    (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))}

My assumption was, since I couldn't find any specific documentation, that it would be a matter of changing the name of the constants, but I can't find any replacements.

share|improve this question
Really trying not to be rude here but don't you think your question goes better in stackoverflow? Most of the ppl here wont have a clue about what you are asking :( – Bruno Pereira Oct 24 '11 at 13:58
In this case, the library in question is Quickly Widgets as well, so I think it should be relevant here. :) – Jo-Erlend Schinstad Oct 24 '11 at 15:16
I had a related question and the solution was to install some libraries – hobs Jun 9 '13 at 14:36
up vote 4 down vote accepted

Think I've cracked the code after dir()-ing everything I could find in the GObject class =>

G_SIGNAL_RUN_FIRST is found in the GSignalFlags enum, which translates to GObject.SignalFlags.RUN_FIRST. This is consistent, so G_SIGNAL_MATCH_ID found in the enum GSignalMatchType translates to GObject.SignalMatchType.ID.

Not entirely obvious, but easy enough once you know what to look for.

share|improve this answer

As per previous comments, the translation you asked would be as follows:

from gi.repository import GObject

__gsignals__ = {'cell-edited': (GObject.SignalFlags.RUN_LAST,
                                (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT)),
                'selection-changed': (GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (GObject.TYPE_PYOBJECT,))}

However, according to my own experience, some python types are somehow internally mapped to their GObject counterparts (or at least, it works as if they were), that is, object is mapped to GObject.TYPE_PYOBJECT and None to GObject.TYPE_NONE. Hence, I find the following version more straightforward:

from gi.repository import GObject

__gsignals__ = {'cell-edited': (GObject.SignalFlags.RUN_LAST,
                                None, (object, object, object, object, object)),
                'selection-changed': (GObject.SignalFlags.RUN_LAST, None, (object,))}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.