[Sugar-devel] EllipsizeMode error trying to port an activity to Gtk3

Daniel Narvaez dwnarvaez at gmail.com
Sun Jun 9 10:24:42 EDT 2013


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 :)


On 9 June 2013 16:22, <lionel at olpc-france.org> wrote:

> ** **
>
> Finally solved my issue with a big review of my imports. Thanks.****
>
> ** **
>
> I’ve got a last issue on Pango, no way to found some Pango constants
> (ALIGN_CENTER and WRAP_WORD – view my calls below).****
>
> Any idea where I can found it?****
>
> ** **
>
>                 Lionel.****
>
> ** **
>
> ** **
>
> layout.set_alignment(Pango.ALIGN_CENTER)****
>
>                 layout.set_wrap(Pango.WRAP_WORD)****
>
> ** **
>
> *De :* Daniel Narvaez [mailto:dwnarvaez at gmail.com]
> *Envoyé :* dimanche 9 juin 2013 13:22
> *À :* Walter Bender
> *Cc :* Lionel Laské; sugar-devel at lists.sugarlabs.org
> *Objet :* Re: [Sugar-devel] EllipsizeMode error trying to port an
> activity to Gtk3****
>
> ** **
>
> If it turns out to be that please close the ticket.****
>
> ** **
>
> On 9 June 2013 13:17, Walter Bender <walter.bender at gmail.com> wrote:****
>
> yes. I had a similar error with activities that inadvertently had some
> mixed code between gtk2 and gtk3.
>
> -walter****
>
>
> On Sun, Jun 9, 2013 at 5:44 AM, Daniel Narvaez <dwnarvaez at gmail.com>
> wrote:
> > Please push your port somewhere. It appear to work fine with existing
> > activities. Something to be careful about is that you are not loading any
> > old gobject stuff (not in gi.*), you can't mix them.
> >
> >
> > On 9 June 2013 10:31, <lionel at olpc-france.org> wrote:
> >>
> >>
> >>
> >> Inspired by http://bugs.sugarlabs.org/ticket/3744, I’ve temporarily
> solved
> >> the issue myself by commenting following lines in
> sugar3/graphics/palette.py
> >>
> >>
> >>
> >>                 Lionel.
> >>
> >>
> >>
> >>
> >>
> >> 133        #if text_maxlen > 0:
> >>
> >> 134        #    self._label.set_max_width_chars(text_maxlen)
> >>
> >> 135        #    self._label.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
> >>
> >> 136        labels_box.pack_start(self._label, True, True, 0)
> >>
> >> 137
> >>
> >> 138        self._secondary_label = Gtk.Label()
> >>
> >> 139        self._secondary_label.set_alignment(0, 0.5)
> >>
> >> 140
> >>
> >> 141        #if text_maxlen > 0:
> >>
> >> 142        #    self._secondary_label.set_max_width_chars(text_maxlen)
> >>
> >> 143        #
> >> self._secondary_label.set_ellipsize(Pango.EllipsizeMode.END)
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> De : Lionel Laské [mailto:lionel.laske at gmail.com] De la part de
> >> lionel at olpc-france.org
> >> Envoyé : dimanche 9 juin 2013 09:47
> >> À : sugar-devel at lists.sugarlabs.org
> >> Objet : EllipsizeMode error trying to port an activity to Gtk3
> >>
> >>
> >>
> >>
> >>
> >> Hi all,
> >>
> >>
> >>
> >> I’m trying to port an activity to Gtk3 on the latest sugar-build.
> >>
> >> I’ve imported all sugar3.*.
> >>
> >> I’ve substituted all gtk to gi.repository import gtk.
> >>
> >> BTW I’m stick on a strange error on EllipsizeMode in Pango (see below).
> >>
> >> Does I miss something?
> >>
> >>
> >>
> >>                 Lionel.
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> /usr/lib64/python2.7/site-packages/gobject/constants.py:24: Warning:
> >> g_boxed_type_register_static: assertion `g_type_from_name (name) == 0'
> >> failed
> >>
> >>   import gobject._gobject
> >>
> >> Traceback (most recent call last):
> >>
> >>   File "/home/fedora/sugar-build/build/out/install/bin/sugar-activity",
> >> line 161, in <module>
> >>
> >>     main()
> >>
> >>   File "/home/fedora/sugar-build/build/out/install/bin/sugar-activity",
> >> line 156, in main
> >>
> >>     instance = create_activity_instance(activity_constructor,
> >> activity_handle)
> >>
> >>   File "/home/fedora/sugar-build/build/out/install/bin/sugar-activity",
> >> line 42, in create_activity_instance
> >>
> >>    activity = constructor(handle)
> >>
> >>   File "/home/fedora/Activities/Roots.activity/activity.py", line 73, in
> >> __init__
> >>
> >>     activity_button = ActivityToolbarButton(self)
> >>
> >>   File
> >>
> "/home/fedora/sugar-build/build/out/install/lib/python2.7/site-packages/sugar3/activity/widgets.py",
> >> line 74, in __init__
> >>
> >>     toolbar = ActivityToolbar(activity, orientation_left=True)
> >>
> >>   File
> >>
> "/home/fedora/sugar-build/build/out/install/lib/python2.7/site-packages/sugar3/activity/widgets.py",
> >> line 333, in __init__
> >>
> >>     description_item = DescriptionItem(activity)
> >>
> >>   File
> >>
> "/home/fedora/sugar-build/build/out/install/lib/python2.7/site-packages/sugar3/activity/widgets.py",
> >> line 233, in __init__
> >>
> >>     self.set_tooltip(_('Description'))
> >>
> >>   File
> >>
> "/home/fedora/sugar-build/build/out/install/lib/python2.7/site-packages/sugar3/graphics/toolbutton.py",
> >> line 93, in set_tooltip
> >>
> >>     self.palette = Palette(tooltip)
> >>
> >>   File
> >>
> "/home/fedora/sugar-build/build/out/install/lib/python2.7/site-packages/sugar3/graphics/palette.py",
> >> line 135, in __init__
> >>
> >>     self._label.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
> >>
> >> AttributeError: type object 'EllipsizeMode' has no attribute 'MIDDLE'
> >>
> >> Exited with status 1, pid 17010 data (None, <open file '<fdopen>', mode
> >> 'w' at 0x2438030>,
> >> dbus.ByteArray('2a46048ae724acdfc03e3b0b26e3e3ebacf4f38b',
> variant_level=1))
> >>
> >>
> >> _______________________________________________
> >> Sugar-devel mailing list
> >> Sugar-devel at lists.sugarlabs.org
> >> http://lists.sugarlabs.org/listinfo/sugar-devel
> >>
> >
> >
> >
> > --
> > Daniel Narvaez
> >
> > _______________________________________________
> > Sugar-devel mailing list
> > Sugar-devel at lists.sugarlabs.org
> > http://lists.sugarlabs.org/listinfo/sugar-devel
> >
>
>
>
> --****
>
> Walter Bender
> Sugar Labs
> http://www.sugarlabs.org****
>
>
>
>
> --
> Daniel Narvaez****
>



-- 
Daniel Narvaez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130609/8234060f/attachment-0001.html>


More information about the Sugar-devel mailing list