Re: [Gexiv2] Extract all keywords from image Python GExiv2



On Sun, Aug 18, 2013 at 3:09 PM, Jason Moore <moorepants gmail com> wrote:
Is there a way to pull docstrings into the python code from the underlying
libs?

Not that I'm aware of, but I would encourage you to contact pygobject
maintainer Martin Pitt <martin pitt canonical com> in order to explore
that possibility.

The method names are mostly self explanatory but it would be great to get
something more useful when typing help(metadata.get_tag_multple). Or is
there documentation that I'm missing that already exists?

I usually just refer directly to the C source code. It's very well documented.

http://redmine.yorba.org/projects/gexiv2/repository/revisions/master/entry/gexiv2/gexiv2-metadata.h

The only catch is that you have to read code like this:

gboolean                gexiv2_metadata_set_gps_info
             (GExiv2Metadata *self, gdouble longitude, gdouble
latitude, gdouble altitude);

and interpret it like this:

GExiv2.Metadata().set_gps_info(longitude, latitude, altitude)

But after consuming quite a few C libraries via GObject Introspection
you get used to this.

If there isn't I'm happy to write some doc strings as I figure out how to
use the library.

Unfortunately there's no value in writing docstrings manually because
there's nothing to write docstrings on! If you look at the python
overrides file, there are only a handful of functions even defined:

http://redmine.yorba.org/projects/gexiv2/repository/revisions/master/entry/GExiv2.py

The vast majority of GExiv2's API is imported directly into python
without any modification whatsoever. But there is good gtk-doc style
documentation in the above gexiv2-metadata.h file, and introspection
already goes to a lot of trouble to read and parse that information,
so theoretically it shouldn't be too difficult to expose that into
python. I've just never tried is all. You should really talk to Martin
about that, though, because that has the potential to benefit many GI
libraries, not just GExiv2.



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