[Sugar-devel] [PATCH] EventIcon: Have a default create_palette method
Simon Schampijer
simon at schampijer.de
Thu Jun 21 08:30:22 EDT 2012
Great, all three patches pushed, thanks a lot for the quick review.
Regards,
Simon
On 06/21/2012 02:06 PM, Manuel Quiñones wrote:
> 2012/6/21 Benjamin Berg <benzea at sugarlabs.org>:
>> On Thu, 2012-06-21 at 10:52 +0200, Simon Schampijer wrote:
>>> The create_palette mechanism allows to create
>>> palettes on demand and not for each icon upfront
>>> whether it will be needed or not.
>>>
>>> If you hover over an EventIcon and there is no
>>> palette already associated with the Invoker, the Invoker
>>> will call create_palette to see if it can be created
>>> on demand. With this patch the EventIcon will return None
>>> here (see as well CellRendererIcon or ToggleToolButton which
>>> are having the same default behavior).
>>> When subclassing EventIcon the create_palette method can
>>> be overwritten and a Palette returned (see for example
>>> the ActivityIcon in the HomeView).
>>>
>>> Without this patch you can see tracebacks when hovering
>>> over the EventIcon because the Invoker tries to call
>>> create_palette.
>>
>> Duck typing at its best. Of course EventIcon needs to implement the
>> function.
>
> :)
>
> And here the test script from the previous patch is useful again. The
> traceback """AttributeError: 'EventIcon' object has no attribute
> 'create_palette'""" is gone.
>
>>> Signed-off-by: Simon Schampijer <simon at laptop.org>
>> Reviewed-by: Benjamin Berg <benzea at sugarlabs.org>
> Reviewed-by: Manuel Quiñones <manuq at laptop.org>
>
>>
>> _______________________________________________
>> Sugar-devel mailing list
>> Sugar-devel at lists.sugarlabs.org
>> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>
>
More information about the Sugar-devel
mailing list