Linux: Fix calibre not working when used with some old VNC server implementations

This commit is contained in:
Kovid Goyal 2016-09-27 18:20:22 +05:30
parent eddbcfc921
commit 0009565f8a
2 changed files with 11 additions and 3 deletions

View File

@ -174,8 +174,8 @@ elif isosx:
openssl_inc_dirs = [os.path.join(SSL, 'include')]
openssl_lib_dirs = [os.path.join(SSL, 'lib')]
else:
QT_DLLS += ['Qt5DBus', 'Qt5XcbQpa']
# PYQT_MODULES += ('QtDBus',)
QT_DLLS += ['Qt5DBus', 'Qt5XcbQpa', 'Qt5X11Extras']
PYQT_MODULES += ('QtX11Extras',)
ft_inc_dirs = pkgconfig_include_dirs('freetype2', 'FT_INC_DIR',
'/usr/include/freetype2')
ft_lib_dirs = pkgconfig_lib_dirs('freetype2', 'FT_LIB_DIR', '/usr/lib')

View File

@ -98,7 +98,15 @@ def init_qt(args):
override = 'calibre-gui' if islinux else None
app = Application(args, override_program_name=override)
app.file_event_hook = EventAccumulator()
app.setWindowIcon(QIcon(I('library.png', allow_user_override=False)))
try:
from PyQt5.Qt import QX11Info
is_x11 = QX11Info.isPlatformX11()
except Exception:
is_x11 = False
# Ancient broken VNC servers cannot handle icons of size greater than 256
# http://www.mobileread.com/forums/showthread.php?t=278447
ic = 'lt.png' if is_x11 else 'library.png'
app.setWindowIcon(QIcon(I(ic, allow_user_override=False)))
return app, opts, args