Re: Porting launcher-gtk.py to gobject introspection
- From: Nicolas Évrard <nicoe altern org>
- To: libchamplain-list gnome org
- Subject: Re: Porting launcher-gtk.py to gobject introspection
- Date: Thu, 22 Dec 2011 13:29:01 +0100
* 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:
Hello,
I am trying to port the demos launcher-gtk.py to use gobject
introspection. But I seem to be unable to grok the introspection
concept.
So I copied both launcher-gtk.py and markers.py 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 markers.py):
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).
Well I took as an example the last version of launcher-gtk.py that I
could find:
http://gitorious.org/libchamplain/mainline/commit/c02e827d01762d39d709b2e4d7a58828dc800818/diffs
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]