Ticket #2143: 0001-scale-icons-continuously-before-switching-to-spiral.patch

File 0001-scale-icons-continuously-before-switching-to-spiral.patch, 2.1 KB (added by walter, 14 years ago)

scale icons continuously before invoking spiral

  • src/jarabe/desktop/favoriteslayout.py

    From bb1156f1741ade95f6b0d3f51e78fbc01e629ea2 Mon Sep 17 00:00:00 2001
    From: Walter Bender <walter@sugarlabs.org>
    Date: Tue, 24 Aug 2010 09:31:06 -0400
    Subject: [PATCH] scale icons continuously before switching to spiral
    
    ---
     src/jarabe/desktop/favoriteslayout.py |   15 +++++++++------
     1 files changed, 9 insertions(+), 6 deletions(-)
    
    diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py
    index 7f4aecb..4c7444d 100644
    a b class RingLayout(FavoritesLayout): 
    237237    def _calculate_radius_and_icon_size(self, children_count):
    238238        """ Adjust the ring or spiral radius and icon size as needed. """
    239239        self._spiral_mode = False
     240        # Begin by increasing the radius.
    240241        distance = style.MEDIUM_ICON_SIZE + style.DEFAULT_SPACING * \
    241242            _ICON_SPACING_FACTORS[_ICON_SIZES.index(style.MEDIUM_ICON_SIZE)]
    242243        radius = max(children_count * distance / (2 * math.pi), _MINIMUM_RADIUS)
    243244        if radius < _MAXIMUM_RADIUS:
    244245            return radius, style.MEDIUM_ICON_SIZE
    245246
    246         distance = style.STANDARD_ICON_SIZE + style.DEFAULT_SPACING * \
    247             _ICON_SPACING_FACTORS[_ICON_SIZES.index(style.STANDARD_ICON_SIZE)]
    248         radius = max(children_count * distance / (2 * math.pi), _MINIMUM_RADIUS)
    249         if radius < _MAXIMUM_RADIUS:
    250             return radius, style.STANDARD_ICON_SIZE
     247        # Continue by shrinking the icon size.
     248        radius = _MAXIMUM_RADIUS
     249        distance = radius * (2 * math.pi) / children_count
     250        icon_size = int(distance - style.DEFAULT_SPACING * \
     251            _ICON_SPACING_FACTORS[_ICON_SIZES.index(style.STANDARD_ICON_SIZE)])
     252        if icon_size >= style.STANDARD_ICON_SIZE:
     253            return radius, icon_size
    251254
    252         # Only switch to a spiral when using the Ring layout.
     255        # Finally, switch to a spiral, but only when using the Ring layout.
    253256        if self.key == 'ring-layout':
    254257            self._spiral_mode = True
    255258            icon_size = style.STANDARD_ICON_SIZE