mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
PyQt 5.11 compatibility changes
http://pyqt.sourceforge.net/Docs/PyQt5/incompatibilities.html#pyqt-v5-11
This commit is contained in:
parent
e88b9556f9
commit
7d0bc9fb32
@ -11,8 +11,11 @@ import sys, copy
|
|||||||
from future_builtins import map
|
from future_builtins import map
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
import sip
|
|
||||||
from PyQt5.Qt import QLinearGradient, QPointF
|
from PyQt5.Qt import QLinearGradient, QPointF
|
||||||
|
try:
|
||||||
|
from PyQt5 import sip
|
||||||
|
except ImportError:
|
||||||
|
import sip
|
||||||
|
|
||||||
from calibre.ebooks.pdf.render.common import Name, Array, Dictionary
|
from calibre.ebooks.pdf.render.common import Name, Array, Dictionary
|
||||||
|
|
||||||
@ -151,4 +154,3 @@ class LinearGradientPattern(Dictionary):
|
|||||||
stops[-1][0] = base_stops[-1][0]
|
stops[-1][0] = base_stops[-1][0]
|
||||||
|
|
||||||
return start, stop, tuple(Stop(s[0], s[1]) for s in stops)
|
return start, stop, tuple(Stop(s[0], s[1]) for s in stops)
|
||||||
|
|
||||||
|
@ -6,6 +6,10 @@ __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
|||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
from PyQt5.Qt import Qt
|
from PyQt5.Qt import Qt
|
||||||
|
try:
|
||||||
|
from PyQt5 import sip
|
||||||
|
except ImportError:
|
||||||
|
import sip
|
||||||
|
|
||||||
from calibre.gui2.actions import InterfaceAction
|
from calibre.gui2.actions import InterfaceAction
|
||||||
from calibre.gui2.dialogs.book_info import BookInfo
|
from calibre.gui2.dialogs.book_info import BookInfo
|
||||||
@ -45,6 +49,5 @@ class ShowBookDetailsAction(InterfaceAction):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
import sip
|
|
||||||
sip.delete(d)
|
sip.delete(d)
|
||||||
del d
|
del d
|
||||||
|
@ -8,10 +8,13 @@ __copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
|||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import sip
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
Qt, QAction, QMenu, QObject, QToolBar, QToolButton, QSize, pyqtSignal,
|
Qt, QAction, QMenu, QObject, QToolBar, QToolButton, QSize, pyqtSignal,
|
||||||
QTimer, QPropertyAnimation, QEasingCurve, pyqtProperty, QPainter, QWidget)
|
QTimer, QPropertyAnimation, QEasingCurve, pyqtProperty, QPainter, QWidget)
|
||||||
|
try:
|
||||||
|
from PyQt5 import sip
|
||||||
|
except ImportError:
|
||||||
|
import sip
|
||||||
|
|
||||||
from calibre.constants import isosx
|
from calibre.constants import isosx
|
||||||
from calibre.gui2 import gprefs, native_menubar_defaults, config
|
from calibre.gui2 import gprefs, native_menubar_defaults, config
|
||||||
|
@ -21,6 +21,10 @@ from PyQt5.Qt import (Qt, QAbstractItemView, QCheckBox, QComboBox,
|
|||||||
QDoubleSpinBox, QIcon, QInputDialog, QLineEdit, QRadioButton,
|
QDoubleSpinBox, QIcon, QInputDialog, QLineEdit, QRadioButton,
|
||||||
QSize, QSizePolicy, QTableWidget, QTableWidgetItem, QTextEdit, QToolButton,
|
QSize, QSizePolicy, QTableWidget, QTableWidgetItem, QTextEdit, QToolButton,
|
||||||
QUrl, QVBoxLayout, QWidget)
|
QUrl, QVBoxLayout, QWidget)
|
||||||
|
try:
|
||||||
|
from PyQt5 import sip
|
||||||
|
except ImportError:
|
||||||
|
import sip
|
||||||
|
|
||||||
|
|
||||||
class PluginWidget(QWidget,Ui_Form):
|
class PluginWidget(QWidget,Ui_Form):
|
||||||
@ -78,7 +82,7 @@ class PluginWidget(QWidget,Ui_Form):
|
|||||||
['radio_button' for i in RadioButtonControls])
|
['radio_button' for i in RadioButtonControls])
|
||||||
|
|
||||||
# LineEditControls
|
# LineEditControls
|
||||||
option_fields += zip(['exclude_genre'],['\[.+\]|^\+$'],['line_edit'])
|
option_fields += zip(['exclude_genre'],[r'\[.+\]|^\+$'],['line_edit'])
|
||||||
|
|
||||||
# TextEditControls
|
# TextEditControls
|
||||||
# option_fields += zip(['exclude_genre_results'],['excluded genres will appear here'],['text_edit'])
|
# option_fields += zip(['exclude_genre_results'],['excluded genres will appear here'],['text_edit'])
|
||||||
@ -966,7 +970,6 @@ class GenericRulesTable(QTableWidget):
|
|||||||
for i in reversed(range(child.count())):
|
for i in reversed(range(child.count())):
|
||||||
if child.itemAt(i).widget() is not None:
|
if child.itemAt(i).widget() is not None:
|
||||||
child.itemAt(i).widget().setParent(None)
|
child.itemAt(i).widget().setParent(None)
|
||||||
import sip
|
|
||||||
sip.delete(child)
|
sip.delete(child)
|
||||||
|
|
||||||
for i in reversed(range(old_layout.count())):
|
for i in reversed(range(old_layout.count())):
|
||||||
|
@ -8,7 +8,6 @@ __docformat__ = 'restructuredtext en'
|
|||||||
import re, os, json, weakref
|
import re, os, json, weakref
|
||||||
|
|
||||||
from lxml import html
|
from lxml import html
|
||||||
import sip
|
|
||||||
|
|
||||||
from PyQt5.Qt import (QApplication, QFontInfo, QSize, QWidget, QPlainTextEdit,
|
from PyQt5.Qt import (QApplication, QFontInfo, QSize, QWidget, QPlainTextEdit,
|
||||||
QToolBar, QVBoxLayout, QAction, QIcon, Qt, QTabWidget, QUrl, QFormLayout,
|
QToolBar, QVBoxLayout, QAction, QIcon, Qt, QTabWidget, QUrl, QFormLayout,
|
||||||
@ -16,6 +15,10 @@ from PyQt5.Qt import (QApplication, QFontInfo, QSize, QWidget, QPlainTextEdit,
|
|||||||
QHBoxLayout, QKeySequence, QLineEdit, QDialogButtonBox, QPushButton,
|
QHBoxLayout, QKeySequence, QLineEdit, QDialogButtonBox, QPushButton,
|
||||||
QCheckBox)
|
QCheckBox)
|
||||||
from PyQt5.QtWebKitWidgets import QWebView, QWebPage
|
from PyQt5.QtWebKitWidgets import QWebView, QWebPage
|
||||||
|
try:
|
||||||
|
from PyQt5 import sip
|
||||||
|
except ImportError:
|
||||||
|
import sip
|
||||||
|
|
||||||
from calibre.ebooks.chardet import xml_to_unicode
|
from calibre.ebooks.chardet import xml_to_unicode
|
||||||
from calibre import xml_replace_entities, prepare_string_for_xml
|
from calibre import xml_replace_entities, prepare_string_for_xml
|
||||||
|
@ -9,11 +9,14 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
import sip
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QLineEdit, QAbstractListModel, Qt, pyqtSignal, QObject, QKeySequence,
|
QLineEdit, QAbstractListModel, Qt, pyqtSignal, QObject, QKeySequence,
|
||||||
QApplication, QListView, QPoint, QModelIndex, QFont, QFontInfo,
|
QApplication, QListView, QPoint, QModelIndex, QFont, QFontInfo,
|
||||||
QStyleOptionComboBox, QStyle, QComboBox, QTimer)
|
QStyleOptionComboBox, QStyle, QComboBox, QTimer)
|
||||||
|
try:
|
||||||
|
from PyQt5 import sip
|
||||||
|
except ImportError:
|
||||||
|
import sip
|
||||||
|
|
||||||
from calibre.constants import isosx, get_osx_version
|
from calibre.constants import isosx, get_osx_version
|
||||||
from calibre.utils.icu import sort_key, primary_startswith, primary_contains
|
from calibre.utils.icu import sort_key, primary_startswith, primary_contains
|
||||||
@ -155,8 +158,7 @@ class Completer(QListView): # {{{
|
|||||||
if widget is None:
|
if widget is None:
|
||||||
return
|
return
|
||||||
screen = QApplication.desktop().availableGeometry(widget)
|
screen = QApplication.desktop().availableGeometry(widget)
|
||||||
h = (p.sizeHintForRow(0) * min(self.max_visible_items, m.rowCount()) +
|
h = (p.sizeHintForRow(0) * min(self.max_visible_items, m.rowCount()) + 3) + 3
|
||||||
3) + 3
|
|
||||||
hsb = p.horizontalScrollBar()
|
hsb = p.horizontalScrollBar()
|
||||||
if hsb and hsb.isVisible():
|
if hsb and hsb.isVisible():
|
||||||
h += hsb.sizeHint().height()
|
h += hsb.sizeHint().height()
|
||||||
|
@ -10,11 +10,14 @@ __docformat__ = 'restructuredtext en'
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import sip
|
|
||||||
from PyQt5.Qt import (QObject, QKeySequence, QAbstractItemModel, QModelIndex,
|
from PyQt5.Qt import (QObject, QKeySequence, QAbstractItemModel, QModelIndex,
|
||||||
Qt, QStyledItemDelegate, QTextDocument, QStyle, pyqtSignal, QFrame,
|
Qt, QStyledItemDelegate, QTextDocument, QStyle, pyqtSignal, QFrame,
|
||||||
QApplication, QSize, QRectF, QWidget, QTreeView,
|
QApplication, QSize, QRectF, QWidget, QTreeView,
|
||||||
QGridLayout, QLabel, QRadioButton, QPushButton, QToolButton, QIcon)
|
QGridLayout, QLabel, QRadioButton, QPushButton, QToolButton, QIcon)
|
||||||
|
try:
|
||||||
|
from PyQt5 import sip
|
||||||
|
except ImportError:
|
||||||
|
import sip
|
||||||
|
|
||||||
from calibre.utils.config import JSONConfig
|
from calibre.utils.config import JSONConfig
|
||||||
from calibre.constants import DEBUG
|
from calibre.constants import DEBUG
|
||||||
@ -487,8 +490,8 @@ class Editor(QFrame): # {{{
|
|||||||
dup_desc = self.dup_check(sequence)
|
dup_desc = self.dup_check(sequence)
|
||||||
if dup_desc is not None:
|
if dup_desc is not None:
|
||||||
error_dialog(self, _('Already assigned'),
|
error_dialog(self, _('Already assigned'),
|
||||||
unicode(sequence.toString(QKeySequence.NativeText)) + ' ' +
|
unicode(sequence.toString(QKeySequence.NativeText)) + ' ' + _(
|
||||||
_('already assigned to') + ' ' + dup_desc, show=True)
|
'already assigned to') + ' ' + dup_desc, show=True)
|
||||||
self.clear_clicked(which=which)
|
self.clear_clicked(which=which)
|
||||||
|
|
||||||
def dup_check(self, sequence):
|
def dup_check(self, sequence):
|
||||||
|
@ -11,11 +11,14 @@ import sys, shutil, os
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
import sip
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QDialog, QApplication, QLabel, QVBoxLayout, QDialogButtonBox, Qt,
|
QDialog, QApplication, QLabel, QVBoxLayout, QDialogButtonBox, Qt,
|
||||||
pyqtSignal, QListWidget, QListWidgetItem, QSize, QPixmap, QStyledItemDelegate
|
pyqtSignal, QListWidget, QListWidgetItem, QSize, QPixmap, QStyledItemDelegate
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
|
from PyQt5 import sip
|
||||||
|
except ImportError:
|
||||||
|
import sip
|
||||||
|
|
||||||
from calibre import as_unicode
|
from calibre import as_unicode
|
||||||
from calibre.ebooks.metadata.pdf import page_images
|
from calibre.ebooks.metadata.pdf import page_images
|
||||||
|
@ -8,13 +8,16 @@ import os
|
|||||||
import textwrap
|
import textwrap
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import sip
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QCheckBox, QComboBox, QDialog, QDialogButtonBox, QDoubleSpinBox, QFormLayout,
|
QCheckBox, QComboBox, QDialog, QDialogButtonBox, QDoubleSpinBox, QFormLayout,
|
||||||
QFrame, QHBoxLayout, QIcon, QLabel, QLineEdit, QListWidget, QPlainTextEdit,
|
QFrame, QHBoxLayout, QIcon, QLabel, QLineEdit, QListWidget, QPlainTextEdit,
|
||||||
QPushButton, QScrollArea, QSize, QSizePolicy, QSpinBox, Qt, QTabWidget, QTimer,
|
QPushButton, QScrollArea, QSize, QSizePolicy, QSpinBox, Qt, QTabWidget, QTimer,
|
||||||
QToolButton, QUrl, QVBoxLayout, QWidget, pyqtSignal
|
QToolButton, QUrl, QVBoxLayout, QWidget, pyqtSignal
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
|
from PyQt5 import sip
|
||||||
|
except ImportError:
|
||||||
|
import sip
|
||||||
|
|
||||||
from calibre import as_unicode
|
from calibre import as_unicode
|
||||||
from calibre.gui2 import (
|
from calibre.gui2 import (
|
||||||
|
@ -11,13 +11,16 @@ from binascii import hexlify
|
|||||||
from collections import Counter, OrderedDict, defaultdict
|
from collections import Counter, OrderedDict, defaultdict
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import sip
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QCheckBox, QDialog, QDialogButtonBox, QFont, QFormLayout, QGridLayout, QIcon,
|
QCheckBox, QDialog, QDialogButtonBox, QFont, QFormLayout, QGridLayout, QIcon,
|
||||||
QInputDialog, QLabel, QLineEdit, QListWidget, QListWidgetItem, QMenu, QPainter,
|
QInputDialog, QLabel, QLineEdit, QListWidget, QListWidgetItem, QMenu, QPainter,
|
||||||
QPixmap, QRadioButton, QScrollArea, QSize, QSpinBox, QStyle, QStyledItemDelegate,
|
QPixmap, QRadioButton, QScrollArea, QSize, QSpinBox, QStyle, QStyledItemDelegate,
|
||||||
Qt, QTimer, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget, pyqtSignal
|
Qt, QTimer, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget, pyqtSignal
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
|
from PyQt5 import sip
|
||||||
|
except ImportError:
|
||||||
|
import sip
|
||||||
|
|
||||||
from calibre import human_readable, plugins, sanitize_file_name_unicode
|
from calibre import human_readable, plugins, sanitize_file_name_unicode
|
||||||
from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES
|
from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES
|
||||||
|
@ -9,7 +9,7 @@ from ajax import ajax
|
|||||||
from book_list.book_details import report_load_failure
|
from book_list.book_details import report_load_failure
|
||||||
from book_list.library_data import load_status, url_books_query
|
from book_list.library_data import load_status, url_books_query
|
||||||
from book_list.router import back, report_a_load_failure
|
from book_list.router import back, report_a_load_failure
|
||||||
from book_list.top_bar import create_top_bar
|
from book_list.top_bar import create_top_bar, set_title
|
||||||
from book_list.ui import set_panel_handler
|
from book_list.ui import set_panel_handler
|
||||||
from dom import add_extra_css, build_rule, clear
|
from dom import add_extra_css, build_rule, clear
|
||||||
from utils import conditional_timeout, parse_url_params
|
from utils import conditional_timeout, parse_url_params
|
||||||
@ -29,6 +29,7 @@ conversion_data_load_status = {'loading':True, 'ok':False, 'error_html':None, 'c
|
|||||||
|
|
||||||
def create_convert_book(container):
|
def create_convert_book(container):
|
||||||
conversion_data.container_id = container.getAttribute('id')
|
conversion_data.container_id = container.getAttribute('id')
|
||||||
|
set_title(_('Convert: {}').format(conversion_data.title))
|
||||||
|
|
||||||
|
|
||||||
# Initialization {{{
|
# Initialization {{{
|
||||||
@ -51,8 +52,10 @@ def on_data_loaded(end_type, xhr, ev):
|
|||||||
|
|
||||||
|
|
||||||
def fetch_conversion_data(book_id):
|
def fetch_conversion_data(book_id):
|
||||||
|
nonlocal conversion_data
|
||||||
if conversion_data_load_status.current_fetch:
|
if conversion_data_load_status.current_fetch:
|
||||||
conversion_data_load_status.current_fetch.abort()
|
conversion_data_load_status.current_fetch.abort()
|
||||||
|
conversion_data = None
|
||||||
query = url_books_query()
|
query = url_books_query()
|
||||||
conversion_data_load_status.loading = True
|
conversion_data_load_status.loading = True
|
||||||
conversion_data_load_status.ok = False
|
conversion_data_load_status.ok = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user