Re: Unable to use enums that start with numbers



On Wed, Jul 6, 2016 at 7:50 AM,  <philip chimento gmail com> wrote:
However, it seems that PyGObject also automatically detects this situation
and adds another alias, Gdk.EventType._2BUTTON_PRESS, as shown in the Python
documentation for Gdk. [1] I assume it does something similar for your enum
as well?

Sadly this is in the documentation only, I've filed
https://bugzilla.gnome.org/show_bug.cgi?id=768471

Another question I have is what might be a good way to represent a value
where multiple enums are combined as flags.  In the C API, an audio sample
format is represented by a single unsigned integer which has bit fields for
different parts of the format (bit width, channel count, sign/unsigned, and
byte order).  These values are usually just logically OR'd together.  One
thought which comes to mind for adding a binding for this is using a struct
with bit fields and creating a boxed type from it.  That would definitely
break the C API though and methods would need to be provided for accessing
the fields of the sample format.

You could mark all function arguments for that type as "(type int)"
(one such example is gtk_icon_size_lookup) so it takes the result of
your OR'd values.


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