mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-21 23:24:17 +00:00
Better detecting of the default Windows browser, with fallback to Internet Explorer. (#2502)
This commit is contained in:
2
NEWS.txt
2
NEWS.txt
@@ -5,6 +5,8 @@ Version 0.9.0alpha5 - 2007-03-XX
|
||||
* Fixed fileId generator (caused problems with drag&drop
|
||||
if files with multiple formats are used).
|
||||
* Original Metadata not greyed out when no tracks are attached. (#2461)
|
||||
* Better detecting of the default Windows browser, with fallback to
|
||||
Internet Explorer. (#2502)
|
||||
|
||||
Version 0.9.0alpha4 - 2007-03-09
|
||||
* Bug Fixes:
|
||||
|
||||
@@ -27,6 +27,7 @@ enough, in my opinion. See also:
|
||||
http://sourceforge.net/tracker/index.php?func=detail&aid=1681228&group_id=5470&atid=105470
|
||||
"""
|
||||
|
||||
|
||||
# KDE default browser
|
||||
if 'KDE_FULL_SESSION' in os.environ and os.environ['KDE_FULL_SESSION'] == 'true' and webbrowser._iscommand('kfmclient'):
|
||||
webbrowser.register('kfmclient', None, webbrowser.GenericBrowser("kfmclient exec '%s' &"))
|
||||
@@ -35,6 +36,7 @@ if 'KDE_FULL_SESSION' in os.environ and os.environ['KDE_FULL_SESSION'] == 'true'
|
||||
else:
|
||||
webbrowser._tryorder.insert(0, 'kfmclient')
|
||||
|
||||
|
||||
# GNOME default browser
|
||||
if 'GNOME_DESKTOP_SESSION_ID' in os.environ and webbrowser._iscommand('gnome-open'):
|
||||
webbrowser.register('gnome-open', None, webbrowser.GenericBrowser("gnome-open '%s' &"))
|
||||
@@ -43,8 +45,27 @@ if 'GNOME_DESKTOP_SESSION_ID' in os.environ and webbrowser._iscommand('gnome-ope
|
||||
else:
|
||||
webbrowser._tryorder.insert(0, 'gnome-open')
|
||||
|
||||
|
||||
if 'windows-default' in webbrowser._tryorder:
|
||||
class WindowsDefault2(webbrowser.BaseBrowser):
|
||||
def open(self, url, new=0, autoraise=1):
|
||||
try:
|
||||
os.startfile(url)
|
||||
except WindowsError:
|
||||
# [Error 22] No application is associated with the specified
|
||||
# file for this operation: '<URL>'
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
webbrowser._tryorder.remove('windows-default')
|
||||
webbrowser._tryorder.insert(0, 'windows-default')
|
||||
webbrowser.register('windows-default-2', WindowsDefault2,
|
||||
update_tryorder=-1)
|
||||
|
||||
iexplore = webbrowser.BackgroundBrowser(
|
||||
os.path.join(os.environ.get('PROGRAMFILES', 'C:\\Program Files'),
|
||||
'Internet Explorer\\IEXPLORE.EXE'))
|
||||
webbrowser.register('iexplore', None, iexplore)
|
||||
|
||||
|
||||
open = webbrowser.open
|
||||
|
||||
Reference in New Issue
Block a user