changeset 0ae6238d37ce in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=0ae6238d37ce description: run xdg-open instead of webbrowser when opening files. Fixes #5751
diffstat:
src/common/helpers.py | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-)
diffs (46 lines):
diff -r fd35d10d13c7 -r 0ae6238d37ce src/common/helpers.py --- a/src/common/helpers.py Tue May 24 19:27:45 2011 +0200 +++ b/src/common/helpers.py Tue May 24 22:43:42 2011 +0200 @@ -673,6 +673,9 @@
def launch_browser_mailer(kind, uri): # kind = 'url' or 'mail' + if kind == 'url' and uri.startswith('file://'): + launch_file_manager(uri) + return if kind in ('mail', 'sth_at_sth') and not uri.startswith('mailto:'): uri = 'mailto:' + uri
@@ -698,18 +701,25 @@
def launch_file_manager(path_to_open): - uri = 'file://' + path_to_open - if not gajim.config.get('autodetect_browser_mailer'): - command = gajim.config.get('custom_file_manager') - if command == '': # if no app is configured - return + if not path_to_open.startswith('file://'): + uri = 'file://' + path_to_open + if os.name == 'nt': + try: + os.startfile(path_to_open) # if pywin32 is installed we open + except Exception: + pass + else: + if not gajim.config.get('autodetect_browser_mailer'): + command = gajim.config.get('custom_file_manager') + if command == '': # if no app is configured + return + else: + command = 'xdg-open' command = build_command(command, path_to_open) try: exec_command(command) except Exception: pass - else: - webbrowser.open(uri)
def play_sound(event): if not gajim.config.get('sounds_on'):