From 20ce6e46f46fa6fbb8c7db1a8d1b28b8c85cf641 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Wed, 14 Dec 2011 19:11:11 +0000 Subject: Fixup of fb1fc8acc629016936c9d0c658e2dc372c9fd353 --- diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py index 543b382..0179c30 100644 --- a/src/sugar3/graphics/palettewindow.py +++ b/src/sugar3/graphics/palettewindow.py @@ -1013,7 +1013,8 @@ class WidgetInvoker(Invoker): self.notify_mouse_enter() def __leave_notify_event_cb(self, widget, event): - self.notify_mouse_leave() + if event.mode == Gdk.CrossingMode.NORMAL: + self.notify_mouse_leave() def grabbed_enter_notify_event(self, event): if self._widget.get_window() is event.window: diff --git a/src/sugar3/graphics/toolbarbox.py b/src/sugar3/graphics/toolbarbox.py index 2d2e6da..b2cec52 100644 --- a/src/sugar3/graphics/toolbarbox.py +++ b/src/sugar3/graphics/toolbarbox.py @@ -15,6 +15,8 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. +import math + from gi.repository import Gtk, GObject, Gdk from sugar3.graphics import style @@ -123,6 +125,35 @@ class ToolbarButton(ToolButton): if parent: parent.remove(self.page_widget) + def do_draw(self, cr): + if not self.is_expanded() or self.props.palette is not None and \ + self.props.palette.is_up(): + Gtk.ToolButton.do_draw(self, cr) + _paint_arrow(self, cr, math.pi) + return + + alloc = self.get_allocation() + + context = self.get_style_context() + context.add_class('ende') + + Gtk.render_frame_gap(context, cr, 0, 0, alloc.width, alloc.height, Gtk.PositionType.BOTTOM, 0, alloc.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) + + Gtk.ToolButton.do_draw(self, cr) + #Gtk.render_frame(context, cr, alloc.x, 0, alloc.width, alloc.height) + _paint_arrow(self, cr, 0) + # FIXME: Need to fix drawing ... # def do_expose_event(self, event): # if not self.is_expanded() or self.props.palette is not None and \ @@ -329,13 +360,14 @@ def _get_embedded_page(page_widget): return page_widget.get_child().get_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, cr, angle): + alloc = widget.get_allocation() + + arrow_size = style.TOOLBAR_ARROW_SIZE / 2 + y = alloc.height - arrow_size + x = (alloc.width - arrow_size) / 2 -# 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) + context = widget.get_style_context() + context.add_class('ende') + Gtk.render_arrow(context, cr, angle, x, y, arrow_size) -- cgit v0.9.1