Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TamTamJam.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-07-31 01:27:04 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2011-07-31 22:34:07 (GMT)
commit7f3ad4e1c292b60035fd7f018fe67a737194a5af (patch)
tree6e103bed1b8d403079a9fb9819a494751a2a7a34 /TamTamJam.py
parentab8ab494c9e30abc7cafab485545dfb128157238 (diff)
add support for new toolbars
Added support for 0.86 toolbars.
Diffstat (limited to 'TamTamJam.py')
-rw-r--r--TamTamJam.py42
1 files changed, 37 insertions, 5 deletions
diff --git a/TamTamJam.py b/TamTamJam.py
index e8766db..be2443e 100644
--- a/TamTamJam.py
+++ b/TamTamJam.py
@@ -42,6 +42,15 @@ from common.Util.Trackpad import Trackpad
from gettext import gettext as _
import commands
from sugar.activity import activity
+try:
+ from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton
+ HAVE_TOOLBOX = True
+except ImportError:
+ HAVE_TOOLBOX = False
+
+if HAVE_TOOLBOX:
+ from sugar.activity.widgets import ActivityToolbarButton
+ from sugar.activity.widgets import StopButton
class TamTamJam(activity.Activity):
@@ -72,12 +81,22 @@ class TamTamJam(activity.Activity):
self.connect('destroy', self.onDestroy)
#load the sugar toolbar
- toolbox = activity.ActivityToolbox(self)
- self.set_toolbox(toolbox)
-
- self.activity_toolbar = toolbox.get_activity_toolbar()
+ self.have_toolbox = HAVE_TOOLBOX
+ if HAVE_TOOLBOX:
+ self.toolbox = ToolbarBox()
+ activity_button = ActivityToolbarButton(self)
+ self.toolbox.toolbar.insert(activity_button, 0)
+ activity_button.show()
+ separator = gtk.SeparatorToolItem()
+ separator.props.draw = True
+ separator.set_expand(False)
+ self.toolbox.toolbar.insert(separator, -1)
+ separator.show()
+ else:
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
- toolbox.show()
+ self.toolbox.show()
self.trackpad.setContext('jam')
self.jam = JamMain(self)
@@ -150,3 +169,16 @@ class TamTamJam(activity.Activity):
def write_file(self, file_path):
self.jam.handleJournalSave(file_path)
+
+ def add_stop_button(self):
+ ''' Add a stop button if using the new toolbars '''
+ if self.have_toolbox:
+ separator = gtk.SeparatorToolItem()
+ separator.props.draw = False
+ separator.set_expand(True)
+ self.toolbox.toolbar.insert(separator, -1)
+ separator.show()
+ stop_button = StopButton(self)
+ stop_button.props.accelerator = '<Ctrl>q'
+ self.toolbox.toolbar.insert(stop_button, -1)
+ stop_button.show()