Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2011-10-30 16:32:51 (GMT)
committer Daniel Drake <dsd@laptop.org>2011-10-30 16:32:51 (GMT)
commit7f74e024613800028a32bfe3a360e9de77734311 (patch)
tree403fc3af79d30d63651d58c93cb57fbaec121635
parent21a820497b3e55cb8a007e5f10e36a721734db8d (diff)
some size_request fixes
-rw-r--r--src/sugar3/graphics/alert.py11
-rw-r--r--src/sugar3/graphics/toolbarbox.py4
-rw-r--r--src/sugar3/graphics/tray.py17
3 files changed, 19 insertions, 13 deletions
diff --git a/src/sugar3/graphics/alert.py b/src/sugar3/graphics/alert.py
index 239afc2..a7d57f1 100644
--- a/src/sugar3/graphics/alert.py
+++ b/src/sugar3/graphics/alert.py
@@ -358,10 +358,13 @@ class _TimeoutIcon(Gtk.Alignment):
self._draw(context)
return False
- def do_size_request(self, requisition):
- requisition.height, requisition.width = \
- Gtk.icon_size_lookup(Gtk.IconSize.BUTTON)
- self._text.size_request()
+ def do_get_preferred_width(self):
+ width = Gtk.icon_size_lookup(Gtk.IconSize.BUTTON)[0]
+ return width, width
+
+ def do_get_preferred_height(self):
+ height = Gtk.icon_size_lookup(Gtk.IconSize.BUTTON)[1]
+ return height, height
def _draw(self, context):
rect = self.get_allocation()
diff --git a/src/sugar3/graphics/toolbarbox.py b/src/sugar3/graphics/toolbarbox.py
index df48c2b..9f540c6 100644
--- a/src/sugar3/graphics/toolbarbox.py
+++ b/src/sugar3/graphics/toolbarbox.py
@@ -247,9 +247,9 @@ class _ToolbarPalette(PaletteWindow):
if not group.is_up():
self.popdown()
- def do_get_preferred_height(self, minimal_height, maximum_height):
+ def do_get_preferred_width(self):
width = Gdk.Screen.width()
- return max(requisition.width, Gdk.Screen.width())
+ return width, width
def popup(self, immediate=False):
button = self.expanded_button
diff --git a/src/sugar3/graphics/tray.py b/src/sugar3/graphics/tray.py
index 2c9d4a0..7911fce 100644
--- a/src/sugar3/graphics/tray.py
+++ b/src/sugar3/graphics/tray.py
@@ -112,14 +112,17 @@ class _TrayViewport(Gtk.Viewport):
new_value = adj.get_value() - allocation.height
adj.set_value(max(adj.get_lower(), new_value))
- def do_size_request(self, requisition):
- child_requisition = self.get_child().size_request()
+ def do_get_preferred_width(self):
if self.orientation == Gtk.Orientation.HORIZONTAL:
- requisition[0] = 0
- requisition[1] = child_requisition[1]
- else:
- requisition[0] = child_requisition[0]
- requisition[1] = 0
+ return Gtk.Viewport.do_get_preferred_width(self)
+ child_minimum, child_natural = self.get_child().get_preferred_size()
+ return child_minimum.width, child_natural.width
+
+ def do_get_preferred_height(self):
+ if self.orientation != Gtk.Orientation.HORIZONTAL:
+ return Gtk.Viewport.do_get_preferred_width(self)
+ child_minimum, child_natural = self.get_child().get_preferred_size()
+ return child_minimum.height, child_natural.height
def do_get_property(self, pspec):
if pspec.name == 'scrollable':