mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Do not popup an error dialog for invalid message
Do not popup an error dialog when an invalid message is received from another instance, unless we are in DEBUG mode. See #1207947
This commit is contained in:
parent
2e3a0e57bf
commit
8da42d6a70
@ -19,7 +19,7 @@ from PyQt4.Qt import (Qt, SIGNAL, QTimer, QHelpEvent, QAction,
|
|||||||
QDialog, QSystemTrayIcon, QApplication)
|
QDialog, QSystemTrayIcon, QApplication)
|
||||||
|
|
||||||
from calibre import prints, force_unicode
|
from calibre import prints, force_unicode
|
||||||
from calibre.constants import __appname__, isosx, filesystem_encoding
|
from calibre.constants import __appname__, isosx, filesystem_encoding, DEBUG
|
||||||
from calibre.utils.config import prefs, dynamic
|
from calibre.utils.config import prefs, dynamic
|
||||||
from calibre.utils.ipc.server import Server
|
from calibre.utils.ipc.server import Server
|
||||||
from calibre.db import get_db_loader
|
from calibre.db import get_db_loader
|
||||||
@ -521,7 +521,16 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
|
|||||||
return
|
return
|
||||||
if msg.startswith('launched:'):
|
if msg.startswith('launched:'):
|
||||||
import json
|
import json
|
||||||
argv = json.loads(msg[len('launched:'):])
|
try:
|
||||||
|
argv = json.loads(msg[len('launched:'):])
|
||||||
|
except ValueError:
|
||||||
|
prints('Failed to decode message from other instance: %r' % msg)
|
||||||
|
if DEBUG:
|
||||||
|
error_dialog(self, 'Invalid message',
|
||||||
|
'Received an invalid message from other calibre instance.'
|
||||||
|
' Do you have multiple versions of calibre installed?',
|
||||||
|
det_msg='Invalid msg: %r' % msg, show=True)
|
||||||
|
argv = ()
|
||||||
if isinstance(argv, (list, tuple)) and len(argv) > 1:
|
if isinstance(argv, (list, tuple)) and len(argv) > 1:
|
||||||
files = [os.path.abspath(p) for p in argv[1:] if not os.path.isdir(p) and os.access(p, os.R_OK)]
|
files = [os.path.abspath(p) for p in argv[1:] if not os.path.isdir(p) and os.access(p, os.R_OK)]
|
||||||
if files:
|
if files:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user