summaryrefslogtreecommitdiffstats
path: root/Lib/webbrowser.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2002-10-10 22:49:29 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2002-10-10 22:49:29 (GMT)
commit8dd28eb973a1c072448d961a6fb6a8a12cc3c950 (patch)
tree16e10c5e082a8312bc1c14f15826476b09623bd3 /Lib/webbrowser.py
parent36a4d8c20e26cfecb35677735f37df6faf32a534 (diff)
downloadcpython-8dd28eb973a1c072448d961a6fb6a8a12cc3c950.zip
cpython-8dd28eb973a1c072448d961a6fb6a8a12cc3c950.tar.gz
cpython-8dd28eb973a1c072448d961a6fb6a8a12cc3c950.tar.bz2
SF # 585913, Adds Galeon support to webbrowser.py
Diffstat (limited to 'Lib/webbrowser.py')
-rw-r--r--Lib/webbrowser.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index b562ab3..ac8ce58 100644
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -135,6 +135,33 @@ class Netscape:
self.open(url, 1)
+class Galeon:
+ """Launcher class for Galeon browsers."""
+ def __init__(self, name):
+ self.name = name
+ self.basename = os.path.basename(name)
+
+ def _remote(self, action, autoraise):
+ raise_opt = ("--noraise", "")[autoraise]
+ cmd = "%s %s %s >/dev/null 2>&1" % (self.name, raise_opt, action)
+ rc = os.system(cmd)
+ if rc:
+ import time
+ os.system("%s >/dev/null 2>&1 &" % self.name)
+ time.sleep(PROCESS_CREATION_DELAY)
+ rc = os.system(cmd)
+ return not rc
+
+ def open(self, url, new=0, autoraise=1):
+ if new:
+ self._remote("-w '%s'" % url, autoraise)
+ else:
+ self._remote("-n '%s'" % url, autoraise)
+
+ def open_new(self, url):
+ self.open(url, 1)
+
+
class Konqueror:
"""Controller for the KDE File Manager (kfm, or Konqueror).
@@ -234,7 +261,8 @@ class WindowsDefault:
# the TERM and DISPLAY cases, because we might be running Python from inside
# an xterm.
if os.environ.get("TERM") or os.environ.get("DISPLAY"):
- _tryorder = ["mozilla","netscape","kfm","grail","links","lynx","w3m"]
+ _tryorder = ["galeon", "mozilla", "netscape", "kfm",
+ "grail", "links", "lynx", "w3m",]
# Easy cases first -- register console browsers if we have them.
if os.environ.get("TERM"):
@@ -261,6 +289,10 @@ if os.environ.get("TERM") or os.environ.get("DISPLAY"):
register("mosaic", None, GenericBrowser(
"mosaic '%s' >/dev/null &"))
+ # Gnome's Galeon
+ if _iscommand("galeon"):
+ register("galeon", None, Galeon("galeon"))
+
# Konqueror/kfm, the KDE browser.
if _iscommand("kfm") or _iscommand("konqueror"):
register("kfm", Konqueror, Konqueror())