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

File 0002-ViewSource-fix-alignment-of-radio-buttons-SL-4397.patch, 3.8 KB (added by manuq, 10 years ago)

Patch - fix button alignment and separators, add gear icon

  • src/jarabe/view/viewsource.py

    From 92ecf55959abc686add1b79d06a9f301f0e7afd8 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 shell 2/2] 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 gear icon on the left, to identify the ViewSource view.
    - Add separators to distingish the group of radio buttons.
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     src/jarabe/view/viewsource.py | 38 ++++++++++++++++++++++----------------
     1 file changed, 22 insertions(+), 16 deletions(-)
    
    diff --git a/src/jarabe/view/viewsource.py b/src/jarabe/view/viewsource.py
    index c8e2894..07ddbb1 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
     357        view_source_icon = Icon(icon_name='view-source',
     358                    icon_size=Gtk.IconSize.LARGE_TOOLBAR)
     359        self._add_widget(view_source_icon)
     360
     361        separator = Gtk.SeparatorToolItem()
     362        self.insert(separator, -1)
     363        separator.show()
     364
    352365        document_button = None
    353366        self.bundle_path = bundle_path
    354367        self.sugar_toolkit_path = sugar_toolkit_path
    355368
    356         self._add_separator()
    357 
    358369        activity_bundle = ActivityBundle(bundle_path)
    359370        file_name = activity_bundle.get_icon()
    360371
    class Toolbar(Gtk.Toolbar): 
    364375                                    document_path)
    365376            self.insert(document_button, -1)
    366377            document_button.show()
    367             self._add_separator()
    368378
    369379        if bundle_path is not None and os.path.exists(bundle_path):
    370380            activity_button = DocumentButton(file_name, bundle_path, title,
    class Toolbar(Gtk.Toolbar): 
    382392                                    bundle_path)
    383393            self.insert(activity_button, -1)
    384394            activity_button.show()
    385             self._add_separator()
    386395
    387396        if sugar_toolkit_path is not None:
    388397            sugar_button = RadioToolButton()
    class Toolbar(Gtk.Toolbar): 
    401410                                 sugar_toolkit_path)
    402411            self.insert(sugar_button, -1)
    403412            sugar_button.show()
    404             self._add_separator()
     413
     414        separator = Gtk.SeparatorToolItem()
     415        self.insert(separator, -1)
     416        separator.show()
    405417
    406418        self.activity_title_text = _('View source: %s') % title
    407419        self.sugar_toolkit_title_text = _('View source: %r') % 'Sugar Toolkit'
    class Toolbar(Gtk.Toolbar): 
    410422        self.label.set_alignment(0, 0.5)
    411423        self._add_widget(self.label)
    412424
    413         self._add_separator(True)
     425        separator = Gtk.SeparatorToolItem()
     426        separator.props.draw = False
     427        separator.set_expand(True)
     428        self.insert(separator, -1)
     429        separator.show()
    414430
    415431        stop = ToolButton(icon_name='dialog-cancel')
    416432        stop.set_tooltip(_('Close'))
    class Toolbar(Gtk.Toolbar): 
    418434        self.insert(stop, -1)
    419435        stop.show()
    420436
    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 
    431437    def _add_widget(self, widget, expand=False):
    432438        tool_item = Gtk.ToolItem()
    433439        tool_item.set_expand(expand)