Re: Porting to gobject introspection

* Jiří Techet [2011-12-21 22:15 +0100]:
Hi Nicolas,

Hello Jiří,

On Tue, Dec 20, 2011 at 15:50, Nicolas Évrard <nicoe altern org> wrote:

I am trying to port the demos to use gobject
introspection. But I seem to be unable to grok the introspection

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,
 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).

Well I took as an example the last version of that I
could find:

BTW once I have finished rewritting those (I'll have some time on the
25 I guess) are you interested in the result ? It would probably help
people looking for example I think.

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.

That's what I did, but I did not notice that the new_with_text was
under the class Label and not Marker … now I know.

Thank you very much for your help.

(°> Nicolas Évrard
( ) Liège

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