diff options
author | Pootle daemon <pootle@pootle.sugarlabs.org> | 2011-03-18 21:33:18 (GMT) |
---|---|---|
committer | Pootle daemon <pootle@pootle.sugarlabs.org> | 2011-03-18 21:33:18 (GMT) |
commit | 94c1ee300fa94c37b37a8d769ae32117dd844194 (patch) | |
tree | 1ad8e942e0fcef00d57e39c3c5c8c7853e88a939 | |
parent | 2c0fabdb10eb8b73fafe2a54d14df4cf7e53beed (diff) | |
parent | a406b253ebbe8e139b97d183a82ce4bc6c9ce58f (diff) |
Merge branch 'master' of git.sugarlabs.org:stopwatch/stopwatch
-rw-r--r-- | activity.py | 115 |
1 files changed, 65 insertions, 50 deletions
diff --git a/activity.py b/activity.py index 732c191..f28e976 100644 --- a/activity.py +++ b/activity.py @@ -40,62 +40,77 @@ class StopWatchActivity(Activity): Activity.__init__(self, handle) self._logger = logging.getLogger('stopwatch-activity') + # we do not have collaboration features + # make the share option insensitive + self.max_participants = 1 gobject.threads_init() # top toolbar with share and close buttons: + 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: + toolbox = ActivityToolbox(self) + self.set_toolbox(toolbox) + toolbox.show() + else: + toolbar_box = ToolbarBox() + self.activity_button = ActivityButton(self) + toolbar_box.toolbar.insert(self.activity_button, 0) + self.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) + stop_button.props.accelerator = '<Ctrl><Shift>Q' + toolbar_box.toolbar.insert(stop_button, -1) + stop_button.show() + + 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) + + self.set_canvas(self.gui.display) + self.show_all() - OLD_TOOLBAR = False - - try: - from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton - from sugar.activity.widgets import ActivityToolbarButton, StopButton - 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) - - separator = gtk.SeparatorToolItem() - separator.props.draw = False - separator.set_expand(True) - toolbar_box.toolbar.insert(separator, -1) - separator.show() - - stop_button = StopButton(self) - stop_button.props.accelerator = '<Ctrl><Shift>Q' - toolbar_box.toolbar.insert(stop_button, -1) - stop_button.show() - - 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) - - self.set_canvas(self.gui.display) - self.show_all() - - self.initiating = False + self.initiating = False - # get the Presence Service - self.pservice = presenceservice.get_instance() - # Buddy object for you - owner = self.pservice.get_owner() - self.owner = owner + # get the Presence Service + self.pservice = presenceservice.get_instance() + # Buddy object for you + owner = self.pservice.get_owner() + self.owner = owner - self.connect('shared', self._shared_cb) - self.connect('joined', self._joined_cb) - - self.add_events(gtk.gdk.VISIBILITY_NOTIFY_MASK) - self.connect("visibility-notify-event", self._visible_cb) - self.connect("notify::active", self._active_cb) + self.connect('shared', self._shared_cb) + self.connect('joined', self._joined_cb) + + self.add_events(gtk.gdk.VISIBILITY_NOTIFY_MASK) + self.connect("visibility-notify-event", self._visible_cb) + self.connect("notify::active", self._active_cb) def _shared_cb(self, activity): |