Ticket #4303: 0001-ColorToolButton-ToggleToolButton-do-the-drawing-in-t.patch

File 0001-ColorToolButton-ToggleToolButton-do-the-drawing-in-t.patch, 3.0 KB (added by manuq, 11 years ago)

v2. Fix for the ColorToolButton and the ToggleToolButton (like the wrap lines button in Log activity).

  • src/sugar3/graphics/colorbutton.py

    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): 
    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)
  • src/sugar3/graphics/toggletoolbutton.py

    diff --git a/src/sugar3/graphics/toggletoolbutton.py b/src/sugar3/graphics/toggletoolbutton.py
    index e893c7a..dad39a4 100644
    a b class ToggleToolButton(Gtk.ToggleToolButton): 
    125125                                   getter=get_accelerator)
    126126
    127127    def do_draw(self, cr):
    128         allocation = self.get_allocation()
    129128        child = self.get_child()
    130 
    131129        if self.palette and self.palette.is_up():
    132             invoker = self.palette.props.invoker
    133             invoker.draw_rectangle(cr, self.palette)
    134 
    135130            allocation = self.get_allocation()
    136131            # draw a black background, has been done by the engine before
    137132            cr.set_source_rgb(0, 0, 0)
    class ToggleToolButton(Gtk.ToggleToolButton): 
    140135
    141136        Gtk.ToggleToolButton.do_draw(self, cr)
    142137
     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
    143144    palette = property(get_palette, set_palette)