[Sugar-devel] [PATCH shell 1/3] Get back spacing between activity icon and hover border

Manuel Quiñones manuq at laptop.org
Fri Oct 5 09:09:15 EDT 2012


2012/10/5 Simon Schampijer <simon at schampijer.de>:
> All these three patches are absolutely fantastic work, please go ahead and
> make them available to us :)
>
> /me can't wait to use it in his every day Sugar life

Pushed.

manuq is very happy :)

> Regards,
>    Simon
>
>
> On 10/05/2012 05:54 AM, Manuel Quiñones wrote:
>>
>> size_request is deprecated and get_preferred_size should be used
>> instead.  We override the methods of EventIcon get_preferred_width and
>> get_preferred_height because they are simpler to use from python, no
>> need to make a requisition object, just return integers.
>>
>> Signed-off-by: Manuel Quiñones <manuq at laptop.org>
>> ---
>>   src/jarabe/desktop/favoriteslayout.py |  7 ++++---
>>   src/jarabe/desktop/favoritesview.py   | 13 +++++++++----
>>   2 files changed, 13 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/jarabe/desktop/favoriteslayout.py
>> b/src/jarabe/desktop/favoriteslayout.py
>> index c2bf8f5..e9f614e 100644
>> --- a/src/jarabe/desktop/favoriteslayout.py
>> +++ b/src/jarabe/desktop/favoriteslayout.py
>> @@ -380,13 +380,14 @@ class RingLayout(ViewLayout):
>>               x, y = self._calculate_position(radius, icon_size, n,
>>                                               len(children),
>> allocation.width,
>>                                               allocation.height)
>> -            child.size_request()
>>               child.set_size(icon_size)
>> +            new_width = child.get_preferred_width()[0]
>> +            new_height = child.get_preferred_height()[0]
>>               child_allocation = Gdk.Rectangle()
>>               child_allocation.x = allocation.x + x
>>               child_allocation.y = allocation.y + y
>> -            child_allocation.width = icon_size
>> -            child_allocation.height = icon_size
>> +            child_allocation.width = new_width
>> +            child_allocation.height = new_height
>>               child.size_allocate(child_allocation)
>>
>>       def compare_activities(self, icon_a, icon_b):
>> diff --git a/src/jarabe/desktop/favoritesview.py
>> b/src/jarabe/desktop/favoritesview.py
>> index cfe18eb..b727e0e 100644
>> --- a/src/jarabe/desktop/favoritesview.py
>> +++ b/src/jarabe/desktop/favoritesview.py
>> @@ -447,10 +447,15 @@ class ActivityIcon(EventIcon):
>>                            allocation.width,
>>                            allocation.height)
>>
>> -    def do_size_request(self, req):
>> -        EventIcon.do_size_request(self, req)
>> -        req.height += ActivityIcon._BORDER_WIDTH * 2
>> -        req.width += ActivityIcon._BORDER_WIDTH * 2
>> +    def do_get_preferred_width(self):
>> +        width = EventIcon.do_get_preferred_width(self)[0]
>> +        width += ActivityIcon._BORDER_WIDTH * 2
>> +        return (width, width)
>> +
>> +    def do_get_preferred_height(self):
>> +        height = EventIcon.do_get_preferred_height(self)[0]
>> +        height += ActivityIcon._BORDER_WIDTH * 2
>> +        return (height, height)
>>
>>       def __button_release_event_cb(self, icon, event):
>>           self._activate()
>>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel



-- 
.. manuq ..


More information about the Sugar-devel mailing list