<div dir="ltr">Try dir(Pango) in a python console. It's Pango.WrapMode... I'm sure there is a logic to go from C api to python too, but I don't know it :)<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 9 June 2013 16:22, <span dir="ltr"><<a href="mailto:lionel@olpc-france.org" target="_blank">lionel@olpc-france.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="FR"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">Finally solved my issue with a big review of my imports. Thanks.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">I’ve got a last issue on Pango, no way to found some Pango constants (ALIGN_CENTER and WRAP_WORD – view my calls below).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">Any idea where I can found it?<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"> Lionel.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal" style="text-indent:35.4pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">layout.set_alignment(Pango.ALIGN_CENTER)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"> layout.set_wrap(Pango.WRAP_WORD)<u></u><u></u></span></p><p class="MsoNormal">
<span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">De :</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> Daniel Narvaez [mailto:<a href="mailto:dwnarvaez@gmail.com" target="_blank">dwnarvaez@gmail.com</a>] <br>
<b>Envoyé :</b> dimanche 9 juin 2013 13:22<br><b>À :</b> Walter Bender<br><b>Cc :</b> Lionel Laské; <a href="mailto:sugar-devel@lists.sugarlabs.org" target="_blank">sugar-devel@lists.sugarlabs.org</a><br><b>Objet :</b> Re: [Sugar-devel] EllipsizeMode error trying to port an activity to Gtk3<u></u><u></u></span></p>
<div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">If it turns out to be that please close the ticket.<u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p>
<div><p class="MsoNormal">On 9 June 2013 13:17, Walter Bender <<a href="mailto:walter.bender@gmail.com" target="_blank">walter.bender@gmail.com</a>> wrote:<u></u><u></u></p><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">yes. I had a similar error with activities that inadvertently had some<br>mixed code between gtk2 and gtk3.<br><br>-walter<u></u><u></u></p><div><div><p class="MsoNormal"><br>On Sun, Jun 9, 2013 at 5:44 AM, Daniel Narvaez <<a href="mailto:dwnarvaez@gmail.com" target="_blank">dwnarvaez@gmail.com</a>> wrote:<br>
> Please push your port somewhere. It appear to work fine with existing<br>> activities. Something to be careful about is that you are not loading any<br>> old gobject stuff (not in gi.*), you can't mix them.<br>
><br>><br>> On 9 June 2013 10:31, <<a href="mailto:lionel@olpc-france.org" target="_blank">lionel@olpc-france.org</a>> wrote:<br>>><br>>><br>>><br>>> Inspired by <a href="http://bugs.sugarlabs.org/ticket/3744" target="_blank">http://bugs.sugarlabs.org/ticket/3744</a>, I’ve temporarily solved<br>
>> the issue myself by commenting following lines in sugar3/graphics/palette.py<br>>><br>>><br>>><br>>> Lionel.<br>>><br>>><br>>><br>>><br>>><br>
>> 133 #if text_maxlen > 0:<br>>><br>>> 134 # self._label.set_max_width_chars(text_maxlen)<br>>><br>>> 135 # self._label.set_ellipsize(Pango.EllipsizeMode.MIDDLE)<br>
>><br>>> 136 labels_box.pack_start(self._label, True, True, 0)<br>>><br>>> 137<br>>><br>>> 138 self._secondary_label = Gtk.Label()<br>>><br>>> 139 self._secondary_label.set_alignment(0, 0.5)<br>
>><br>>> 140<br>>><br>>> 141 #if text_maxlen > 0:<br>>><br>>> 142 # self._secondary_label.set_max_width_chars(text_maxlen)<br>>><br>>> 143 #<br>>> self._secondary_label.set_ellipsize(Pango.EllipsizeMode.END)<br>
>><br>>><br>>><br>>><br>>><br>>><br>>><br>>><br>>><br>>><br>>><br>>> De : Lionel Laské [mailto:<a href="mailto:lionel.laske@gmail.com" target="_blank">lionel.laske@gmail.com</a>] De la part de<br>
>> <a href="mailto:lionel@olpc-france.org" target="_blank">lionel@olpc-france.org</a><br>>> Envoyé : dimanche 9 juin 2013 09:47<br>>> À : <a href="mailto:sugar-devel@lists.sugarlabs.org" target="_blank">sugar-devel@lists.sugarlabs.org</a><br>
>> Objet : EllipsizeMode error trying to port an activity to Gtk3<br>>><br>>><br>>><br>>><br>>><br>>> Hi all,<br>>><br>>><br>>><br>>> I’m trying to port an activity to Gtk3 on the latest sugar-build.<br>
>><br>>> I’ve imported all sugar3.*.<br>>><br>>> I’ve substituted all gtk to gi.repository import gtk.<br>>><br>>> BTW I’m stick on a strange error on EllipsizeMode in Pango (see below).<br>
>><br>>> Does I miss something?<br>>><br>>><br>>><br>>> Lionel.<br>>><br>>><br>>><br>>><br>>><br>>><br>>><br>>> /usr/lib64/python2.7/site-packages/gobject/constants.py:24: Warning:<br>
>> g_boxed_type_register_static: assertion `g_type_from_name (name) == 0'<br>>> failed<br>>><br>>> import gobject._gobject<br>>><br>>> Traceback (most recent call last):<br>>><br>
>> File "/home/fedora/sugar-build/build/out/install/bin/sugar-activity",<br>>> line 161, in <module><br>>><br>>> main()<br>>><br>>> File "/home/fedora/sugar-build/build/out/install/bin/sugar-activity",<br>
>> line 156, in main<br>>><br>>> instance = create_activity_instance(activity_constructor,<br>>> activity_handle)<br>>><br>>> File "/home/fedora/sugar-build/build/out/install/bin/sugar-activity",<br>
>> line 42, in create_activity_instance<br>>><br>>> activity = constructor(handle)<br>>><br>>> File "/home/fedora/Activities/Roots.activity/activity.py", line 73, in<br>>> __init__<br>
>><br>>> activity_button = ActivityToolbarButton(self)<br>>><br>>> File<br>>> "/home/fedora/sugar-build/build/out/install/lib/python2.7/site-packages/sugar3/activity/widgets.py",<br>
>> line 74, in __init__<br>>><br>>> toolbar = ActivityToolbar(activity, orientation_left=True)<br>>><br>>> File<br>>> "/home/fedora/sugar-build/build/out/install/lib/python2.7/site-packages/sugar3/activity/widgets.py",<br>
>> line 333, in __init__<br>>><br>>> description_item = DescriptionItem(activity)<br>>><br>>> File<br>>> "/home/fedora/sugar-build/build/out/install/lib/python2.7/site-packages/sugar3/activity/widgets.py",<br>
>> line 233, in __init__<br>>><br>>> self.set_tooltip(_('Description'))<br>>><br>>> File<br>>> "/home/fedora/sugar-build/build/out/install/lib/python2.7/site-packages/sugar3/graphics/toolbutton.py",<br>
>> line 93, in set_tooltip<br>>><br>>> self.palette = Palette(tooltip)<br>>><br>>> File<br>>> "/home/fedora/sugar-build/build/out/install/lib/python2.7/site-packages/sugar3/graphics/palette.py",<br>
>> line 135, in __init__<br>>><br>>> self._label.set_ellipsize(Pango.EllipsizeMode.MIDDLE)<br>>><br>>> AttributeError: type object 'EllipsizeMode' has no attribute 'MIDDLE'<br>
>><br>>> Exited with status 1, pid 17010 data (None, <open file '<fdopen>', mode<br>>> 'w' at 0x2438030>,<br>>> dbus.ByteArray('2a46048ae724acdfc03e3b0b26e3e3ebacf4f38b', variant_level=1))<br>
>><br>>><br>>> _______________________________________________<br>>> Sugar-devel mailing list<br>>> <a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">Sugar-devel@lists.sugarlabs.org</a><br>
>> <a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>>><br>><br>><br>><br>> --<br>> Daniel Narvaez<br>><br>> _______________________________________________<br>
> Sugar-devel mailing list<br>> <a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">Sugar-devel@lists.sugarlabs.org</a><br>> <a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
><br><br><br><br>--<u></u><u></u></p></div></div><p class="MsoNormal"><span><span style="color:#888888">Walter Bender</span></span><span style="color:#888888"><br><span>Sugar Labs</span><br><span><a href="http://www.sugarlabs.org" target="_blank">http://www.sugarlabs.org</a></span></span><u></u><u></u></p>
</blockquote></div><p class="MsoNormal"><br><br clear="all"><br>-- <br>Daniel Narvaez<u></u><u></u></p></div></div></div></div></div></blockquote></div><br><br clear="all"><br>-- <br>Daniel Narvaez<br>
</div>