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): |
237 | 237 | def _calculate_radius_and_icon_size(self, children_count): |
238 | 238 | """ Adjust the ring or spiral radius and icon size as needed. """ |
239 | 239 | self._spiral_mode = False |
| 240 | # Begin by increasing the radius. |
240 | 241 | distance = style.MEDIUM_ICON_SIZE + style.DEFAULT_SPACING * \ |
241 | 242 | _ICON_SPACING_FACTORS[_ICON_SIZES.index(style.MEDIUM_ICON_SIZE)] |
242 | 243 | radius = max(children_count * distance / (2 * math.pi), _MINIMUM_RADIUS) |
243 | 244 | if radius < _MAXIMUM_RADIUS: |
244 | 245 | return radius, style.MEDIUM_ICON_SIZE |
245 | 246 | |
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 |
251 | 254 | |
252 | | # Only switch to a spiral when using the Ring layout. |
| 255 | # Finally, switch to a spiral, but only when using the Ring layout. |
253 | 256 | if self.key == 'ring-layout': |
254 | 257 | self._spiral_mode = True |
255 | 258 | icon_size = style.STANDARD_ICON_SIZE |