Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-10-09 23:14:24 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-10-09 23:14:24 (GMT)
commit279ebda451f69edb862aec7590507ee10d65af84 (patch)
tree4edb6f95a37c137b09bdbb0f5c5ac33be11855d1 /sugar
parent7fa1b02a8254609aeff5f33999b52662e820b492 (diff)
Fix children counting
Diffstat (limited to 'sugar')
-rw-r--r--sugar/graphics/snowflakebox.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/sugar/graphics/snowflakebox.py b/sugar/graphics/snowflakebox.py
index c9b73de..8ad2664 100644
--- a/sugar/graphics/snowflakebox.py
+++ b/sugar/graphics/snowflakebox.py
@@ -21,7 +21,7 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
return [width / 2, height / 2]
def _get_radius(self):
- return _BASE_RADIUS + _CHILDREN_FACTOR * len(self.get_children())
+ return _BASE_RADIUS + _CHILDREN_FACTOR * self._get_n_children()
def _layout_root(self):
[width, height] = self._root.get_allocation()
@@ -32,12 +32,15 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
self.move(self._root, int(x), int(y))
+ def _get_n_children(self):
+ return len(self.get_children()) - 1
+
def _layout_child(self, child, index):
r = self._get_radius()
- if (len(self.get_children()) > 10):
+ if (self._get_n_children() > 10):
r += _FLAKE_DISTANCE * (index % 3)
- angle = 2 * math.pi / len(self.get_children()) * index
+ angle = 2 * math.pi * index / self._get_n_children()
[width, height] = child.get_allocation()
[cx, cy] = self._get_center()