Ticket #4323: 0001-RadioToolButton-add-active-parameter-to-set-the-acti.patch

File 0001-RadioToolButton-add-active-parameter-to-set-the-acti.patch, 1.7 KB (added by manuq, 10 years ago)

Toolkit patch.

  • src/sugar3/graphics/radiotoolbutton.py

    From 65ee6d598a086ce3da4b0c0762465e80c869d048 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Wed, 19 Dec 2012 14:08:16 -0300
    Subject: [PATCH toolkit] RadioToolButton: add active parameter to set the
     active property in the constructor - SL #4323
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    This is because setting the active property after will emit a
    'clicked' signal that makes the palette popup.
    
    Also, call the parent's class constructor instead of GObject.GObject
    one.
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     src/sugar3/graphics/radiotoolbutton.py | 9 +++++----
     1 file changed, 5 insertions(+), 4 deletions(-)
    
    diff --git a/src/sugar3/graphics/radiotoolbutton.py b/src/sugar3/graphics/radiotoolbutton.py
    index a51a39a..975776f 100644
    a b class RadioToolButton(Gtk.RadioToolButton): 
    3333
    3434    __gtype_name__ = 'SugarRadioToolButton'
    3535
    36     def __init__(self, icon_name=None, **kwargs):
     36    def __init__(self, icon_name=None, active=None, **kwargs):
    3737        self._accelerator = None
    3838        self._tooltip = None
    3939        self._xo_color = None
    4040        self._hide_tooltip_on_click = True
    4141
    42         self._palette_invoker = ToolInvoker()
    43 
    44         GObject.GObject.__init__(self, **kwargs)
     42        Gtk.RadioToolButton.__init__(self, **kwargs)
     43        if active is not None:
     44            self.props.active = active
    4545
     46        self._palette_invoker = ToolInvoker()
    4647        self._palette_invoker.attach_tool(self)
    4748
    4849        if icon_name: