Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Ortiz <rafael@activitycentral.com>2011-03-10 20:08:17 (GMT)
committer Rafael Ortiz <rafael@activitycentral.com>2011-03-10 20:08:17 (GMT)
commit8afa0a514fc6102e54d8bb27bc5786c52e0b1681 (patch)
tree1f3f8e4b4b939151b9b78728b0dd1a195880429a
parent59da45b371e69a68eddb797a455e75eb3ff84e87 (diff)
parenta59cdaff9f92db1ddbec49a5155bec34ff350d7b (diff)
Merge branch 'master' of git.sugarlabs.org:stopwatch/stopwatch
-rw-r--r--activity.py107
-rw-r--r--mybutton.py54
-rwxr-xr-xpo/es.po25
-rw-r--r--po/fr.po38
4 files changed, 161 insertions, 63 deletions
diff --git a/activity.py b/activity.py
index 732c191..c06db43 100644
--- a/activity.py
+++ b/activity.py
@@ -44,58 +44,67 @@ class StopWatchActivity(Activity):
# 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
- 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()
+ OLD_TOOLBAR = False
+
+ try:
+ from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton
+ from sugar.activity.widgets import ActivityToolbarButton, StopButton, \
+ ShareButton, KeepButton
+ from mybutton import MyActivityToolbarButton
+ except ImportError:
+ OLD_TOOLBAR = True
+
+ if OLD_TOOLBAR:
+ toolbox = ActivityToolbox(self)
+ self.set_toolbox(toolbox)
+ toolbox.show()
+ else:
+ toolbar_box = ToolbarBox()
+ self.activity_button = MyActivityToolbarButton(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()
+
+ 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()
+
+ 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):
diff --git a/mybutton.py b/mybutton.py
new file mode 100644
index 0000000..1b38a75
--- /dev/null
+++ b/mybutton.py
@@ -0,0 +1,54 @@
+# 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()
diff --git a/po/es.po b/po/es.po
index c4dd712..b686c57 100755
--- a/po/es.po
+++ b/po/es.po
@@ -2,39 +2,36 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-12-05 18:14-0500\n"
+"POT-Creation-Date: 2009-12-06 00:41+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-
+"X-Generator: Translate Toolkit 1.7.0\n"
+
#: activity/activity.info:2
msgid "StopWatch"
msgstr "CronóMetro"
-
-#: /home/cjb/git/stopwatch/stopwatch.py:162
+
+#: stopwatch.py:162
msgid "Start/Stop"
msgstr "Iniciar/Detener"
-
-#: /home/cjb/git/stopwatch/stopwatch.py:170
+
+#: stopwatch.py:170
msgid "Zero"
msgstr "Cero"
-
-#: /home/cjb/git/stopwatch/stopwatch.py:177
+
+#: stopwatch.py:177
msgid "Mark"
msgstr "Marca"
-
-#: /home/cjb/git/stopwatch/stopwatch.py:410
+
+#: stopwatch.py:410
msgid "Stopwatch"
msgstr "Cronómetro"
-
-
-
diff --git a/po/fr.po b/po/fr.po
new file mode 100644
index 0000000..840ed05
--- /dev/null
+++ b/po/fr.po
@@ -0,0 +1,38 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-12-06 00:41+0000\n"
+"PO-Revision-Date: 2011-03-08 07:48+0200\n"
+"Last-Translator: Rafael Ortiz <rafael@laptop.org>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+"X-Generator: Pootle 2.0.1\n"
+
+#: activity/activity.info:2
+msgid "StopWatch"
+msgstr ""
+
+#: stopwatch.py:162
+msgid "Start/Stop"
+msgstr "Démarrer/Arrêter"
+
+#: stopwatch.py:170
+msgid "Zero"
+msgstr "Zero"
+
+#: stopwatch.py:177
+msgid "Mark"
+msgstr ""
+
+#: stopwatch.py:410
+msgid "Stopwatch"
+msgstr ""