diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-01-23 13:49:44 (GMT) |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-01-23 13:49:44 (GMT) |
commit | f79cb2db3eae59f80e8031d45376dc5f48d2af04 (patch) | |
tree | 97f578ca2ae2821fa5d950941c07a784e3771c0e /Lib/webbrowser.py | |
parent | aeb5532ca07f4f2397d6761d5b039bd862d2ab3e (diff) | |
download | cpython-f79cb2db3eae59f80e8031d45376dc5f48d2af04.zip cpython-f79cb2db3eae59f80e8031d45376dc5f48d2af04.tar.gz cpython-f79cb2db3eae59f80e8031d45376dc5f48d2af04.tar.bz2 |
Expose the autoraise capability. Improve the documentation.
Diffstat (limited to 'Lib/webbrowser.py')
-rw-r--r-- | Lib/webbrowser.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py index 36dfdc7..fb4d9a6 100644 --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -34,8 +34,8 @@ def get(using=None): # Please note: the following definition hides a builtin function. -def open(url, new=0): - get().open(url, new) +def open(url, new=0, autoraise=1): + get().open(url, new, autoraise) def open_new(url): # Marked deprecated. May be removed in 2.1. get().open(url, 1) @@ -99,13 +99,11 @@ if os.environ.get("TERM") or os.environ.get("DISPLAY"): if _iscommand("netscape") or _iscommand("mozilla"): class Netscape: "Launcher class for Netscape browsers." - autoRaise = 1 - def __init__(self, name): self.name = name - def _remote(self, action): - raise_opt = ("-noraise", "-raise")[self.autoRaise] + def _remote(self, action, autoraise): + raise_opt = ("-noraise", "-raise")[autoraise] cmd = "%s %s -remote '%s' >/dev/null 2>&1" % (self.name, raise_opt, action) rc = os.system(cmd) if rc: @@ -115,11 +113,11 @@ if os.environ.get("TERM") or os.environ.get("DISPLAY"): rc = os.system(cmd) return not rc - def open(self, url, new=0): + def open(self, url, new=0, autoraise=1): if new: - self._remote("openURL(%s, new-window)" % url) + self._remote("openURL(%s, new-window)"%url, autoraise) else: - self._remote("openURL(%s)" % url) + self._remote("openURL(%s)" % url, autoraise) # Deprecated. May be removed in 2.1. def open_new(self, url): @@ -159,7 +157,6 @@ if os.environ.get("TERM") or os.environ.get("DISPLAY"): # Deprecated. May be removed in 2.1. open_new = open - register("kfm", Konqueror, None) |