<span id="result_box" class="short_text"><span style="background-color: rgb(255, 255, 255);" title="żNo puedes usar hulahop como en SocialCalc?">Can't you use hulahop like SocialCalc?</span></span><br><br>Gonzalo<br><br>
<div class="gmail_quote">On Mon, Feb 1, 2010 at 4:58 PM, Behavior Vehikel <span dir="ltr"><<a href="mailto:b.vehikel@googlemail.com">b.vehikel@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
How to start the Browse activity from my own activity?<br>
<br>
My Kandid activity can dump internal states as a HTML files. For<br>
example this information is written to<br>
~/.sugar/default/net.sourceforge.kandid/tmp/_znuaxz_169/index.html<br>
<br>
Now I am searching for a possibility to launch the Brows activity<br>
displaying this HTML file.<br>
First I tried using the webbrowser.open() method from Python. But no<br>
effect when running under SoaS release 2 (Bluberry) Sugar 0.86.3<br>
<br>
def on_explain_activate(self, *args):<br>
<a href="http://ka_debug.info" target="_blank">ka_debug.info</a>('on_explain_activate [%s]' % args[0].get_name())<br>
protozoon = self.model.protozoans[name_to_index(args[0].get_name())]<br>
folder = os.path.join(self._activity_root, 'tmp')<br>
file_path = 'file://' + self.explain('html', protozoon, 'index', folder)<br>
#Start up a new instance of the Web activity.<br>
result = webbrowser.open(file_path)<br>
<a href="http://ka_debug.info" target="_blank">ka_debug.info</a>('webbrowser.open: [%s] %s' % (file_path, str(result)))<br>
<br>
<br>
My second try and error version is using the<br>
activityfactory.create_with_uri() method.<br>
But it will produce an exception when running with SoaS Bluberry.<br>
<br>
def on_explain_activate(self, *args):<br>
<a href="http://ka_debug.info" target="_blank">ka_debug.info</a>('on_explain_activate [%s]' % args[0].get_name())<br>
protozoon = self.model.protozoans[name_to_index(args[0].get_name())]<br>
folder = os.path.join(self._activity_root, 'tmp')<br>
file_path = 'file://' + self.explain('html', protozoon, 'index', folder)<br>
#Start up a new instance of the Web activity.<br>
<a href="http://ka_debug.info" target="_blank">ka_debug.info</a>('webbrowser.open: [%s]' % (file_path))<br>
activityfactory.create_with_uri('org.laptop.WebActivity', file_path)<br>
<br>
1265051065.540251 DEBUG Kandid: on_explain_activate [exportpng_menuitem_2]<br>
<br>
1265051069.314681 DEBUG Kandid: webbrowser.open:<br>
[file:///home/liveuser/.sugar/default/net.sourceforge.kandid/tmp/_xjwwqo_43/index.html]<br>
<br>
Traceback (most recent call last):<br>
<br>
File "/home/liveuser/Activities/Kandid.activity/ka_controller.py",<br>
line 340, in on_explain_activate<br>
<br>
activityfactory.create_with_uri('org.laptop.WebActivity', file_path)<br>
<br>
File "/usr/lib/python2.6/site-packages/sugar/activity/activityfactory.py",<br>
line 332, in create_with_uri<br>
<br>
return ActivityCreationHandler(bundle, activity_handle)<br>
<br>
File "/usr/lib/python2.6/site-packages/sugar/activity/activityfactory.py",<br>
line 206, in __init__<br>
<br>
self._service_name = bundle.get_bundle_id()<br>
<br>
AttributeError: 'str' object has no attribute 'get_bundle_id'<br>
<br>
1265051112.422281 DEBUG Kandid: write_file<br>
[/home/liveuser/.sugar/default/net.sourceforge.kandid/instance/1265051112]<br>
<br>
<br>
<br>
How can I start a browser to display a HTML page? Please add more<br>
information to <a href="http://wiki.sugarlabs.org/go/Development_Team/Almanac/sugar.activity.activityfactory" target="_blank">http://wiki.sugarlabs.org/go/Development_Team/Almanac/sugar.activity.activityfactory</a><br>
<br>
Thanks, Thomas<br>
_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Gonzalo Odiard<br>Responsable de Desarrollo<br>Sistemas Australes<br>