Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-09-12 16:50:55 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-09-12 16:50:55 (GMT)
commitbf1aea368f2395177f56a790d75485e7dd38f49e (patch)
treec0e94941e6ce128c338d2942708ff26f04e1af49 /shell
parent8aa31a6095430d2dc36a39b4d0d1d3133e434c01 (diff)
Fix snowflake layout
Diffstat (limited to 'shell')
-rw-r--r--shell/view/home/snowflakelayout.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/shell/view/home/snowflakelayout.py b/shell/view/home/snowflakelayout.py
index 7db39a6..7e59bf2 100644
--- a/shell/view/home/snowflakelayout.py
+++ b/shell/view/home/snowflakelayout.py
@@ -22,8 +22,8 @@ import hippo
from sugar.graphics import style
-_BASE_RADIUS = style.zoom(25)
-_CHILDREN_FACTOR = 1
+_BASE_DISTANCE = style.zoom(15)
+_CHILDREN_FACTOR = style.zoom(3)
class SnowflakeLayout(gobject.GObject,hippo.CanvasLayout):
__gtype_name__ = 'SugarSnowflakeLayout'
@@ -52,7 +52,7 @@ class SnowflakeLayout(gobject.GObject,hippo.CanvasLayout):
return (size, size)
def do_get_width_request(self):
- size = self._calculate_size()
+ size = self._calculate_size()
return (size, size)
def do_allocate(self, x, y, width, height,
@@ -86,19 +86,20 @@ class SnowflakeLayout(gobject.GObject,hippo.CanvasLayout):
index += 1
def _get_radius(self):
- return int(_BASE_RADIUS + _CHILDREN_FACTOR * self._nflakes)
+ radius = int(_BASE_DISTANCE + _CHILDREN_FACTOR * self._nflakes)
+ for child in self._box.get_layout_children():
+ if child.is_center:
+ [min_w, child_w] = child.get_width_request()
+ [min_h, child_h] = child.get_height_request(child_w)
+ radius += max(child_w, child_h) / 2
+
+ return radius
def _calculate_size(self):
- size = 0
+ thickness = 0
for child in self._box.get_layout_children():
[min_width, child_width] = child.get_width_request()
[min_height, child_height] = child.get_height_request(child_width)
+ thickness = max(thickness, max(child_width, child_height))
- new_size = max(child_width, child_height)
- if not child.is_center:
- new_size += self._get_radius() * 2
-
- if new_size > size:
- size = new_size
-
- return size
+ return self._get_radius() * 2 + thickness