Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/graphics
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2007-04-27 23:15:47 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2007-04-27 23:15:47 (GMT)
commit7c8ec7a84566c0775e955dc81b62dca1465663da (patch)
tree18ed162520224136ae5df888afc4fd7a8448b3ad /sugar/graphics
parent395d3f5c9654d0fe9e07a469e0dac533d31c2301 (diff)
Fix height request
Diffstat (limited to 'sugar/graphics')
-rw-r--r--sugar/graphics/snowflakebox.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/sugar/graphics/snowflakebox.py b/sugar/graphics/snowflakebox.py
index 14f4559..af68d56 100644
--- a/sugar/graphics/snowflakebox.py
+++ b/sugar/graphics/snowflakebox.py
@@ -69,27 +69,30 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
self.set_position(child, int(x), int(y))
- def do_get_height_request(self, for_width):
- hippo.CanvasBox.do_get_height_request(self, for_width)
-
- height = for_width
-
- return (height, height)
-
- def do_get_width_request(self):
- hippo.CanvasBox.do_get_width_request(self)
-
+ def _calculate_size(self):
max_child_size = 0
+
for child in self.get_children():
[min_w, natural_w] = child.get_width_request()
[min_h, natural_h] = child.get_height_request(min_w)
max_child_size = max (max_child_size, min_w)
max_child_size = max (max_child_size, min_h)
- width = self._get_radius() * 2 + \
- max_child_size + _FLAKE_DISTANCE * 2
+ return self._get_radius() * 2 + max_child_size + _FLAKE_DISTANCE * 2
- return (width, width)
+ def do_get_height_request(self, for_width):
+ hippo.CanvasBox.do_get_height_request(self, for_width)
+
+ size = self._calculate_size()
+
+ return (size, size)
+
+ def do_get_width_request(self):
+ hippo.CanvasBox.do_get_width_request(self)
+
+ size = self._calculate_size()
+
+ return (size, size)
def do_allocate(self, width, height, origin_changed):
hippo.CanvasBox.do_allocate(self, width, height, origin_changed)