Re: Properties

On Fri, Aug 15, 2014 at 12:19 AM, Thomas Martitz <kugel rockbox org> wrote:
I know you can make properties in python accessible as fields (as opposed to
accessing via obj.props.$property) by using the @Property decorator. Is the
same somehow possible for introspected classes?

For example I have this (in vala):

class T : GLib.Object
     public int a { get { return 1; } }

GI allows me to use that class (obj = T()), but the property is only
accessible via obj.props.a, where I would prefer obj.a directly.

Do I have to do anything special to the .gir or .typelib, or when importing
it into the python code? Or this not possible at all?

Currently the only way to access non-Python installed properties is
with either the props accessor or by using the get_property() method.
This feature has been requested before and I've wanted it as well. I
don't see why we shouldn't add it since both vala and gjs have it.

I've logged a ticket for tracking the feature request. Patches are
always welcome:


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