From 8a9d10cda708eaa4cff902a2fef21316291202a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Tue, 11 Dec 2012 01:19:12 -0300 Subject: [PATCH] ColorToolButton, ToggleToolButton: do the drawing in the correct order - SL #4303 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. if the palette is up, draw the black background 2. draw the button itself 3. if the palette is up, draw the grey outline Exactly as the ToolButton does. Otherwise the outline is not visible. Signed-off-by: Manuel QuiƱones Acked-by: Simon Schampijer --- src/sugar3/graphics/colorbutton.py | 12 +++++++----- src/sugar3/graphics/toggletoolbutton.py | 11 ++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/sugar3/graphics/colorbutton.py b/src/sugar3/graphics/colorbutton.py index 065a55e6..3f205ff7 100644 --- a/src/sugar3/graphics/colorbutton.py +++ b/src/sugar3/graphics/colorbutton.py @@ -541,18 +541,20 @@ class ColorToolButton(Gtk.ToolItem): def do_draw(self, cr): child = self.get_child() - allocation = self.get_allocation() if self._palette and self._palette.is_up(): - invoker = self._palette.props.invoker - invoker.draw_rectangle(cr, self._palette) - allocation = self.get_allocation() # draw a black background, has been done by the engine before cr.set_source_rgb(0, 0, 0) cr.rectangle(0, 0, allocation.width, allocation.height) cr.paint() - Gtk.ToolButton.do_draw(self, cr) + Gtk.ToolItem.do_draw(self, cr) + + if self._palette and self._palette.is_up(): + invoker = self._palette.props.invoker + invoker.draw_rectangle(cr, self._palette) + + return False def __notify_change(self, widget, pspec): self.notify(pspec.name) diff --git a/src/sugar3/graphics/toggletoolbutton.py b/src/sugar3/graphics/toggletoolbutton.py index e893c7a9..dad39a40 100644 --- a/src/sugar3/graphics/toggletoolbutton.py +++ b/src/sugar3/graphics/toggletoolbutton.py @@ -125,13 +125,8 @@ class ToggleToolButton(Gtk.ToggleToolButton): getter=get_accelerator) def do_draw(self, cr): - allocation = self.get_allocation() child = self.get_child() - if self.palette and self.palette.is_up(): - invoker = self.palette.props.invoker - invoker.draw_rectangle(cr, self.palette) - allocation = self.get_allocation() # draw a black background, has been done by the engine before cr.set_source_rgb(0, 0, 0) @@ -140,4 +135,10 @@ class ToggleToolButton(Gtk.ToggleToolButton): Gtk.ToggleToolButton.do_draw(self, cr) + if self.palette and self.palette.is_up(): + invoker = self.palette.props.invoker + invoker.draw_rectangle(cr, self.palette) + + return False + palette = property(get_palette, set_palette)