Reply
Thread Tools
fpp's Avatar
Posts: 2,853 | Thanked: 968 times | Joined on Nov 2005
#11
Maybe I misunderstand the original question, but why not use the "standard" Python way of doing this ? Is the webbrowser module not available in pymaemo ?...

http://docs.python.org/library/webbr...ule-webbrowser
 
Jaffa's Avatar
Posts: 2,535 | Thanked: 6,681 times | Joined on Mar 2008 @ UK
#12
The webbrowser module is available. However, you need to hack around a broken gconf key. There's an internal bug for it and you can see it being overridden in Hermes' postinst.
__________________
Andrew Flegg -- mailto:andrew@bleb.org | http://www.bleb.org
 
fredrik_wendt's Avatar
Posts: 43 | Thanked: 28 times | Joined on Nov 2009 @ Göteborg, Sweden
#13
Originally Posted by Jaffa View Post
The webbrowser module is available. However, you need to hack around a broken gconf key. There's an internal bug for it and you can see it being overridden in Hermes' postinst.
Jaffa, doesn't the Hermes code just exit if it's incorrect?
Code:
if (gc.get_string('/desktop/gnome/url-handlers/http/command') == 'epiphany %s'):
         raise Exception('Browser in gconf invalid (see NB#136012). Installation error.')
 
Jaffa's Avatar
Posts: 2,535 | Thanked: 6,681 times | Joined on Mar 2008 @ UK
#14
Originally Posted by fredrik_wendt View Post
Jaffa, doesn't the Hermes code just exit if it's incorrect?
Code:
if (gc.get_string('/desktop/gnome/url-handlers/http/command') == 'epiphany %s'):
         raise Exception('Browser in gconf invalid (see NB#136012). Installation error.')
There's also this in hermes.postinst:

Code:
# Hacky fix for NB#136012
gconftool-2 -s /desktop/gnome/url-handlers/http/command 'dbus-send --system --type=method_call --dest="com.nokia.osso_browser" --print-reply /com/nokia/osso_browser/request com.nokia.osso_browser.load_url string:"%s"' --type string
__________________
Andrew Flegg -- mailto:andrew@bleb.org | http://www.bleb.org
 
lostinmirkwood's Avatar
Posts: 128 | Thanked: 232 times | Joined on Sep 2009 @ New Jersey, USA
#15
I found Two alternatives:
Code:
import os
url='http://www.maemo.org'
os.system('browser --url=%s' %url)
Code:
import webbrowser
webbrowser.open_new('http://www.maemo.org')
Although both work the first solution tends to lock your code as described in browser-proxy.py (and above in this post), and the browser command isn't available on all os (obviously)

The second solution works in ubuntu as well as maemo5 without issue or the need for dbus or osso in your depends

http://docs.python.org/library/webbrowser.html
The webbrowser module provides a high-level interface to allow displaying Web-based documents to users. Under most circumstances, simply calling the open() function from this module will do the right thing.

I love the will do the right thing. quote, it seems to just do that.

Last edited by lostinmirkwood; 2010-06-10 at 05:02. Reason: added quote and thread link
 
Reply

Tags
browser, dbus, python

Thread Tools

 
Forum Jump


All times are GMT. The time now is 10:06.