Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Berg <benjamin@sipsolutions.net>2011-10-30 08:08:45 (GMT)
committer Benjamin Berg <benjamin@sipsolutions.net>2011-10-30 08:09:32 (GMT)
commit1da4b0d6849b90ade07f74e437387a68e28d8ec6 (patch)
tree88dd9d0b8ebac1f6b791297d5f2da0982c885085
parent6b49705a6c1b07f0ae63810171edd22c8d136c86 (diff)
Fix/workaround some GTK+ 3.x issues, to get the toolbar loading.
-rw-r--r--src/sugar3/graphics/toolbarbox.py90
1 files changed, 45 insertions, 45 deletions
diff --git a/src/sugar3/graphics/toolbarbox.py b/src/sugar3/graphics/toolbarbox.py
index c8ec311..b3ce73a 100644
--- a/src/sugar3/graphics/toolbarbox.py
+++ b/src/sugar3/graphics/toolbarbox.py
@@ -121,28 +121,29 @@ class ToolbarButton(ToolButton):
return
self.page_widget.parent.remove(self.page_widget)
- def do_expose_event(self, event):
- if not self.is_expanded() or self.props.palette is not None and \
- self.props.palette.is_up():
- ToolButton.do_expose_event(self, event)
- _paint_arrow(self, event, Gtk.ArrowType.DOWN)
- return
+ # FIXME: Need to fix drawing ...
+# def do_expose_event(self, event):
+# if not self.is_expanded() or self.props.palette is not None and \
+# self.props.palette.is_up():
+# ToolButton.do_expose_event(self, event)
+# _paint_arrow(self, event, Gtk.ArrowType.DOWN)
+# return
- alloc = self.allocation
+# alloc = self.allocation
- self.get_style().paint_box(event.window,
- Gtk.StateType.NORMAL, Gtk.ShadowType.IN, event.area, self,
- 'palette-invoker', alloc.x, 0,
- alloc.width, alloc.height + style.FOCUS_LINE_WIDTH)
+# self.get_style().paint_box(event.window,
+# Gtk.StateType.NORMAL, Gtk.ShadowType.IN, event.area, self,
+# 'palette-invoker', alloc.x, 0,
+# alloc.width, alloc.height + style.FOCUS_LINE_WIDTH)
- if self.get_child().state != Gtk.StateType.PRELIGHT:
- self.get_style().paint_box(event.window,
- Gtk.StateType.NORMAL, Gtk.ShadowType.NONE, event.area, self, None,
- alloc.x + style.FOCUS_LINE_WIDTH, style.FOCUS_LINE_WIDTH,
- alloc.width - style.FOCUS_LINE_WIDTH * 2, alloc.height)
+# if self.get_child().state != Gtk.StateType.PRELIGHT:
+# self.get_style().paint_box(event.window,
+# Gtk.StateType.NORMAL, Gtk.ShadowType.NONE, event.area, self, None,
+# alloc.x + style.FOCUS_LINE_WIDTH, style.FOCUS_LINE_WIDTH,
+# alloc.width - style.FOCUS_LINE_WIDTH * 2, alloc.height)
- Gtk.ToolButton.do_expose_event(self, event)
- _paint_arrow(self, event, Gtk.ArrowType.UP)
+# Gtk.ToolButton.do_expose_event(self, event)
+# _paint_arrow(self, event, Gtk.ArrowType.UP)
class ToolbarBox(Gtk.VBox):
@@ -245,10 +246,9 @@ class _ToolbarPalette(PaletteWindow):
if not group.is_up():
self.popdown()
- def do_size_request(self, requisition):
- Gtk.Window.do_size_request(self, requisition)
- requisition.width = max(requisition.width,
- Gdk.Screen.width())
+ def do_get_preferred_height(self, minimal_height, maximum_height):
+ width = Gdk.Screen.width()
+ return max(requisition.width, Gdk.Screen.width())
def popup(self, immediate=False):
button = self.expanded_button
@@ -268,23 +268,22 @@ class _Box(Gtk.EventBox):
def __init__(self):
GObject.GObject.__init__(self)
- self.connect('expose-event', self.do_expose_event)
self.set_app_paintable(True)
- def do_expose_event(self, widget, event):
- if self.parent.expanded_button is None:
- return
- alloc = self.parent.expanded_button.allocation
- self.get_style().paint_box(event.window,
- Gtk.StateType.NORMAL, Gtk.ShadowType.IN, event.area, self,
- 'palette-invoker', -style.FOCUS_LINE_WIDTH, 0,
- self.allocation.width + style.FOCUS_LINE_WIDTH * 2,
- self.allocation.height + style.FOCUS_LINE_WIDTH)
- self.get_style().paint_box(event.window,
- Gtk.StateType.NORMAL, Gtk.ShadowType.NONE, event.area, self, None,
- alloc.x + style.FOCUS_LINE_WIDTH, 0,
- alloc.width - style.FOCUS_LINE_WIDTH * 2,
- style.FOCUS_LINE_WIDTH)
+# def do_expose_event(self, widget, event):
+# if self.parent.expanded_button is None:
+# return
+# alloc = self.parent.expanded_button.allocation
+# self.get_style().paint_box(event.window,
+# Gtk.StateType.NORMAL, Gtk.ShadowType.IN, event.area, self,
+# 'palette-invoker', -style.FOCUS_LINE_WIDTH, 0,
+# self.allocation.width + style.FOCUS_LINE_WIDTH * 2,
+# self.allocation.height + style.FOCUS_LINE_WIDTH)
+# self.get_style().paint_box(event.window,
+# Gtk.StateType.NORMAL, Gtk.ShadowType.NONE, event.area, self, None,
+# alloc.x + style.FOCUS_LINE_WIDTH, 0,
+# alloc.width - style.FOCUS_LINE_WIDTH * 2,
+# style.FOCUS_LINE_WIDTH)
def _setup_page(page_widget, color, hpad):
@@ -321,12 +320,13 @@ def _get_embedded_page(page_widget):
return page_widget.get_child().child
-def _paint_arrow(widget, event, arrow_type):
- alloc = widget.allocation
- x = alloc.x + alloc.width / 2 - style.TOOLBAR_ARROW_SIZE / 2
- y = alloc.y + alloc.height - int(style.TOOLBAR_ARROW_SIZE * .85)
+#def _paint_arrow(widget, event, arrow_type):
+# alloc = widget.allocation
+# x = alloc.x + alloc.width / 2 - style.TOOLBAR_ARROW_SIZE / 2
+# y = alloc.y + alloc.height - int(style.TOOLBAR_ARROW_SIZE * .85)
+
+# widget.get_style().paint_arrow(event.window,
+# Gtk.StateType.NORMAL, Gtk.ShadowType.NONE, event.area, widget,
+# None, arrow_type, True,
+# x, y, style.TOOLBAR_ARROW_SIZE, style.TOOLBAR_ARROW_SIZE)
- widget.get_style().paint_arrow(event.window,
- Gtk.StateType.NORMAL, Gtk.ShadowType.NONE, event.area, widget,
- None, arrow_type, True,
- x, y, style.TOOLBAR_ARROW_SIZE, style.TOOLBAR_ARROW_SIZE)