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): |
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 | |
| 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 | |
352 | 365 | document_button = None |
353 | 366 | self.bundle_path = bundle_path |
354 | 367 | self.sugar_toolkit_path = sugar_toolkit_path |
355 | 368 | |
356 | | self._add_separator() |
357 | | |
358 | 369 | activity_bundle = ActivityBundle(bundle_path) |
359 | 370 | file_name = activity_bundle.get_icon() |
360 | 371 | |
… |
… |
class Toolbar(Gtk.Toolbar): |
364 | 375 | document_path) |
365 | 376 | self.insert(document_button, -1) |
366 | 377 | document_button.show() |
367 | | self._add_separator() |
368 | 378 | |
369 | 379 | if bundle_path is not None and os.path.exists(bundle_path): |
370 | 380 | activity_button = DocumentButton(file_name, bundle_path, title, |
… |
… |
class Toolbar(Gtk.Toolbar): |
382 | 392 | bundle_path) |
383 | 393 | self.insert(activity_button, -1) |
384 | 394 | activity_button.show() |
385 | | self._add_separator() |
386 | 395 | |
387 | 396 | if sugar_toolkit_path is not None: |
388 | 397 | sugar_button = RadioToolButton() |
… |
… |
class Toolbar(Gtk.Toolbar): |
401 | 410 | sugar_toolkit_path) |
402 | 411 | self.insert(sugar_button, -1) |
403 | 412 | sugar_button.show() |
404 | | self._add_separator() |
| 413 | |
| 414 | separator = Gtk.SeparatorToolItem() |
| 415 | self.insert(separator, -1) |
| 416 | separator.show() |
405 | 417 | |
406 | 418 | self.activity_title_text = _('View source: %s') % title |
407 | 419 | self.sugar_toolkit_title_text = _('View source: %r') % 'Sugar Toolkit' |
… |
… |
class Toolbar(Gtk.Toolbar): |
410 | 422 | self.label.set_alignment(0, 0.5) |
411 | 423 | self._add_widget(self.label) |
412 | 424 | |
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() |
414 | 430 | |
415 | 431 | stop = ToolButton(icon_name='dialog-cancel') |
416 | 432 | stop.set_tooltip(_('Close')) |
… |
… |
class Toolbar(Gtk.Toolbar): |
418 | 434 | self.insert(stop, -1) |
419 | 435 | stop.show() |
420 | 436 | |
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 | 437 | def _add_widget(self, widget, expand=False): |
432 | 438 | tool_item = Gtk.ToolItem() |
433 | 439 | tool_item.set_expand(expand) |