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-06 09:17:38 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-10-06 09:17:38 (GMT)
commit953b5bf286dd251d07eb5d72c9c5c7aed88d76e2 (patch)
tree9ad498586ce2e455feda1c39672b7dbf8899ee2a /sugar
parentb33a1c141f8e47b7d57a033baa9f0a44ea8d8834 (diff)
Some fixes
Diffstat (limited to 'sugar')
-rw-r--r--sugar/graphics/snowflakebox.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/sugar/graphics/snowflakebox.py b/sugar/graphics/snowflakebox.py
index 4ee22c5..48e337a 100644
--- a/sugar/graphics/snowflakebox.py
+++ b/sugar/graphics/snowflakebox.py
@@ -10,7 +10,7 @@ _FLAKE_DISTANCE = 6
class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
__gtype_name__ = 'SugarSnowflakeBox'
def __init__(self, **kwargs):
- CanvasBox.__init__(self, **kwargs)
+ hippo.CanvasBox.__init__(self, **kwargs)
self._root = None
self._r = 0
@@ -28,10 +28,10 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
def _layout_child(self, child, index):
r = self._r
- if (len(box.get_children()) > 10):
+ if (len(self.get_children()) > 10):
r += _FLAKE_DISTANCE * (index % 3)
- angle = 2 * math.pi / len(box.get_children()) * index
+ angle = 2 * math.pi / len(self.get_children()) * index
[width, height] = child.get_allocation()
x = self._cx + math.cos(angle) * r - (width / 2)
@@ -40,8 +40,10 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
self.move(child, int(x), int(y))
def do_get_width_request(self):
+ hippo.CanvasBox.do_get_width_request(self)
+
max_child_size = 0
- for child in box.get_children():
+ for child in self.get_children():
[width, height] = child.get_allocation()
max_child_size = max (max_child_size, width)
max_child_size = max (max_child_size, height)
@@ -49,19 +51,21 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
return self._r * 2 + max_child_size + _FLAKE_DISTANCE * 2
def do_get_height_request(self, width):
+ hippo.CanvasBox.do_get_height_request(self, width)
+
return width
def do_allocate(self, width, height):
- self._r = _BASE_RADIUS + _CHILDREN_FACTOR * len(box.get_children())
+ self._r = _BASE_RADIUS + _CHILDREN_FACTOR * len(self.get_children())
hippo.CanvasBox.do_allocate(self, width, height)
- self._cx = self.get_width_request() / 2
- self._cy = self.get_height_request() / 2
+ self._cx = width / 2
+ self._cy = height / 2
- self._layout_root(box)
+ self._layout_root()
index = 0
- for child in box.get_children():
+ for child in self.get_children():
self._layout_child(child, index)
index += 1