diff options
author | Manuel Kaufmann <humitos@gmail.com> | 2012-11-23 20:42:24 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@laptop.org> | 2013-02-12 11:11:39 (GMT) |
commit | 7f239c3fe6a1fc728667a1aab5cf2b38a5044c6a (patch) | |
tree | dd065c0d91de431d7d6b077219fb949d98de68b8 | |
parent | f095dc015beb3b103e3f8daf2981b542ad854200 (diff) |
RingLayout: recalculate the position of the icons for an alert, SL #3925
When an Alert is shown in the RingLayout the position of the icons is
re-calculated to keep the same position than before.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Reviewed-by: Manuel QuiƱones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r-- | src/jarabe/desktop/favoriteslayout.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py index 635a534..38488e0 100644 --- a/src/jarabe/desktop/favoriteslayout.py +++ b/src/jarabe/desktop/favoriteslayout.py @@ -386,12 +386,22 @@ class RingLayout(ViewLayout): radius, icon_size = self._calculate_radius_and_icon_size(len(children)) children.sort(self.compare_activities) + height = allocation.height + allocation.y for n in range(len(children)): child = children[n] x, y = self._calculate_position(radius, icon_size, n, len(children), allocation.width, - allocation.height) + height) + + # This container may be offset from the top by a certain amount + # (e.g. for an alert). Adjust the center-point for that + y -= allocation.y + + # Now add half of the icon height. This gives us the y + # coordinate for the top of the icon. + y += icon_size / 2 + child.set_size(icon_size) new_width = child.get_preferred_width()[0] new_height = child.get_preferred_height()[0] |