diff options
author | Sebastian Silva <sebastian@sugarlabs.org> | 2011-03-16 04:54:26 (GMT) |
---|---|---|
committer | Sebastian Silva <sebastian@sugarlabs.org> | 2011-03-16 04:54:26 (GMT) |
commit | a406b253ebbe8e139b97d183a82ce4bc6c9ce58f (patch) | |
tree | a431dc1c0cb172a391a9d8c06b31a9e6da475305 | |
parent | a59cdaff9f92db1ddbec49a5155bec34ff350d7b (diff) |
As per design team.
-rw-r--r-- | activity.py | 26 | ||||
-rw-r--r-- | mybutton.py | 54 |
2 files changed, 16 insertions, 64 deletions
diff --git a/activity.py b/activity.py index c06db43..f28e976 100644 --- a/activity.py +++ b/activity.py @@ -40,17 +40,18 @@ 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 - from mybutton import MyActivityToolbarButton + ShareButton, KeepButton, TitleEntry, ActivityButton except ImportError: OLD_TOOLBAR = True @@ -60,14 +61,13 @@ class StopWatchActivity(Activity): toolbox.show() else: toolbar_box = ToolbarBox() - self.activity_button = MyActivityToolbarButton(self) + self.activity_button = ActivityButton(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() + 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) @@ -77,6 +77,12 @@ class StopWatchActivity(Activity): 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) diff --git a/mybutton.py b/mybutton.py deleted file mode 100644 index 1b38a75..0000000 --- a/mybutton.py +++ /dev/null @@ -1,54 +0,0 @@ -# mybutton.py A version of ActivityToolbarButton that hides the "Keep" -# button. - -# Copyright (C) 2010 James D. Simmons -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US -import gtk -import gconf - -from sugar.graphics.toolbarbox import ToolbarButton -from sugar.activity.widgets import ActivityToolbar -from sugar.graphics.xocolor import XoColor -from sugar.graphics.icon import Icon -from sugar.bundle.activitybundle import ActivityBundle - -def _create_activity_icon(metadata): - if metadata.get('icon-color', ''): - color = XoColor(metadata['icon-color']) - else: - client = gconf.client_get_default() - color = XoColor(client.get_string('/desktop/sugar/user/color')) - - from sugar.activity.activity import get_bundle_path - bundle = ActivityBundle(get_bundle_path()) - icon = Icon(file=bundle.get_icon(), xo_color=color) - - return icon - -class MyActivityToolbarButton(ToolbarButton): - - def __init__(self, activity, **kwargs): - toolbar = ActivityToolbar(activity, orientation_left=True) - toolbar.share.hide() - toolbar.stop.hide() - toolbar.keep.hide() - toolbar.title.unset_flags(gtk.CAN_FOCUS) - - ToolbarButton.__init__(self, page=toolbar, **kwargs) - - icon = _create_activity_icon(activity.metadata) - self.set_icon_widget(icon) - icon.show() |