From afac81bcff32fc0f6b3ce8af183de1a84907957b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
Date: Tue, 11 Dec 2012 01:19:12 -0300
Subject: [PATCH toolkit] 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
Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
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>
---
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 065a55e..3f205ff 100644
a
|
b
|
class ColorToolButton(Gtk.ToolItem): |
541 | 541 | |
542 | 542 | def do_draw(self, cr): |
543 | 543 | child = self.get_child() |
544 | | allocation = self.get_allocation() |
545 | 544 | if self._palette and self._palette.is_up(): |
546 | | invoker = self._palette.props.invoker |
547 | | invoker.draw_rectangle(cr, self._palette) |
548 | | |
549 | 545 | allocation = self.get_allocation() |
550 | 546 | # draw a black background, has been done by the engine before |
551 | 547 | cr.set_source_rgb(0, 0, 0) |
552 | 548 | cr.rectangle(0, 0, allocation.width, allocation.height) |
553 | 549 | cr.paint() |
554 | 550 | |
555 | | Gtk.ToolButton.do_draw(self, cr) |
| 551 | Gtk.ToolItem.do_draw(self, cr) |
| 552 | |
| 553 | if self._palette and self._palette.is_up(): |
| 554 | invoker = self._palette.props.invoker |
| 555 | invoker.draw_rectangle(cr, self._palette) |
| 556 | |
| 557 | return False |
556 | 558 | |
557 | 559 | def __notify_change(self, widget, pspec): |
558 | 560 | self.notify(pspec.name) |
diff --git a/src/sugar3/graphics/toggletoolbutton.py b/src/sugar3/graphics/toggletoolbutton.py
index e893c7a..dad39a4 100644
a
|
b
|
class ToggleToolButton(Gtk.ToggleToolButton): |
125 | 125 | getter=get_accelerator) |
126 | 126 | |
127 | 127 | def do_draw(self, cr): |
128 | | allocation = self.get_allocation() |
129 | 128 | child = self.get_child() |
130 | | |
131 | 129 | if self.palette and self.palette.is_up(): |
132 | | invoker = self.palette.props.invoker |
133 | | invoker.draw_rectangle(cr, self.palette) |
134 | | |
135 | 130 | allocation = self.get_allocation() |
136 | 131 | # draw a black background, has been done by the engine before |
137 | 132 | cr.set_source_rgb(0, 0, 0) |
… |
… |
class ToggleToolButton(Gtk.ToggleToolButton): |
140 | 135 | |
141 | 136 | Gtk.ToggleToolButton.do_draw(self, cr) |
142 | 137 | |
| 138 | if self.palette and self.palette.is_up(): |
| 139 | invoker = self.palette.props.invoker |
| 140 | invoker.draw_rectangle(cr, self.palette) |
| 141 | |
| 142 | return False |
| 143 | |
143 | 144 | palette = property(get_palette, set_palette) |