diff options
author | Rafael Ortiz <rafael@activitycentral.com> | 2011-07-08 14:32:33 (GMT) |
---|---|---|
committer | Rafael Ortiz <rafael@activitycentral.com> | 2011-07-08 14:32:33 (GMT) |
commit | 72c8360491db55aaa67cf149356dc0d474691cdb (patch) | |
tree | 48b6a2b1b59dff5ec0ee974a0f36aa3744d883b0 | |
parent | 08f7b8b2929946da8793aaa54227e1fce6e94498 (diff) |
making groupthink sugar-084 compatible, there are some issues with rainbow AIUI
-rw-r--r-- | edit_app.py | 6 | ||||
-rw-r--r-- | groupthink/sugar_tools.py | 48 |
2 files changed, 45 insertions, 9 deletions
diff --git a/edit_app.py b/edit_app.py index 5a05f0d..2a8f819 100644 --- a/edit_app.py +++ b/edit_app.py @@ -209,7 +209,7 @@ class EditActivity(sugar_tools.GroupActivity): #if we were edited in another program #we need to reload the text #setting self.refresh_buffer makes us do that - text = open(filename, "r").read() # yay hackish one-line read + #text = open(filename, "r").read() # yay hackish one-line read self.refresh_buffer = text #File has been saved with Edit, thus @@ -218,9 +218,9 @@ class EditActivity(sugar_tools.GroupActivity): return self.metadata[mdnames.cloudstring_md] else: - text = open(filename, "r").read() # yay hackish one-line read + #text = open(filename, "r").read() # yay hackish one-line read - self.buffer.set_text(text) + # self.buffer.set_text(text) return None def when_shared(self): diff --git a/groupthink/sugar_tools.py b/groupthink/sugar_tools.py index d68b616..43b5703 100644 --- a/groupthink/sugar_tools.py +++ b/groupthink/sugar_tools.py @@ -17,8 +17,27 @@ import logging import telepathy -from sugar.activity.activity import Activity -from sugar.graphics.toolbarbox import ToolbarBox +try: # Can use 'New' toolbar design? + from sugar.activity.activity import Activity + from sugar.graphics.toolbarbox import ToolbarBox + from sugar.activity.widgets import ActivityToolbarButton, StopButton + _HAVE_TOOLBOX = True + +except ImportError: + _HAVE_TOOLBOX = False + + +if _HAVE_TOOLBOX: + from sugar.activity.widgets import ActivityToolbarButton, StopButton + from sugar.graphics.toolbarbox import ToolbarButton + +from sugar.activity import activity +from sugar.graphics import style +from sugar.activity.activity import EditToolbar +from sugar.graphics.toolbutton import ToolButton +from sugar.graphics.alert import Alert +from sugar.graphics.icon import Icon + from sugar.presence import presenceservice @@ -70,10 +89,27 @@ class GroupActivity(Activity): else: self.message = self.message_preparing - # top toolbar with share and close buttons: - toolbox = ToolbarBox(self) - self.set_toolbox(toolbox) - toolbox.show() + # Top toolbar with share and close buttons: + if _HAVE_TOOLBOX: + # 'New' Sugar toolbar design + toolbox = ToolbarBox() + + activity_button = ActivityToolbarButton(self) + toolbox.toolbar.insert(activity_button, 0) + activity_button.show() + + self.set_toolbar_box(toolbox) + toolbox.show() + toolbar = toolbox.toolbar + + else: + toolbar = activity.ActivityToolbar(self) + toolbar.show() + self.set_toolbox(toolbar) + + #toolbox = ToolbarBox(self) + #self.set_toolbox(toolbox) + #toolbox.show() v = gtk.VBox() self.startup_label = gtk.Label(self.message) |