Ticket #4397: 0001-ViewSource-fix-alignment-of-radio-buttons-SL-4397.patch

File 0001-ViewSource-fix-alignment-of-radio-buttons-SL-4397.patch, 3.5 KB (added by manuq, 11 years ago)
  • src/jarabe/view/viewsource.py

    From b9c64d1a2150f6ab979bf475c12a4ea2de210fc8 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Wed, 23 Jan 2013 17:14:28 -0300
    Subject: [PATCH 1/4] ViewSource: fix alignment of radio buttons - SL #4397
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    - Remove invisible separators between buttons.
    - Add separators to distingish the group of radio buttons.
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     src/jarabe/view/viewsource.py | 30 ++++++++++++++----------------
     1 file changed, 14 insertions(+), 16 deletions(-)
    
    diff --git a/src/jarabe/view/viewsource.py b/src/jarabe/view/viewsource.py
    index c8e2894..d0012b6 100644
    a b class Toolbar(Gtk.Toolbar): 
    349349    def __init__(self, title, bundle_path, document_path, sugar_toolkit_path):
    350350        Gtk.Toolbar.__init__(self)
    351351
     352        separator = Gtk.SeparatorToolItem()
     353        separator.props.draw = False
     354        self.insert(separator, -1)
     355        separator.show()
     356
    352357        document_button = None
    353358        self.bundle_path = bundle_path
    354359        self.sugar_toolkit_path = sugar_toolkit_path
    355360
    356         self._add_separator()
    357 
    358361        activity_bundle = ActivityBundle(bundle_path)
    359362        file_name = activity_bundle.get_icon()
    360363
    class Toolbar(Gtk.Toolbar): 
    364367                                    document_path)
    365368            self.insert(document_button, -1)
    366369            document_button.show()
    367             self._add_separator()
    368370
    369371        if bundle_path is not None and os.path.exists(bundle_path):
    370372            activity_button = DocumentButton(file_name, bundle_path, title,
    class Toolbar(Gtk.Toolbar): 
    382384                                    bundle_path)
    383385            self.insert(activity_button, -1)
    384386            activity_button.show()
    385             self._add_separator()
    386387
    387388        if sugar_toolkit_path is not None:
    388389            sugar_button = RadioToolButton()
    class Toolbar(Gtk.Toolbar): 
    401402                                 sugar_toolkit_path)
    402403            self.insert(sugar_button, -1)
    403404            sugar_button.show()
    404             self._add_separator()
     405
     406        separator = Gtk.SeparatorToolItem()
     407        self.insert(separator, -1)
     408        separator.show()
    405409
    406410        self.activity_title_text = _('View source: %s') % title
    407411        self.sugar_toolkit_title_text = _('View source: %r') % 'Sugar Toolkit'
    class Toolbar(Gtk.Toolbar): 
    410414        self.label.set_alignment(0, 0.5)
    411415        self._add_widget(self.label)
    412416
    413         self._add_separator(True)
     417        separator = Gtk.SeparatorToolItem()
     418        separator.props.draw = False
     419        separator.set_expand(True)
     420        self.insert(separator, -1)
     421        separator.show()
    414422
    415423        stop = ToolButton(icon_name='dialog-cancel')
    416424        stop.set_tooltip(_('Close'))
    class Toolbar(Gtk.Toolbar): 
    418426        self.insert(stop, -1)
    419427        stop.show()
    420428
    421     def _add_separator(self, expand=False):
    422         separator = Gtk.SeparatorToolItem()
    423         separator.props.draw = False
    424         if expand:
    425             separator.set_expand(True)
    426         else:
    427             separator.set_size_request(style.DEFAULT_SPACING, -1)
    428         self.insert(separator, -1)
    429         separator.show()
    430 
    431429    def _add_widget(self, widget, expand=False):
    432430        tool_item = Gtk.ToolItem()
    433431        tool_item.set_expand(expand)