Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'src/extensions')
-rwxr-xr-xsrc/extensions/tutoriusremote.py74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/extensions/tutoriusremote.py b/src/extensions/tutoriusremote.py
new file mode 100755
index 0000000..9bb4bfb
--- /dev/null
+++ b/src/extensions/tutoriusremote.py
@@ -0,0 +1,74 @@
+# Copyright (C) 2009, Tutorius.org
+# Copyright (C) 2009, Simon Poirier <simpoir@gmail.com>
+#
+#
+# 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 USA
+"""
+This modules regroups the UI elements that drives the tutorial and tutorial
+creator from the Sugar frame.
+"""
+
+import gtk
+from gettext import gettext as _
+import gconf
+import dbus
+
+from sugar.graphics.tray import TrayIcon
+from sugar.graphics.palette import Palette
+from sugar.graphics.xocolor import XoColor
+
+from jarabe.frame.frameinvoker import FrameWidgetInvoker
+
+from sugar.tutorius.creator import default_creator
+
+_ICON_NAME = 'tutortool'
+
+class TutoriusRemote(TrayIcon):
+
+ FRAME_POSITION_RELATIVE = 102
+
+ def __init__(self, creator):
+ self._creator = creator
+
+ client = gconf.client_get_default()
+ self._color = XoColor(client.get_string('/desktop/sugar/user/color'))
+
+ super(TutoriusRemote, self).__init__(icon_name=_ICON_NAME,
+ xo_color=self._color)
+
+ self.set_palette_invoker(FrameWidgetInvoker(self))
+
+ self.palette = TPalette(_('Tutorius'))
+ self.palette.set_group_id('frame')
+
+
+class TPalette(Palette):
+ def __init__(self, primary_text):
+ super(TPalette, self).__init__(primary_text)
+
+ self._creator_item = gtk.MenuItem(_('Create a tutorial'))
+ self._creator_item.connect('activate', self._start_creator)
+ self._creator_item.show()
+ self.menu.append(self._creator_item)
+
+ self.set_content(None)
+
+ def _start_creator(self, widget):
+ default_creator().start_authoring(tutorial=None)
+
+
+
+def setup(tray):
+ tray.add_device(TutoriusRemote(default_creator()))