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): |
349 | 349 | def __init__(self, title, bundle_path, document_path, sugar_toolkit_path): |
350 | 350 | Gtk.Toolbar.__init__(self) |
351 | 351 | |
| 352 | separator = Gtk.SeparatorToolItem() |
| 353 | separator.props.draw = False |
| 354 | self.insert(separator, -1) |
| 355 | separator.show() |
| 356 | |
352 | 357 | document_button = None |
353 | 358 | self.bundle_path = bundle_path |
354 | 359 | self.sugar_toolkit_path = sugar_toolkit_path |
355 | 360 | |
356 | | self._add_separator() |
357 | | |
358 | 361 | activity_bundle = ActivityBundle(bundle_path) |
359 | 362 | file_name = activity_bundle.get_icon() |
360 | 363 | |
… |
… |
class Toolbar(Gtk.Toolbar): |
364 | 367 | document_path) |
365 | 368 | self.insert(document_button, -1) |
366 | 369 | document_button.show() |
367 | | self._add_separator() |
368 | 370 | |
369 | 371 | if bundle_path is not None and os.path.exists(bundle_path): |
370 | 372 | activity_button = DocumentButton(file_name, bundle_path, title, |
… |
… |
class Toolbar(Gtk.Toolbar): |
382 | 384 | bundle_path) |
383 | 385 | self.insert(activity_button, -1) |
384 | 386 | activity_button.show() |
385 | | self._add_separator() |
386 | 387 | |
387 | 388 | if sugar_toolkit_path is not None: |
388 | 389 | sugar_button = RadioToolButton() |
… |
… |
class Toolbar(Gtk.Toolbar): |
401 | 402 | sugar_toolkit_path) |
402 | 403 | self.insert(sugar_button, -1) |
403 | 404 | sugar_button.show() |
404 | | self._add_separator() |
| 405 | |
| 406 | separator = Gtk.SeparatorToolItem() |
| 407 | self.insert(separator, -1) |
| 408 | separator.show() |
405 | 409 | |
406 | 410 | self.activity_title_text = _('View source: %s') % title |
407 | 411 | self.sugar_toolkit_title_text = _('View source: %r') % 'Sugar Toolkit' |
… |
… |
class Toolbar(Gtk.Toolbar): |
410 | 414 | self.label.set_alignment(0, 0.5) |
411 | 415 | self._add_widget(self.label) |
412 | 416 | |
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() |
414 | 422 | |
415 | 423 | stop = ToolButton(icon_name='dialog-cancel') |
416 | 424 | stop.set_tooltip(_('Close')) |
… |
… |
class Toolbar(Gtk.Toolbar): |
418 | 426 | self.insert(stop, -1) |
419 | 427 | stop.show() |
420 | 428 | |
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 | | |
431 | 429 | def _add_widget(self, widget, expand=False): |
432 | 430 | tool_item = Gtk.ToolItem() |
433 | 431 | tool_item.set_expand(expand) |