Hi Guys<br><br>i have few questions<br><br>1. can we create a shortcut for a library bundle in the favorite view ?<br><br>2. i created an activity which display html the code is<br><br><div style="margin-left: 40px; background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">
import os<br>from gettext import gettext as _<br><br>import gtk<br>import gobject<br><br>from sugar.activity import activity<br>from sugar.graphics.toolbutton import ToolButton<br><br>import hulahop<br>hulahop.startup(os.path.join(activity.get_activity_root(), 'data/gecko'))<br>
<br>from hulahop.webview import WebView<br>import xpcom<br>from xpcom.components import interfaces<br><br>gobject.threads_init()<br><br>HOME = "file:///home/olpc/Activities/Grade4.activity/index.html";<br><br>class Grade4Activity(activity.Activity):<br>
def __init__(self, handle):<br> activity.Activity.__init__(self, handle)<br><br> self.props.max_participants = 1<br><br> self._web_view = WebView()<br><br> toolbox = activity.ActivityToolbox(self)<br>
self.set_toolbox(toolbox)<br> toolbox.show()<br><br> toolbar = Toolbar(self._web_view)<br> toolbox.add_toolbar(_('Navigation'), toolbar)<br> toolbar.show()<br><br> self.set_canvas(self._web_view)<br>
self._web_view.show()<br><br> toolbox.set_current_toolbar(1)<br><br> self._web_view.load_uri(HOME)<br><br>class Toolbar(gtk.Toolbar):<br> def __init__(self, web_view):<br> gobject.GObject.__init__(self)<br>
<br> self._web_view = web_view<br><br> self._back = ToolButton('go-previous-paired')<br> self._back.set_tooltip(_('Back'))<br> self._back.props.sensitive = False<br> self._back.connect('clicked', self._go_back_cb)<br>
self.insert(self._back, -1)<br> self._back.show()<br><br> self._forward = ToolButton('go-next-paired')<br> self._forward.set_tooltip(_('Forward'))<br> self._forward.props.sensitive = False<br>
self._forward.connect('clicked', self._go_forward_cb)<br> self.insert(self._forward, -1)<br> self._forward.show()<br><br> home = ToolButton('zoom-home')<br> home.set_tooltip(_('Home'))<br>
home.connect('clicked', self._go_home_cb)<br> self.insert(home, -1)<br> home.show()<br><br> self._listener = xpcom.server.WrapObject(ProgressListener(self),<br> interfaces.nsIWebProgressListener)<br>
weak_ref = xpcom.client.WeakReference(self._listener)<br><br> mask = interfaces.nsIWebProgress.NOTIFY_STATE_NETWORK | \<br> interfaces.nsIWebProgress.NOTIFY_LOCATION<br> self._web_view.web_progress.addProgressListener(self._listener, mask)<br>
<br> def update_navigation_buttons(self):<br> can_go_back = self._web_view.web_navigation.canGoBack<br> self._back.props.sensitive = can_go_back<br><br> can_go_forward = self._web_view.web_navigation.canGoForward<br>
self._forward.props.sensitive = can_go_forward<br><br> def _go_back_cb(self, button):<br> self._web_view.web_navigation.goBack()<br> <br> def _go_forward_cb(self, button):<br> self._web_view.web_navigation.goForward()<br>
<br> def _go_home_cb(self, button):<br> self._web_view.web_navigation.goBack()<br><br>class ProgressListener(object):<br> _com_interfaces_ = interfaces.nsIWebProgressListener<br><br> def __init__(self, toolbar):<br>
self._toolbar = toolbar<br> <br> def onLocationChange(self, webProgress, request, location):<br> self._toolbar.update_navigation_buttons()<br> <br> def onProgressChange(self, webProgress, request, curSelfProgress,<br>
maxSelfProgress, curTotalProgress, maxTotalProgress):<br> pass<br> <br> def onSecurityChange(self, webProgress, request, state):<br> pass<br> <br> def onStateChange(self, webProgress, request, stateFlags, status):<br>
if stateFlags & interfaces.nsIWebProgressListener.STATE_IS_NETWORK:<br> self._toolbar.update_navigation_buttons()<br><br> def onStatusChange(self, webProgress, request, status, message):<br> pass<br>
<br></div><div style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><font color="#000000">this html file also contain some pdf file. the html files are working fine but when i click on a pdf file nothing happens.</font><br>
<font color="#000000">is it possible to view the pdf in this activity?</font><br></div><font color="#000000"><br>Regards<br></font>-- <br>Javid Alam<br>Software Developer and Technical support Officer OLPC<br>Ministry of Education<br>
Kabul Afghanistan<br>contact: +93(0)798123451<br>alternative email: <a href="mailto:javid.alam@moe.gov.af">javid.alam@moe.gov.af</a> <br>