diff options
author | Rafael Ortiz <rafael@activitycentral.com> | 2012-06-14 03:25:21 (GMT) |
---|---|---|
committer | Rafael Ortiz <rafael@activitycentral.com> | 2012-06-14 03:25:21 (GMT) |
commit | ff4ce87bd286e1c353dd29b81803d02910fd6810 (patch) | |
tree | 0075fc8f487dccb6c2a04ee7708ffa8ad9b40d64 | |
parent | 20ea40bf4e6f0d708dfdcaa915520e85d67671b0 (diff) |
Erasing backport toolbar compatibility
we don't need it for Gtk3
-rw-r--r-- | wordsactivity.py | 66 |
1 files changed, 28 insertions, 38 deletions
diff --git a/wordsactivity.py b/wordsactivity.py index 7bb73d8..9a5bd43 100644 --- a/wordsactivity.py +++ b/wordsactivity.py @@ -25,17 +25,13 @@ import subprocess from gettext import gettext as _ from sugar3.activity import activity -from sugar3.graphics.toolbarbox import ToolbarBox from sugar3.activity.activity import get_bundle_path, get_bundle_name from sugar3.graphics.icon import Icon -OLD_TOOLBARS = False -try: - from sugar3.graphics.toolbarbox import ToolbarBox, ToolbarButton - from sugar3.activity.widgets import ActivityButton, StopButton, \ - ShareButton, KeepButton, TitleEntry -except ImportError: - OLD_TOOLBARS = True + +from sugar3.graphics.toolbarbox import ToolbarBox, ToolbarButton +from sugar3.activity.widgets import ActivityButton, StopButton, \ + ShareButton, TitleEntry # logging _logger = logging.getLogger('Words') @@ -67,47 +63,41 @@ class WordsActivity(activity.Activity): vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=20) vbox.set_border_width(20) - # Toolbar (compatibility with old-toolbars) | Toolbar, compatibilidad con barras anteriores - if not OLD_TOOLBARS: - toolbar_box = ToolbarBox() - activity_button = ActivityButton(self) - toolbar_box.toolbar.insert(activity_button, 0) - activity_button.show() + toolbar_box = ToolbarBox() + activity_button = ActivityButton(self) + toolbar_box.toolbar.insert(activity_button, 0) + activity_button.show() - title_entry = TitleEntry(self) - toolbar_box.toolbar.insert(title_entry, -1) - title_entry.show() + title_entry = TitleEntry(self) + toolbar_box.toolbar.insert(title_entry, -1) + title_entry.show() - try: + try: from sugar3.activity.widgets import DescriptionItem - except ImportError: - logging.debug('DescriptionItem button is not available,' + + except ImportError: + logging.debug('DescriptionItem button is not available,' + 'toolkit version < 0.96') - else: + else: description_item = DescriptionItem(self) toolbar_box.toolbar.insert(description_item, -1) description_item.show() - share_button = ShareButton(self) - toolbar_box.toolbar.insert(share_button, -1) - share_button.show() + share_button = ShareButton(self) + toolbar_box.toolbar.insert(share_button, -1) + share_button.show() - separator = Gtk.SeparatorToolItem() - separator.props.draw = False - separator.set_expand(True) - toolbar_box.toolbar.insert(separator, -1) - separator.show() + separator = Gtk.SeparatorToolItem() + separator.props.draw = False + separator.set_expand(True) + toolbar_box.toolbar.insert(separator, -1) + separator.show() - stop_button = StopButton(self) - toolbar_box.toolbar.insert(stop_button, -1) - stop_button.show() + stop_button = StopButton(self) + toolbar_box.toolbar.insert(stop_button, -1) + stop_button.show() - self.set_toolbar_box(toolbox) - toolbox.show() - else: - toolbox = ToolbarBox(self) - self.set_toolbar_box(toolbox) - toolbox.show() + self.set_toolbar_box(toolbar_box) + toolbar_box.show() # transbox: <label> - <text entry> - <speak button> transbox = Gtk.Table() |