Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Ortiz <rafael@activitycentral.com>2011-05-30 23:39:22 (GMT)
committer Rafael Ortiz <rafael@activitycentral.com>2011-05-30 23:39:22 (GMT)
commit6108baeec601a39a26259113e1d17f3e4cb5f603 (patch)
tree1e187ac2b48d5c79ee4849ed4ab680fefeaff551
parent7ebef30c9a3dc50af8fba0294754f7013a5d5210 (diff)
Adding toolbars compatibility
-rw-r--r--activity.py92
1 files changed, 50 insertions, 42 deletions
diff --git a/activity.py b/activity.py
index ea171dc..66f8464 100644
--- a/activity.py
+++ b/activity.py
@@ -23,63 +23,71 @@ import logging
from gettext import gettext as _
from sugar.activity import activity
-from sugar.graphics.toolbarbox import ToolbarBox
-from sugar.activity.widgets import ActivityButton
-from sugar.activity.widgets import ActivityToolbox
-from sugar.activity.widgets import TitleEntry
-from sugar.activity.widgets import StopButton
-from sugar.activity.widgets import ShareButton
-from sugar.activity.widgets import KeepButton
+
class HelloWorldActivity(activity.Activity):
- """HelloWorldActivity class as specified in activity.info"""
+ """HelloWorldActivity class as fspecified in activity.info"""
"""HelloWorldActivity clase como se specifica en activity.info"""
def __init__(self, handle):
"""Set up the HelloWorld activity."""
"""Configurando la actividad HelloWorld."""
-
+
activity.Activity.__init__(self, handle)
# We do not have collaboration features
# Make the share option insensitive
# No tenemos caracteristicas de colaboracion
- # Deshabilitando la opcion de compartir
+ # Deshabilitando la opcion de compartir
self.max_participants = 1
- # toolbar with the new toolbar redesign
- # barra de herramientas con el nuevo diseƱo.
-
- 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()
-
- share_button = ShareButton(self)
- toolbar_box.toolbar.insert(share_button, -1)
- share_button.show()
-
- keep_button = KeepButton(self)
- toolbar_box.toolbar.insert(keep_button, -1)
- keep_button.show()
+ # toolbar with the new toolbar redesign with old toolbar compatibility
+ # barra de herramientas con el nuevo diseno y compatibilidad con las viejas barras.
+ OLD_TOOLBAR = False
+ try:
+ from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton
+ from sugar.activity.widgets import ActivityToolbarButton, StopButton, \
+ ShareButton, KeepButton, TitleEntry, ActivityButton
+
+ except ImportError:
+ OLD_TOOLBAR = True
+
+ if OLD_TOOLBAR:
+ from sugar.activity.activity import Activity, ActivityToolbox
+ toolbox = ActivityToolbox(self)
+ self.set_toolbox(toolbox)
+ toolbox.show()
+
+ else:
+ 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()
+
+ share_button = ShareButton(self)
+ toolbar_box.toolbar.insert(share_button, -1)
+ share_button.show()
+
+ keep_button = KeepButton(self)
+ toolbar_box.toolbar.insert(keep_button, -1)
+ keep_button.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()
-
- self.set_toolbar_box(toolbar_box)
- toolbar_box.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()
+
+ self.set_toolbar_box(toolbar_box)
+ toolbar_box.show()
# Label with the text, make the string translatable.
# Marca con el texto, haciendo la cadena traducible.