diff options
author | Manuel Quiñones <manuq@laptop.org> | 2012-12-11 04:19:12 (GMT) |
---|---|---|
committer | Manuel Quiñones <manuq@laptop.org> | 2012-12-11 12:47:21 (GMT) |
commit | 8a9d10cda708eaa4cff902a2fef21316291202a2 (patch) | |
tree | efa3b2a0e9e7e096f4433e492d84be12ba83a720 | |
parent | 4de6057e1b63cfeb68b46082f2cdafa7e019c896 (diff) |
ColorToolButton, ToggleToolButton: do the drawing in the correct order - SL #4303
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 <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r-- | src/sugar3/graphics/colorbutton.py | 12 | ||||
-rw-r--r-- | 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 065a55e..3f205ff 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 e893c7a..dad39a4 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) |