Use the pipe worker instead of the debug executable for the splash screen

This commit is contained in:
Kovid Goyal 2015-02-02 06:12:06 +05:30
parent f4d638bf4c
commit 8a575ef753

View File

@ -13,7 +13,7 @@ from functools import partial
from PyQt5.Qt import QApplication, QSplashScreen, pyqtSignal, QBrush, QColor, Qt, QPixmap from PyQt5.Qt import QApplication, QSplashScreen, pyqtSignal, QBrush, QColor, Qt, QPixmap
from calibre.constants import iswindows, isosx from calibre.constants import isosx, DEBUG
from calibre.utils.ipc import eintr_retry_call from calibre.utils.ipc import eintr_retry_call
class SplashScreen(Thread): class SplashScreen(Thread):
@ -36,13 +36,12 @@ class SplashScreen(Thread):
self.hide = partial(self._rpc, 'hide') self.hide = partial(self._rpc, 'hide')
def launch_process(self, debug_executable): def launch_process(self, debug_executable):
kwargs = {'stdin':subprocess.PIPE} from calibre.utils.ipc.simple_worker import start_pipe_worker
if iswindows: if DEBUG:
import win32process args = {'stdout':None, 'stderr': None}
kwargs['creationflags'] = win32process.CREATE_NO_WINDOW else:
kwargs['stdout'] = open(os.devnull, 'wb') args = {'stdout':open(os.devnull, 'wb'), 'stderr':subprocess.STDOUT}
kwargs['stderr'] = subprocess.STDOUT self.process = start_pipe_worker('from calibre.gui2.splash import main; main()', **args)
self.process = subprocess.Popen([debug_executable, '-c', 'from calibre.gui2.splash import main; main()'], **kwargs)
def _rpc(self, name, *args): def _rpc(self, name, *args):
self.queue.put(('_' + name, args)) self.queue.put(('_' + name, args))