Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/lib64/python3....
File: webbrowser.py
#! /usr/bin/python3.8
[0] Fix | Delete
"""Interfaces for launching and remotely controlling Web browsers."""
[1] Fix | Delete
# Maintained by Georg Brandl.
[2] Fix | Delete
[3] Fix | Delete
import os
[4] Fix | Delete
import shlex
[5] Fix | Delete
import shutil
[6] Fix | Delete
import sys
[7] Fix | Delete
import subprocess
[8] Fix | Delete
import threading
[9] Fix | Delete
[10] Fix | Delete
__all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"]
[11] Fix | Delete
[12] Fix | Delete
class Error(Exception):
[13] Fix | Delete
pass
[14] Fix | Delete
[15] Fix | Delete
_lock = threading.RLock()
[16] Fix | Delete
_browsers = {} # Dictionary of available browser controllers
[17] Fix | Delete
_tryorder = None # Preference order of available browsers
[18] Fix | Delete
_os_preferred_browser = None # The preferred browser
[19] Fix | Delete
[20] Fix | Delete
def register(name, klass, instance=None, *, preferred=False):
[21] Fix | Delete
"""Register a browser connector."""
[22] Fix | Delete
with _lock:
[23] Fix | Delete
if _tryorder is None:
[24] Fix | Delete
register_standard_browsers()
[25] Fix | Delete
_browsers[name.lower()] = [klass, instance]
[26] Fix | Delete
[27] Fix | Delete
# Preferred browsers go to the front of the list.
[28] Fix | Delete
# Need to match to the default browser returned by xdg-settings, which
[29] Fix | Delete
# may be of the form e.g. "firefox.desktop".
[30] Fix | Delete
if preferred or (_os_preferred_browser and name in _os_preferred_browser):
[31] Fix | Delete
_tryorder.insert(0, name)
[32] Fix | Delete
else:
[33] Fix | Delete
_tryorder.append(name)
[34] Fix | Delete
[35] Fix | Delete
def get(using=None):
[36] Fix | Delete
"""Return a browser launcher instance appropriate for the environment."""
[37] Fix | Delete
if _tryorder is None:
[38] Fix | Delete
with _lock:
[39] Fix | Delete
if _tryorder is None:
[40] Fix | Delete
register_standard_browsers()
[41] Fix | Delete
if using is not None:
[42] Fix | Delete
alternatives = [using]
[43] Fix | Delete
else:
[44] Fix | Delete
alternatives = _tryorder
[45] Fix | Delete
for browser in alternatives:
[46] Fix | Delete
if '%s' in browser:
[47] Fix | Delete
# User gave us a command line, split it into name and args
[48] Fix | Delete
browser = shlex.split(browser)
[49] Fix | Delete
if browser[-1] == '&':
[50] Fix | Delete
return BackgroundBrowser(browser[:-1])
[51] Fix | Delete
else:
[52] Fix | Delete
return GenericBrowser(browser)
[53] Fix | Delete
else:
[54] Fix | Delete
# User gave us a browser name or path.
[55] Fix | Delete
try:
[56] Fix | Delete
command = _browsers[browser.lower()]
[57] Fix | Delete
except KeyError:
[58] Fix | Delete
command = _synthesize(browser)
[59] Fix | Delete
if command[1] is not None:
[60] Fix | Delete
return command[1]
[61] Fix | Delete
elif command[0] is not None:
[62] Fix | Delete
return command[0]()
[63] Fix | Delete
raise Error("could not locate runnable browser")
[64] Fix | Delete
[65] Fix | Delete
# Please note: the following definition hides a builtin function.
[66] Fix | Delete
# It is recommended one does "import webbrowser" and uses webbrowser.open(url)
[67] Fix | Delete
# instead of "from webbrowser import *".
[68] Fix | Delete
[69] Fix | Delete
def open(url, new=0, autoraise=True):
[70] Fix | Delete
"""Display url using the default browser.
[71] Fix | Delete
[72] Fix | Delete
If possible, open url in a location determined by new.
[73] Fix | Delete
- 0: the same browser window (the default).
[74] Fix | Delete
- 1: a new browser window.
[75] Fix | Delete
- 2: a new browser page ("tab").
[76] Fix | Delete
If possible, autoraise raises the window (the default) or not.
[77] Fix | Delete
"""
[78] Fix | Delete
if _tryorder is None:
[79] Fix | Delete
with _lock:
[80] Fix | Delete
if _tryorder is None:
[81] Fix | Delete
register_standard_browsers()
[82] Fix | Delete
for name in _tryorder:
[83] Fix | Delete
browser = get(name)
[84] Fix | Delete
if browser.open(url, new, autoraise):
[85] Fix | Delete
return True
[86] Fix | Delete
return False
[87] Fix | Delete
[88] Fix | Delete
def open_new(url):
[89] Fix | Delete
"""Open url in a new window of the default browser.
[90] Fix | Delete
[91] Fix | Delete
If not possible, then open url in the only browser window.
[92] Fix | Delete
"""
[93] Fix | Delete
return open(url, 1)
[94] Fix | Delete
[95] Fix | Delete
def open_new_tab(url):
[96] Fix | Delete
"""Open url in a new page ("tab") of the default browser.
[97] Fix | Delete
[98] Fix | Delete
If not possible, then the behavior becomes equivalent to open_new().
[99] Fix | Delete
"""
[100] Fix | Delete
return open(url, 2)
[101] Fix | Delete
[102] Fix | Delete
[103] Fix | Delete
def _synthesize(browser, *, preferred=False):
[104] Fix | Delete
"""Attempt to synthesize a controller based on existing controllers.
[105] Fix | Delete
[106] Fix | Delete
This is useful to create a controller when a user specifies a path to
[107] Fix | Delete
an entry in the BROWSER environment variable -- we can copy a general
[108] Fix | Delete
controller to operate using a specific installation of the desired
[109] Fix | Delete
browser in this way.
[110] Fix | Delete
[111] Fix | Delete
If we can't create a controller in this way, or if there is no
[112] Fix | Delete
executable for the requested browser, return [None, None].
[113] Fix | Delete
[114] Fix | Delete
"""
[115] Fix | Delete
cmd = browser.split()[0]
[116] Fix | Delete
if not shutil.which(cmd):
[117] Fix | Delete
return [None, None]
[118] Fix | Delete
name = os.path.basename(cmd)
[119] Fix | Delete
try:
[120] Fix | Delete
command = _browsers[name.lower()]
[121] Fix | Delete
except KeyError:
[122] Fix | Delete
return [None, None]
[123] Fix | Delete
# now attempt to clone to fit the new name:
[124] Fix | Delete
controller = command[1]
[125] Fix | Delete
if controller and name.lower() == controller.basename:
[126] Fix | Delete
import copy
[127] Fix | Delete
controller = copy.copy(controller)
[128] Fix | Delete
controller.name = browser
[129] Fix | Delete
controller.basename = os.path.basename(browser)
[130] Fix | Delete
register(browser, None, instance=controller, preferred=preferred)
[131] Fix | Delete
return [None, controller]
[132] Fix | Delete
return [None, None]
[133] Fix | Delete
[134] Fix | Delete
[135] Fix | Delete
# General parent classes
[136] Fix | Delete
[137] Fix | Delete
class BaseBrowser(object):
[138] Fix | Delete
"""Parent class for all browsers. Do not use directly."""
[139] Fix | Delete
[140] Fix | Delete
args = ['%s']
[141] Fix | Delete
[142] Fix | Delete
def __init__(self, name=""):
[143] Fix | Delete
self.name = name
[144] Fix | Delete
self.basename = name
[145] Fix | Delete
[146] Fix | Delete
def open(self, url, new=0, autoraise=True):
[147] Fix | Delete
raise NotImplementedError
[148] Fix | Delete
[149] Fix | Delete
def open_new(self, url):
[150] Fix | Delete
return self.open(url, 1)
[151] Fix | Delete
[152] Fix | Delete
def open_new_tab(self, url):
[153] Fix | Delete
return self.open(url, 2)
[154] Fix | Delete
[155] Fix | Delete
[156] Fix | Delete
class GenericBrowser(BaseBrowser):
[157] Fix | Delete
"""Class for all browsers started with a command
[158] Fix | Delete
and without remote functionality."""
[159] Fix | Delete
[160] Fix | Delete
def __init__(self, name):
[161] Fix | Delete
if isinstance(name, str):
[162] Fix | Delete
self.name = name
[163] Fix | Delete
self.args = ["%s"]
[164] Fix | Delete
else:
[165] Fix | Delete
# name should be a list with arguments
[166] Fix | Delete
self.name = name[0]
[167] Fix | Delete
self.args = name[1:]
[168] Fix | Delete
self.basename = os.path.basename(self.name)
[169] Fix | Delete
[170] Fix | Delete
def open(self, url, new=0, autoraise=True):
[171] Fix | Delete
sys.audit("webbrowser.open", url)
[172] Fix | Delete
cmdline = [self.name] + [arg.replace("%s", url)
[173] Fix | Delete
for arg in self.args]
[174] Fix | Delete
try:
[175] Fix | Delete
if sys.platform[:3] == 'win':
[176] Fix | Delete
p = subprocess.Popen(cmdline)
[177] Fix | Delete
else:
[178] Fix | Delete
p = subprocess.Popen(cmdline, close_fds=True)
[179] Fix | Delete
return not p.wait()
[180] Fix | Delete
except OSError:
[181] Fix | Delete
return False
[182] Fix | Delete
[183] Fix | Delete
[184] Fix | Delete
class BackgroundBrowser(GenericBrowser):
[185] Fix | Delete
"""Class for all browsers which are to be started in the
[186] Fix | Delete
background."""
[187] Fix | Delete
[188] Fix | Delete
def open(self, url, new=0, autoraise=True):
[189] Fix | Delete
cmdline = [self.name] + [arg.replace("%s", url)
[190] Fix | Delete
for arg in self.args]
[191] Fix | Delete
sys.audit("webbrowser.open", url)
[192] Fix | Delete
try:
[193] Fix | Delete
if sys.platform[:3] == 'win':
[194] Fix | Delete
p = subprocess.Popen(cmdline)
[195] Fix | Delete
else:
[196] Fix | Delete
p = subprocess.Popen(cmdline, close_fds=True,
[197] Fix | Delete
start_new_session=True)
[198] Fix | Delete
return (p.poll() is None)
[199] Fix | Delete
except OSError:
[200] Fix | Delete
return False
[201] Fix | Delete
[202] Fix | Delete
[203] Fix | Delete
class UnixBrowser(BaseBrowser):
[204] Fix | Delete
"""Parent class for all Unix browsers with remote functionality."""
[205] Fix | Delete
[206] Fix | Delete
raise_opts = None
[207] Fix | Delete
background = False
[208] Fix | Delete
redirect_stdout = True
[209] Fix | Delete
# In remote_args, %s will be replaced with the requested URL. %action will
[210] Fix | Delete
# be replaced depending on the value of 'new' passed to open.
[211] Fix | Delete
# remote_action is used for new=0 (open). If newwin is not None, it is
[212] Fix | Delete
# used for new=1 (open_new). If newtab is not None, it is used for
[213] Fix | Delete
# new=3 (open_new_tab). After both substitutions are made, any empty
[214] Fix | Delete
# strings in the transformed remote_args list will be removed.
[215] Fix | Delete
remote_args = ['%action', '%s']
[216] Fix | Delete
remote_action = None
[217] Fix | Delete
remote_action_newwin = None
[218] Fix | Delete
remote_action_newtab = None
[219] Fix | Delete
[220] Fix | Delete
def _invoke(self, args, remote, autoraise, url=None):
[221] Fix | Delete
raise_opt = []
[222] Fix | Delete
if remote and self.raise_opts:
[223] Fix | Delete
# use autoraise argument only for remote invocation
[224] Fix | Delete
autoraise = int(autoraise)
[225] Fix | Delete
opt = self.raise_opts[autoraise]
[226] Fix | Delete
if opt: raise_opt = [opt]
[227] Fix | Delete
[228] Fix | Delete
cmdline = [self.name] + raise_opt + args
[229] Fix | Delete
[230] Fix | Delete
if remote or self.background:
[231] Fix | Delete
inout = subprocess.DEVNULL
[232] Fix | Delete
else:
[233] Fix | Delete
# for TTY browsers, we need stdin/out
[234] Fix | Delete
inout = None
[235] Fix | Delete
p = subprocess.Popen(cmdline, close_fds=True, stdin=inout,
[236] Fix | Delete
stdout=(self.redirect_stdout and inout or None),
[237] Fix | Delete
stderr=inout, start_new_session=True)
[238] Fix | Delete
if remote:
[239] Fix | Delete
# wait at most five seconds. If the subprocess is not finished, the
[240] Fix | Delete
# remote invocation has (hopefully) started a new instance.
[241] Fix | Delete
try:
[242] Fix | Delete
rc = p.wait(5)
[243] Fix | Delete
# if remote call failed, open() will try direct invocation
[244] Fix | Delete
return not rc
[245] Fix | Delete
except subprocess.TimeoutExpired:
[246] Fix | Delete
return True
[247] Fix | Delete
elif self.background:
[248] Fix | Delete
if p.poll() is None:
[249] Fix | Delete
return True
[250] Fix | Delete
else:
[251] Fix | Delete
return False
[252] Fix | Delete
else:
[253] Fix | Delete
return not p.wait()
[254] Fix | Delete
[255] Fix | Delete
def open(self, url, new=0, autoraise=True):
[256] Fix | Delete
sys.audit("webbrowser.open", url)
[257] Fix | Delete
if new == 0:
[258] Fix | Delete
action = self.remote_action
[259] Fix | Delete
elif new == 1:
[260] Fix | Delete
action = self.remote_action_newwin
[261] Fix | Delete
elif new == 2:
[262] Fix | Delete
if self.remote_action_newtab is None:
[263] Fix | Delete
action = self.remote_action_newwin
[264] Fix | Delete
else:
[265] Fix | Delete
action = self.remote_action_newtab
[266] Fix | Delete
else:
[267] Fix | Delete
raise Error("Bad 'new' parameter to open(); " +
[268] Fix | Delete
"expected 0, 1, or 2, got %s" % new)
[269] Fix | Delete
[270] Fix | Delete
args = [arg.replace("%s", url).replace("%action", action)
[271] Fix | Delete
for arg in self.remote_args]
[272] Fix | Delete
args = [arg for arg in args if arg]
[273] Fix | Delete
success = self._invoke(args, True, autoraise, url)
[274] Fix | Delete
if not success:
[275] Fix | Delete
# remote invocation failed, try straight way
[276] Fix | Delete
args = [arg.replace("%s", url) for arg in self.args]
[277] Fix | Delete
return self._invoke(args, False, False)
[278] Fix | Delete
else:
[279] Fix | Delete
return True
[280] Fix | Delete
[281] Fix | Delete
[282] Fix | Delete
class Mozilla(UnixBrowser):
[283] Fix | Delete
"""Launcher class for Mozilla browsers."""
[284] Fix | Delete
[285] Fix | Delete
remote_args = ['%action', '%s']
[286] Fix | Delete
remote_action = ""
[287] Fix | Delete
remote_action_newwin = "-new-window"
[288] Fix | Delete
remote_action_newtab = "-new-tab"
[289] Fix | Delete
background = True
[290] Fix | Delete
[291] Fix | Delete
[292] Fix | Delete
class Netscape(UnixBrowser):
[293] Fix | Delete
"""Launcher class for Netscape browser."""
[294] Fix | Delete
[295] Fix | Delete
raise_opts = ["-noraise", "-raise"]
[296] Fix | Delete
remote_args = ['-remote', 'openURL(%s%action)']
[297] Fix | Delete
remote_action = ""
[298] Fix | Delete
remote_action_newwin = ",new-window"
[299] Fix | Delete
remote_action_newtab = ",new-tab"
[300] Fix | Delete
background = True
[301] Fix | Delete
[302] Fix | Delete
[303] Fix | Delete
class Galeon(UnixBrowser):
[304] Fix | Delete
"""Launcher class for Galeon/Epiphany browsers."""
[305] Fix | Delete
[306] Fix | Delete
raise_opts = ["-noraise", ""]
[307] Fix | Delete
remote_args = ['%action', '%s']
[308] Fix | Delete
remote_action = "-n"
[309] Fix | Delete
remote_action_newwin = "-w"
[310] Fix | Delete
background = True
[311] Fix | Delete
[312] Fix | Delete
[313] Fix | Delete
class Chrome(UnixBrowser):
[314] Fix | Delete
"Launcher class for Google Chrome browser."
[315] Fix | Delete
[316] Fix | Delete
remote_args = ['%action', '%s']
[317] Fix | Delete
remote_action = ""
[318] Fix | Delete
remote_action_newwin = "--new-window"
[319] Fix | Delete
remote_action_newtab = ""
[320] Fix | Delete
background = True
[321] Fix | Delete
[322] Fix | Delete
Chromium = Chrome
[323] Fix | Delete
[324] Fix | Delete
[325] Fix | Delete
class Opera(UnixBrowser):
[326] Fix | Delete
"Launcher class for Opera browser."
[327] Fix | Delete
[328] Fix | Delete
remote_args = ['%action', '%s']
[329] Fix | Delete
remote_action = ""
[330] Fix | Delete
remote_action_newwin = "--new-window"
[331] Fix | Delete
remote_action_newtab = ""
[332] Fix | Delete
background = True
[333] Fix | Delete
[334] Fix | Delete
[335] Fix | Delete
class Elinks(UnixBrowser):
[336] Fix | Delete
"Launcher class for Elinks browsers."
[337] Fix | Delete
[338] Fix | Delete
remote_args = ['-remote', 'openURL(%s%action)']
[339] Fix | Delete
remote_action = ""
[340] Fix | Delete
remote_action_newwin = ",new-window"
[341] Fix | Delete
remote_action_newtab = ",new-tab"
[342] Fix | Delete
background = False
[343] Fix | Delete
[344] Fix | Delete
# elinks doesn't like its stdout to be redirected -
[345] Fix | Delete
# it uses redirected stdout as a signal to do -dump
[346] Fix | Delete
redirect_stdout = False
[347] Fix | Delete
[348] Fix | Delete
[349] Fix | Delete
class Konqueror(BaseBrowser):
[350] Fix | Delete
"""Controller for the KDE File Manager (kfm, or Konqueror).
[351] Fix | Delete
[352] Fix | Delete
See the output of ``kfmclient --commands``
[353] Fix | Delete
for more information on the Konqueror remote-control interface.
[354] Fix | Delete
"""
[355] Fix | Delete
[356] Fix | Delete
def open(self, url, new=0, autoraise=True):
[357] Fix | Delete
sys.audit("webbrowser.open", url)
[358] Fix | Delete
# XXX Currently I know no way to prevent KFM from opening a new win.
[359] Fix | Delete
if new == 2:
[360] Fix | Delete
action = "newTab"
[361] Fix | Delete
else:
[362] Fix | Delete
action = "openURL"
[363] Fix | Delete
[364] Fix | Delete
devnull = subprocess.DEVNULL
[365] Fix | Delete
[366] Fix | Delete
try:
[367] Fix | Delete
p = subprocess.Popen(["kfmclient", action, url],
[368] Fix | Delete
close_fds=True, stdin=devnull,
[369] Fix | Delete
stdout=devnull, stderr=devnull)
[370] Fix | Delete
except OSError:
[371] Fix | Delete
# fall through to next variant
[372] Fix | Delete
pass
[373] Fix | Delete
else:
[374] Fix | Delete
p.wait()
[375] Fix | Delete
# kfmclient's return code unfortunately has no meaning as it seems
[376] Fix | Delete
return True
[377] Fix | Delete
[378] Fix | Delete
try:
[379] Fix | Delete
p = subprocess.Popen(["konqueror", "--silent", url],
[380] Fix | Delete
close_fds=True, stdin=devnull,
[381] Fix | Delete
stdout=devnull, stderr=devnull,
[382] Fix | Delete
start_new_session=True)
[383] Fix | Delete
except OSError:
[384] Fix | Delete
# fall through to next variant
[385] Fix | Delete
pass
[386] Fix | Delete
else:
[387] Fix | Delete
if p.poll() is None:
[388] Fix | Delete
# Should be running now.
[389] Fix | Delete
return True
[390] Fix | Delete
[391] Fix | Delete
try:
[392] Fix | Delete
p = subprocess.Popen(["kfm", "-d", url],
[393] Fix | Delete
close_fds=True, stdin=devnull,
[394] Fix | Delete
stdout=devnull, stderr=devnull,
[395] Fix | Delete
start_new_session=True)
[396] Fix | Delete
except OSError:
[397] Fix | Delete
return False
[398] Fix | Delete
else:
[399] Fix | Delete
return (p.poll() is None)
[400] Fix | Delete
[401] Fix | Delete
[402] Fix | Delete
class Grail(BaseBrowser):
[403] Fix | Delete
# There should be a way to maintain a connection to Grail, but the
[404] Fix | Delete
# Grail remote control protocol doesn't really allow that at this
[405] Fix | Delete
# point. It probably never will!
[406] Fix | Delete
def _find_grail_rc(self):
[407] Fix | Delete
import glob
[408] Fix | Delete
import pwd
[409] Fix | Delete
import socket
[410] Fix | Delete
import tempfile
[411] Fix | Delete
tempdir = os.path.join(tempfile.gettempdir(),
[412] Fix | Delete
".grail-unix")
[413] Fix | Delete
user = pwd.getpwuid(os.getuid())[0]
[414] Fix | Delete
filename = os.path.join(glob.escape(tempdir), glob.escape(user) + "-*")
[415] Fix | Delete
maybes = glob.glob(filename)
[416] Fix | Delete
if not maybes:
[417] Fix | Delete
return None
[418] Fix | Delete
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
[419] Fix | Delete
for fn in maybes:
[420] Fix | Delete
# need to PING each one until we find one that's live
[421] Fix | Delete
try:
[422] Fix | Delete
s.connect(fn)
[423] Fix | Delete
except OSError:
[424] Fix | Delete
# no good; attempt to clean it out, but don't fail:
[425] Fix | Delete
try:
[426] Fix | Delete
os.unlink(fn)
[427] Fix | Delete
except OSError:
[428] Fix | Delete
pass
[429] Fix | Delete
else:
[430] Fix | Delete
return s
[431] Fix | Delete
[432] Fix | Delete
def _remote(self, action):
[433] Fix | Delete
s = self._find_grail_rc()
[434] Fix | Delete
if not s:
[435] Fix | Delete
return 0
[436] Fix | Delete
s.send(action)
[437] Fix | Delete
s.close()
[438] Fix | Delete
return 1
[439] Fix | Delete
[440] Fix | Delete
def open(self, url, new=0, autoraise=True):
[441] Fix | Delete
sys.audit("webbrowser.open", url)
[442] Fix | Delete
if new:
[443] Fix | Delete
ok = self._remote("LOADNEW " + url)
[444] Fix | Delete
else:
[445] Fix | Delete
ok = self._remote("LOAD " + url)
[446] Fix | Delete
return ok
[447] Fix | Delete
[448] Fix | Delete
[449] Fix | Delete
#
[450] Fix | Delete
# Platform support for Unix
[451] Fix | Delete
#
[452] Fix | Delete
[453] Fix | Delete
# These are the right tests because all these Unix browsers require either
[454] Fix | Delete
# a console terminal or an X display to run.
[455] Fix | Delete
[456] Fix | Delete
def register_X_browsers():
[457] Fix | Delete
[458] Fix | Delete
# use xdg-open if around
[459] Fix | Delete
if shutil.which("xdg-open"):
[460] Fix | Delete
register("xdg-open", None, BackgroundBrowser("xdg-open"))
[461] Fix | Delete
[462] Fix | Delete
# The default GNOME3 browser
[463] Fix | Delete
if "GNOME_DESKTOP_SESSION_ID" in os.environ and shutil.which("gvfs-open"):
[464] Fix | Delete
register("gvfs-open", None, BackgroundBrowser("gvfs-open"))
[465] Fix | Delete
[466] Fix | Delete
# The default GNOME browser
[467] Fix | Delete
if "GNOME_DESKTOP_SESSION_ID" in os.environ and shutil.which("gnome-open"):
[468] Fix | Delete
register("gnome-open", None, BackgroundBrowser("gnome-open"))
[469] Fix | Delete
[470] Fix | Delete
# The default KDE browser
[471] Fix | Delete
if "KDE_FULL_SESSION" in os.environ and shutil.which("kfmclient"):
[472] Fix | Delete
register("kfmclient", Konqueror, Konqueror("kfmclient"))
[473] Fix | Delete
[474] Fix | Delete
if shutil.which("x-www-browser"):
[475] Fix | Delete
register("x-www-browser", None, BackgroundBrowser("x-www-browser"))
[476] Fix | Delete
[477] Fix | Delete
# The Mozilla browsers
[478] Fix | Delete
for browser in ("firefox", "iceweasel", "iceape", "seamonkey"):
[479] Fix | Delete
if shutil.which(browser):
[480] Fix | Delete
register(browser, None, Mozilla(browser))
[481] Fix | Delete
[482] Fix | Delete
# The Netscape and old Mozilla browsers
[483] Fix | Delete
for browser in ("mozilla-firefox",
[484] Fix | Delete
"mozilla-firebird", "firebird",
[485] Fix | Delete
"mozilla", "netscape"):
[486] Fix | Delete
if shutil.which(browser):
[487] Fix | Delete
register(browser, None, Netscape(browser))
[488] Fix | Delete
[489] Fix | Delete
# Konqueror/kfm, the KDE browser.
[490] Fix | Delete
if shutil.which("kfm"):
[491] Fix | Delete
register("kfm", Konqueror, Konqueror("kfm"))
[492] Fix | Delete
elif shutil.which("konqueror"):
[493] Fix | Delete
register("konqueror", Konqueror, Konqueror("konqueror"))
[494] Fix | Delete
[495] Fix | Delete
# Gnome's Galeon and Epiphany
[496] Fix | Delete
for browser in ("galeon", "epiphany"):
[497] Fix | Delete
if shutil.which(browser):
[498] Fix | Delete
register(browser, None, Galeon(browser))
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function