[maemo-commits] [maemo-commits] r8485 - projects/haf/trunk/python/Lib
From: www-data at stage.maemo.org www-data at stage.maemo.orgDate: Thu Nov 30 00:01:35 EET 2006
- Previous message: [maemo-commits] r8484 - projects/haf/trunk/python/Lib/email/mime
- Next message: [maemo-commits] r8486 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: osantana
Date: 2006-11-30 00:01:32 +0200 (Thu, 30 Nov 2006)
New Revision: 8485
Modified:
projects/haf/trunk/python/Lib/webbrowser.py
Log:
added support to open maemo browser
Modified: projects/haf/trunk/python/Lib/webbrowser.py
===================================================================
--- projects/haf/trunk/python/Lib/webbrowser.py 2006-11-29 21:58:40 UTC (rev 8484)
+++ projects/haf/trunk/python/Lib/webbrowser.py 2006-11-29 22:01:32 UTC (rev 8485)
@@ -49,10 +49,10 @@
# It is recommended one does "import webbrowser" and uses webbrowser.open(url)
# instead of "from webbrowser import *".
-def open(url, new=0, autoraise=1):
+def open(url, new=0, autoraise=1, context=None):
for name in _tryorder:
browser = get(name)
- if browser.open(url, new, autoraise):
+ if browser.open(url, new, autoraise, context):
return True
return False
@@ -138,7 +138,7 @@
self.name = name
self.basename = name
- def open(self, url, new=0, autoraise=1):
+ def open(self, url, new=0, autoraise=1, context=None):
raise NotImplementedError
def open_new(self, url):
@@ -161,7 +161,7 @@
self.args = name[1:]
self.basename = os.path.basename(self.name)
- def open(self, url, new=0, autoraise=1):
+ def open(self, url, new=0, autoraise=1, context=None):
cmdline = [self.name] + [arg.replace("%s", url)
for arg in self.args]
try:
@@ -175,7 +175,7 @@
"""Class for all browsers which are to be started in the
background."""
- def open(self, url, new=0, autoraise=1):
+ def open(self, url, new=0, autoraise=1, context=None):
cmdline = [self.name] + [arg.replace("%s", url)
for arg in self.args]
setsid = getattr(os, 'setsid', None)
@@ -243,7 +243,7 @@
else:
return not p.wait()
- def open(self, url, new=0, autoraise=1):
+ def open(self, url, new=0, autoraise=1, context=None):
if new == 0:
action = self.remote_action
elif new == 1:
@@ -327,7 +327,7 @@
for more information on the Konqueror remote-control interface.
"""
- def open(self, url, new=0, autoraise=1):
+ def open(self, url, new=0, autoraise=1, context=None):
# XXX Currently I know no way to prevent KFM from opening a new win.
if new == 2:
action = "newTab"
@@ -376,7 +376,17 @@
else:
return (p.poll() is None)
+class MaemoBrowser(BaseBrowser):
+ """Controller for the Maemo Browser.
+ """
+ def open(self, url, new=0, autoraise=1, context=None):
+ if context is None:
+ raise Error("Missing OSSO Context parameter. Please, read the\n"\
+ "Python for Maemo documentation for more "\
+ "information.")
+ context.rpc_run_with_defaults('osso_browser', 'open_new_window', (url,))
+
class Grail(BaseBrowser):
# There should be a way to maintain a connection to Grail, but the
# Grail remote control protocol doesn't really allow that at this
@@ -415,7 +425,7 @@
s.close()
return 1
- def open(self, url, new=0, autoraise=1):
+ def open(self, url, new=0, autoraise=1, context=None):
if new:
ok = self._remote("LOADNEW " + url)
else:
@@ -431,6 +441,8 @@
# a console terminal or an X display to run.
def register_X_browsers():
+ register("maemobrowser", MaemoBroser())
+
# The default Gnome browser
if _iscommand("gconftool-2"):
# get the web browser string from gconftool
@@ -477,6 +489,7 @@
if _iscommand("grail"):
register("grail", Grail, None)
+
# Prefer X browsers if present
if os.environ.get("DISPLAY"):
register_X_browsers()
- Previous message: [maemo-commits] r8484 - projects/haf/trunk/python/Lib/email/mime
- Next message: [maemo-commits] r8486 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
