Ticket #4303: 0001-ColorToolButton-do-the-drawing-in-the-correct-order-.patch

File 0001-ColorToolButton-do-the-drawing-in-the-correct-order-.patch, 1.8 KB (added by manuq, 11 years ago)

Fix for the ColorToolButton.

  • src/sugar3/graphics/colorbutton.py

    From 12489d4d349cdfba3ef45e30adf81f81794e13a7 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: 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.
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     src/sugar3/graphics/colorbutton.py | 12 +++++++-----
     1 file changed, 7 insertions(+), 5 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): 
    541541
    542542    def do_draw(self, cr):
    543543        child = self.get_child()
    544         allocation = self.get_allocation()
    545544        if self._palette and self._palette.is_up():
    546             invoker = self._palette.props.invoker
    547             invoker.draw_rectangle(cr, self._palette)
    548 
    549545            allocation = self.get_allocation()
    550546            # draw a black background, has been done by the engine before
    551547            cr.set_source_rgb(0, 0, 0)
    552548            cr.rectangle(0, 0, allocation.width, allocation.height)
    553549            cr.paint()
    554550
    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
    556558
    557559    def __notify_change(self, widget, pspec):
    558560        self.notify(pspec.name)