Ticket #3925: 0001-Recalculate-the-position-of-the-icons-SL-3925.patch

File 0001-Recalculate-the-position-of-the-icons-SL-3925.patch, 1.8 KB (added by humitos, 11 years ago)

Leave the icons at the same place as erikos said. This patch just works for the RingLayout

  • src/jarabe/desktop/favoriteslayout.py

    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): 
    386386        radius, icon_size = self._calculate_radius_and_icon_size(len(children))
    387387
    388388        children.sort(self.compare_activities)
     389        height = allocation.height + allocation.y
    389390        for n in range(len(children)):
    390391            child = children[n]
    391392
    392393            x, y = self._calculate_position(radius, icon_size, n,
    393394                                            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
    395406            child.set_size(icon_size)
    396407            new_width = child.get_preferred_width()[0]
    397408            new_height = child.get_preferred_height()[0]