diff options
author | Rafael Ortiz <rafael@activitycentral.com> | 2011-03-04 17:32:08 (GMT) |
---|---|---|
committer | Rafael Ortiz <rafael@activitycentral.com> | 2011-03-04 17:32:08 (GMT) |
commit | e0afd16ce9bcca543a9126e00116d214582f129b (patch) | |
tree | 8d8a4f655fd0a5570bb172371303ff088c2017a5 /activity.py | |
parent | d9094d6ad39429763273e38b029a2cb3a6690b6b (diff) |
initial new toolbar compatibility
Diffstat (limited to 'activity.py')
-rw-r--r-- | activity.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/activity.py b/activity.py index 40af9c8..d61ad34 100644 --- a/activity.py +++ b/activity.py @@ -43,11 +43,27 @@ class StopWatchActivity(Activity): gobject.threads_init() # top toolbar with share and close buttons: - toolbox = ActivityToolbox(self) - self.set_toolbox(toolbox) - toolbox.show() - self.tubebox = dobject.TubeBox() + OLD_TOOLBAR = False + + try: + from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton + from sugar.activity.widgets import ActivityToolbarButton + except ImportError: + OLD_TOOLBAR = True + + if OLD_TOOLBAR: + toolbox = ActivityToolbox(self) + self.set_toolbox(toolbox) + toolbox.show() + + else: + toolbar_box = ToolbarBox() + self.activity_button = ActivityToolbarButton(self) + toolbar_box.toolbar.insert(self.activity_button, 0) + self.set_toolbar_box(toolbar_box) + + self.tubebox = dobject.TubeBox() self.timer = dobject.TimeHandler("main", self.tubebox) self.gui = stopwatch.GUIView(self.tubebox, self.timer) |