[pygtk] pygtk-codegen, enum/flags issue

Magnus Therning magnus at therning.org
Wed May 31 04:26:19 WST 2006


On Tue, May 30, 2006 at 07:35:39PM +0100, Gustavo J. A. M. Carneiro wrote:
>On Ter, 2006-05-30 at 08:26 +0100, Magnus Therning wrote:
[..]
>> I have two questions:
>>  1. What's the difference between enum and flags for pygtk-codegen, and
>>     when should I use which?
>
>  enums are mutually exclusive values; flags are values that can be
>combined in a single 'set' value, like bit masks.

Ah, that clears things up. Thanks.

>>  2. How do i derive the gtype-id? (I seem to have done it right for
>>     WnckWindowGravity but not for WnckWindowMoveResizeMask.)
>
>  gtype-id is guessed by h2def.py, but most libraries out there are not
>bindings-friendly and don't bother to register GType's for enums and
>flags.  Metacity is one of those.  My advice is, simply remove the
>gtype-id, so pygtk-codegen will simply generate code to register the
>values as simple int constants.

Oh, OK. I got the impression that libwnck does the right thing since all
the enums/flags in wnck.defs does have gtype-ids... it might be my
inexperience with GTK+/GNOME that's shining through though :-)

On to the next problem then (which I sent in another email as well),
where do enums/flags live in the python bindings? I need to instantiate
and pass some flags into a libwnck function.

/M

-- 
Magnus Therning                             (OpenPGP: 0xAB4DFBA4)
magnus at therning.org             Jabber: magnus.therning at gmail.com
http://therning.org/magnus

Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.

Good powers of observation are frequently called "cynicism" by those
that don't have them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20060530/461b6595/attachment-0001.pgp


More information about the pygtk mailing list