Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Jordan <bjordan@wireless-19-111.media.mit.edu>2008-09-10 18:49:18 (GMT)
committer Brian Jordan <bjordan@wireless-19-111.media.mit.edu>2008-09-10 18:49:18 (GMT)
commit17d222824734b85cbb3a431a75df8fb3d9402a39 (patch)
tree1d49e6336f46827690f85c15d1b2daa1234237f3
parent16220712fa096765e156c623da589ab34374e074 (diff)
Adding marcopg's help activity shell
-rw-r--r--MANIFEST5
-rw-r--r--activity/activity-help.svg15
-rwxr-xr-xactivity/activity.info6
-rw-r--r--helpactivity.py131
-rw-r--r--index.html1
-rwxr-xr-xsetup.py21
6 files changed, 179 insertions, 0 deletions
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..beed661
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,5 @@
+index.html
+helpactivity.py
+setup.py
+activity/activity.info
+activity/activity-help.svg
diff --git a/activity/activity-help.svg b/activity/activity-help.svg
new file mode 100644
index 0000000..c8f466a
--- /dev/null
+++ b/activity/activity-help.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#FFFFFF">
+]><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="activity-browse">
+ <circle cx="27.375" cy="27.5" display="inline" fill="&fill_color;" r="19.903" stroke="&stroke_color;" stroke-width="3.5"/>
+ <g display="inline">
+ <path d="M27.376,7.598c0,0-11.205,8.394-11.205,19.976 c0,11.583,11.205,19.829,11.205,19.829" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5"/>
+ <path d="M27.376,7.598c0,0,11.066,9.141,11.066,19.976 c0,10.839-11.066,19.829-11.066,19.829" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5"/>
+ <line fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" x1="27.376" x2="27.376" y1="7.598" y2="47.402"/>
+ <line fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" x1="27.376" x2="27.376" y1="7.598" y2="47.402"/>
+ <line fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" x1="27.376" x2="27.376" y1="7.598" y2="47.402"/>
+ <line fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" x1="7.472" x2="47.278" y1="27.5" y2="27.5"/>
+ </g>
+</g></svg>
+
diff --git a/activity/activity.info b/activity/activity.info
new file mode 100755
index 0000000..4df3520
--- /dev/null
+++ b/activity/activity.info
@@ -0,0 +1,6 @@
+[Activity]
+name = Help
+activity_version = 1
+service_name = org.laptop.HelpActivity
+icon = activity-help
+exec = sugar-activity helpactivity.HelpActivity
diff --git a/helpactivity.py b/helpactivity.py
new file mode 100644
index 0000000..03f6266
--- /dev/null
+++ b/helpactivity.py
@@ -0,0 +1,131 @@
+# Copyright (C) 2006, Red Hat, Inc.
+#
+# 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
+
+import os
+from gettext import gettext as _
+
+import gtk
+import gobject
+
+from sugar.activity import activity
+from sugar.graphics.toolbutton import ToolButton
+
+import hulahop
+hulahop.startup(os.path.join(activity.get_activity_root(), 'data/gecko'))
+
+from hulahop.webview import WebView
+import xpcom
+from xpcom.components import interfaces
+
+gobject.threads_init()
+
+HOME = os.path.join(activity.get_bundle_path(), 'index.html')
+
+class HelpActivity(activity.Activity):
+ def __init__(self, handle):
+ activity.Activity.__init__(self, handle)
+
+ self.props.max_participants = 1
+
+ self._web_view = WebView()
+
+ toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(toolbox)
+ toolbox.show()
+
+ toolbar = Toolbar(self._web_view)
+ toolbox.add_toolbar(_('Navigation'), toolbar)
+ toolbar.show()
+
+ self.set_canvas(self._web_view)
+ self._web_view.show()
+
+ toolbox.set_current_toolbar(1)
+
+ self._web_view.load_uri(HOME)
+
+class Toolbar(gtk.Toolbar):
+ def __init__(self, web_view):
+ gobject.GObject.__init__(self)
+
+ self._web_view = web_view
+
+ self._back = ToolButton('go-previous-paired')
+ self._back.set_tooltip(_('Back'))
+ self._back.props.sensitive = False
+ self._back.connect('clicked', self._go_back_cb)
+ self.insert(self._back, -1)
+ self._back.show()
+
+ self._forward = ToolButton('go-next-paired')
+ self._forward.set_tooltip(_('Forward'))
+ self._forward.props.sensitive = False
+ self._forward.connect('clicked', self._go_forward_cb)
+ self.insert(self._forward, -1)
+ self._forward.show()
+
+ home = ToolButton('zoom-home')
+ home.set_tooltip(_('Home'))
+ home.connect('clicked', self._go_home_cb)
+ self.insert(home, -1)
+ home.show()
+
+ self._listener = xpcom.server.WrapObject(ProgressListener(self),
+ interfaces.nsIWebProgressListener)
+ weak_ref = xpcom.client.WeakReference(self._listener)
+
+ mask = interfaces.nsIWebProgress.NOTIFY_STATE_NETWORK | \
+ interfaces.nsIWebProgress.NOTIFY_LOCATION
+ self._web_view.web_progress.addProgressListener(self._listener, mask)
+
+ def update_navigation_buttons(self):
+ can_go_back = self._web_view.web_navigation.canGoBack
+ self._back.props.sensitive = can_go_back
+
+ can_go_forward = self._web_view.web_navigation.canGoForward
+ self._forward.props.sensitive = can_go_forward
+
+ def _go_back_cb(self, button):
+ self._web_view.web_navigation.goBack()
+
+ def _go_forward_cb(self, button):
+ self._web_view.web_navigation.goForward()
+
+ def _go_home_cb(self, button):
+ self._web_view.web_navigation.goBack()
+
+class ProgressListener(object):
+ _com_interfaces_ = interfaces.nsIWebProgressListener
+
+ def __init__(self, toolbar):
+ self._toolbar = toolbar
+
+ def onLocationChange(self, webProgress, request, location):
+ self._toolbar.update_navigation_buttons()
+
+ def onProgressChange(self, webProgress, request, curSelfProgress,
+ maxSelfProgress, curTotalProgress, maxTotalProgress):
+ pass
+
+ def onSecurityChange(self, webProgress, request, state):
+ pass
+
+ def onStateChange(self, webProgress, request, stateFlags, status):
+ if stateFlags & interfaces.nsIWebProgressListener.STATE_IS_NETWORK:
+ self._toolbar.update_navigation_buttons()
+
+ def onStatusChange(self, webProgress, request, status, message):
+ pass
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..7f1285f
--- /dev/null
+++ b/index.html
@@ -0,0 +1 @@
+<html><body><a href="http://www.laptop.org">Hello!</a></body></html>
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..b4633a0
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2008, Red Hat, Inc.
+#
+# 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
+
+from sugar.activity import bundlebuilder
+
+bundlebuilder.start('Help')