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 <mpg@redhat.com>2007-03-14 02:19:24 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-03-14 02:19:24 (GMT)
commit4960ddae252c6b6a41a510b8963d026d9e9b13bc (patch)
treed4a9c073413c50a740b83075bbfb555edc6a04ae /sugar
parent9d8fa7d42ab1f049cc1320c4b1d1700178059348 (diff)
Adapt to the new hippo canvas sizing API
Diffstat (limited to 'sugar')
-rw-r--r--sugar/graphics/canvasicon.py8
-rw-r--r--sugar/graphics/optionmenu.py10
-rw-r--r--sugar/graphics/snowflakebox.py16
3 files changed, 11 insertions, 23 deletions
diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py
index 26b2357..03b0d2b 100644
--- a/sugar/graphics/canvasicon.py
+++ b/sugar/graphics/canvasicon.py
@@ -327,11 +327,11 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
def do_get_content_width_request(self):
[width, height] = self._get_icon_size()
- return width
+ return (width, width)
def do_get_content_height_request(self, for_width):
[width, height] = self._get_icon_size()
- return height
+ return (height, height)
def do_button_press_event(self, event):
self.emit_activated()
@@ -373,8 +373,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
[x, y] = context.translate_to_screen(self)
# TODO: Any better place to do this?
- popup.props.box_width = max(popup.get_width_request(),
- self.get_width_request())
+ [min_width, natural_width] = self.get_width_request()
+ popup.props.box_width = max(popup.get_width_request(), min_width)
[width, height] = self.get_allocation()
y += height
diff --git a/sugar/graphics/optionmenu.py b/sugar/graphics/optionmenu.py
index 3ffaf4a..197669f 100644
--- a/sugar/graphics/optionmenu.py
+++ b/sugar/graphics/optionmenu.py
@@ -104,16 +104,6 @@ class OptionMenu(hippo.CanvasBox, hippo.CanvasItem):
self._menu.add_item(menu_item)
- def do_get_width_request(self):
- max_width = max(self._canvas_text.do_get_content_width_request(self._canvas_text),
- self._menu.do_get_content_width_request(self._menu))
-
- self._canvas_text.props.box_width = max_width
-
- current_width = hippo.CanvasBox.do_get_width_request(self)
- self._menu.props.box_width = current_width
- return current_width
-
def add_separator(self):
self._menu.add_separator()
diff --git a/sugar/graphics/snowflakebox.py b/sugar/graphics/snowflakebox.py
index f0d446c..540b8b0 100644
--- a/sugar/graphics/snowflakebox.py
+++ b/sugar/graphics/snowflakebox.py
@@ -72,17 +72,15 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
max_child_size = 0
for child in self.get_children():
- width = child.get_width_request()
- height = child.get_height_request(width)
- max_child_size = max (max_child_size, width)
- max_child_size = max (max_child_size, height)
+ [min_w, natural_w] = child.get_width_request()
+ [min_h, natural_h] = child.get_height_request(width)
+ max_child_size = max (max_child_size, min_w)
+ max_child_size = max (max_child_size, min_h)
- return self._get_radius() * 2 + \
- max_child_size + _FLAKE_DISTANCE * 2
+ width = self._get_radius() * 2 + \
+ max_child_size + _FLAKE_DISTANCE * 2
- def do_get_height_request(self, width):
- hippo.CanvasBox.do_get_height_request(self, width)
- return width
+ return [width, width]
def do_allocate(self, width, height, origin_changed):
hippo.CanvasBox.do_allocate(self, width, height, origin_changed)