Fix snowflake layout

This commit is contained in:
Marco Pesenti Gritti 2007-09-12 18:50:55 +02:00
parent 8aa31a6095
commit bf1aea368f
2 changed files with 15 additions and 13 deletions

1
NEWS
View File

@ -1,3 +1,4 @@
* #3053: Fix the distance between the clustered xos and the activity. (marco)
* Make the sizes of mesh icons match Eben spec. (marco)
* #3364: When joining an activity, pick up its sharing scope, so we don't
try to re-share already shared activities in order to invite someone (smcv)

View File

@ -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'
@ -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