[Sugar-devel] [PATCH shell] Get back spacing between activity icon and hover border
Manuel Quiñones
manuq at laptop.org
Wed Oct 3 14:18:11 EDT 2012
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 a367ab6..e939d11 100644
--- a/src/jarabe/desktop/favoriteslayout.py
+++ b/src/jarabe/desktop/favoriteslayout.py
@@ -377,13 +377,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 17d014e..6d0da17 100644
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -443,10 +443,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()
--
1.7.11.4
More information about the Sugar-devel
mailing list