Revert change in previous release to workaround broken xdg-open on linux. Apparently xdg-open is so badly broken that working around it is not possible. Fixes #1500226 [Calibre 2.39 (Xubuntu) - # character use in the title](https://bugs.launchpad.net/calibre/+bug/1500226)

I love xdg-utils
This commit is contained in:
Kovid Goyal 2015-09-27 22:02:49 +05:30
parent 5d9ab082b7
commit f84223da03

View File

@ -3,7 +3,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
""" The GUI """ """ The GUI """
import os, sys, Queue, threading, glob import os, sys, Queue, threading, glob
from contextlib import contextmanager from contextlib import contextmanager
from threading import RLock, Lock, Thread from threading import RLock, Lock
from urllib import unquote from urllib import unquote
from PyQt5.QtWidgets import QStyle # Gives a nicer error message than import from Qt from PyQt5.QtWidgets import QStyle # Gives a nicer error message than import from Qt
from PyQt5.Qt import ( from PyQt5.Qt import (
@ -1140,15 +1140,6 @@ def open_local_file(path):
if iswindows: if iswindows:
with sanitize_env_vars(): with sanitize_env_vars():
os.startfile(os.path.normpath(path)) os.startfile(os.path.normpath(path))
elif islinux or isbsd:
import subprocess
if isinstance(path, unicode):
path = path.encode(filesystem_encoding)
with sanitize_env_vars():
p = subprocess.Popen(['xdg-open', path])
t = Thread(name='WaitXDGOpen', target=p.wait)
t.daemon = True
t.start()
else: else:
url = QUrl.fromLocalFile(path) url = QUrl.fromLocalFile(path)
open_url(url) open_url(url)