Re: Porting to gobject introspection

Hi Nicolas,

On Tue, Dec 20, 2011 at 15:50, Nicolas Évrard <nicoe altern org> wrote:
> Hello,
> I am trying to port the demos to use gobject
> introspection. But I seem to be unable to grok the introspection
> concept.
> So I copied both and to a directory from an
> old version of libchamplain and renamed everything to use the
> introspection. But my code fails on this kind of line (in
>     marker = Champlain.marker_new_with_text(
>        "Montréal\n<span size=\"xx-small\">Québec</span>", "Serif 14", black,
>        orange)
>  I tried with Champlain.Marker("…") but it did not work,
> Champlain.Marker.new_with_text did not work either.
> Can someone explain me how to do this ?

First, the method called by the demo is
champlain_label_new_with_text() and not
champlain_marker_new_with_text() which appears you try to call (and
which doesn't exist).

Second, in python bindings the prefixes with library and class names
are converted to namespaces so instead of
champlain_label_new_with_text() you use
Champlain.Label.new_with_text() so something like this should work:

marker = Champlain.Label.new_with_text(
  "Montreal", "Serif 14", None, None)

I don't know if the mappings are described somewhere but it usually
helps to look into the gir file.


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