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.
Think I've cracked the code after dir()-ing everything I could find in the GObject class =>
G_SIGNAL_RUN_FIRST
is found in theGSignalFlags
enum, which translates toGObject.SignalFlags.RUN_FIRST
. This is consistent, soG_SIGNAL_MATCH_ID
found in the enumGSignalMatchType
translates toGObject.SignalMatchType.ID
.Not entirely obvious, but easy enough once you know what to look for.
As per previous comments, the translation you asked would be as follows:
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 toGObject.TYPE_PYOBJECT
andNone
toGObject.TYPE_NONE
. Hence, I find the following version more straightforward: