From 99584733b571af09675ea7b58af9f6a9c3181926 Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann <humitos@gmail.com>
Date: Fri, 23 Nov 2012 17:42:24 -0300
Subject: [PATCH sugar] Recalculate the position of the icons SL #3925
When an Alert is shown in the RingLayout the position of the icons are
re-calculated to keep the same position than before.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
src/jarabe/desktop/favoriteslayout.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py
index 635a534..1d4d63e 100644
a
|
b
|
class RingLayout(ViewLayout): |
386 | 386 | radius, icon_size = self._calculate_radius_and_icon_size(len(children)) |
387 | 387 | |
388 | 388 | children.sort(self.compare_activities) |
| 389 | height = allocation.height + allocation.y |
389 | 390 | for n in range(len(children)): |
390 | 391 | child = children[n] |
391 | 392 | |
392 | 393 | x, y = self._calculate_position(radius, icon_size, n, |
393 | 394 | len(children), allocation.width, |
394 | | allocation.height) |
| 395 | height) |
| 396 | |
| 397 | # This container may be offset from the top by a certain amount |
| 398 | # (e.g. for a toolbar at the top of the screen). Adjust the |
| 399 | # center-point for that |
| 400 | y -= allocation.y |
| 401 | |
| 402 | # Now add half of the icon height. This gives us the y |
| 403 | # coordinate for the top of the icon. |
| 404 | y += icon_size / 2 |
| 405 | |
395 | 406 | child.set_size(icon_size) |
396 | 407 | new_width = child.get_preferred_width()[0] |
397 | 408 | new_height = child.get_preferred_height()[0] |