[Sugar-devel] [DESIGN] Replace combo box in Journal Search

Walter Bender walter.bender at gmail.com
Wed Feb 19 08:51:41 EST 2014


On Wed, Feb 19, 2014 at 6:48 AM, Manuel Quiñones <manuq at laptop.org> wrote:
> 2014-02-18 19:01 GMT-03:00 Walter Bender <walter.bender at gmail.com>:
>> I've hit to roadblocks:
>> (1) As I mentioned, for some reason, I cannot get ellipsis to work on
>> the toolbar label (it works elsewhere).
>
> Strange.  Toolitems should ellipsize if needed.  What is the
> consequence?  The items fall outside the toolbar?

class ListPaletteToolButton(ToolbarButton):

    def __init__(self, page=None, label='', icon_name=''):
        ToolbarButton.__init__(self, page=page, icon_name=icon_name)
        self.set_size_request(style.GRID_CELL_SIZE * 3, -1)
        self.set_is_important(True)

        self._label_widget = Gtk.Label()
        self._label_widget.set_alignment(0.0, 0.5)
        self._label_widget.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
        self._label_widget.set_max_width_chars(20)
        self._label_widget.set_use_markup(True)
        self._label_widget.set_markup(label)
        self.set_label_widget(self._label_widget)
        self._label_widget.show()

    def set_label_widget_label(self, label):
        self._label_widget.set_markup(label)

Until the label is too long, the size request is honored. Then,
instead of ellipsis, the button gets wider on the toolbar. I use
exactly the same logic in the palette and the ellipsis works. (Except
in that case, the label is not a child widget in the button.)

>
>> (2) It seems that whatever page is attached to the toolbar button is
>> resized to full screen width. I've not been able to figure out a
>> workaround.
>
> Can you show us the code?

Nothing special. Just using a toolitem instead of a toolbar as the
"page". Using a button palette works honors the palette size request.
Using the toolbar page make the widget the full width of the screen.

I'll push my branch onto git.

-walter

>
>>
>> -walter
>>
>> On Tue, Feb 18, 2014 at 12:44 PM, Walter Bender <walter.bender at gmail.com> wrote:
>>> yes... except that since I switched to using the new approach,
>>> ellipsis stopped working on the toolbar (works on the palette).
>>>
>>> -walter
>>>
>>> On Tue, Feb 18, 2014 at 12:26 PM, Gonzalo Odiard <godiard at sugarlabs.org> wrote:
>>>> What happen with long activity names? Is ellipzed?
>>>>
>>>> Gonzalo
>>>>
>>>>
>>>> On Tue, Feb 18, 2014 at 12:45 PM, Walter Bender <walter.bender at gmail.com>
>>>> wrote:
>>>>>
>>>>> I've been working on another feature for 1.02. The idea is to replace
>>>>> the clumsy combo boxes used in Journal search with simple palettes.
>>>>> There are several mock ups on [1]. So far, generally positive feedback
>>>>> from the design team.
>>>>>
>>>>> regards.
>>>>>
>>>>> -walter
>>>>>
>>>>>
>>>>> [1]
>>>>> http://wiki.sugarlabs.org/go/Features/Replace_combo_box_in_journal_search
>>>>> --
>>>>> Walter Bender
>>>>> Sugar Labs
>>>>> http://www.sugarlabs.org
>>>>> _______________________________________________
>>>>> Sugar-devel mailing list
>>>>> Sugar-devel at lists.sugarlabs.org
>>>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Gonzalo Odiard
>>>>
>>>> SugarLabs - Learning Software for children
>>>
>>>
>>>
>>> --
>>> Walter Bender
>>> Sugar Labs
>>> http://www.sugarlabs.org
>>
>>
>>
>> --
>> Walter Bender
>> Sugar Labs
>> http://www.sugarlabs.org
>> _______________________________________________
>> Sugar-devel mailing list
>> Sugar-devel at lists.sugarlabs.org
>> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>
>
> --
> .. manuq ..



-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org


More information about the Sugar-devel mailing list