mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Replace references to PyQt5 in the source
This commit is contained in:
parent
b1686441bd
commit
f56d0b5ec0
@ -253,7 +253,7 @@ class Mediapart(BasicNewsRecipe):
|
||||
'''
|
||||
Create a generic cover for recipes that don't have a cover
|
||||
'''
|
||||
from PyQt5.Qt import QImage, QPainter, QPen, Qt, QFont, QRect
|
||||
from qt.core import QImage, QPainter, QPen, Qt, QFont, QRect
|
||||
from calibre.gui2 import ensure_app, load_builtin_fonts, pixmap_to_data
|
||||
|
||||
def init_environment():
|
||||
|
@ -530,7 +530,7 @@ build-backend = "sipbuild.api"
|
||||
|
||||
[tool.sip.metadata]
|
||||
name = "{ext.name}"
|
||||
requires-dist = "PyQt5 (>=5.15)"
|
||||
requires-dist = "PyQt6 (>=6.2.1)"
|
||||
|
||||
[tool.sip]
|
||||
project-factory = "pyqtbuild:PyQtProject"
|
||||
|
@ -15,9 +15,9 @@ NMAKE = RC = msvc = MT = win_inc = win_lib = win_cc = win_ld = None
|
||||
|
||||
@lru_cache(maxsize=2)
|
||||
def pyqt_sip_abi_version():
|
||||
import PyQt5
|
||||
if getattr(PyQt5, '__file__', None):
|
||||
bindings_path = os.path.join(os.path.dirname(PyQt5.__file__), 'bindings', 'QtCore', 'QtCore.toml')
|
||||
import PyQt6
|
||||
if getattr(PyQt6, '__file__', None):
|
||||
bindings_path = os.path.join(os.path.dirname(PyQt6.__file__), 'bindings', 'QtCore', 'QtCore.toml')
|
||||
if os.path.exists(bindings_path):
|
||||
with open(bindings_path) as f:
|
||||
raw = f.read()
|
||||
@ -52,7 +52,7 @@ if iswindows:
|
||||
os.environ[key] = env[key]
|
||||
|
||||
QMAKE = 'qmake'
|
||||
for x in ('qmake-qt5', 'qt5-qmake', 'qmake'):
|
||||
for x in ('qmake6', 'qmake-qt6', 'qt6-qmake', 'qmake'):
|
||||
q = shutil.which(x)
|
||||
if q:
|
||||
QMAKE = q
|
||||
|
@ -25,7 +25,7 @@ class Catalog(QDialog, Ui_Dialog):
|
||||
|
||||
def __init__(self, parent, dbspec, ids, db):
|
||||
import re
|
||||
from PyQt5.uic import compileUi
|
||||
from PyQt6.uic import compileUi
|
||||
|
||||
from calibre import prints as info
|
||||
|
||||
|
@ -867,7 +867,7 @@ class PythonHighlighter(QSyntaxHighlighter): # {{{
|
||||
r"|\b[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\b"),
|
||||
"number")
|
||||
a(re.compile(
|
||||
r"\bPyQt5\b|\bQt?[A-Z][a-z]\w+\b"), "pyqt")
|
||||
r"\bPyQt6\b|\bQt?[A-Z][a-z]\w+\b"), "pyqt")
|
||||
a(re.compile(r"\b@\w+\b"), "decorator")
|
||||
stringRe = re.compile(r"""(?:'[^']*?'|"[^"]*?")""")
|
||||
a(stringRe, "string")
|
||||
|
@ -28,7 +28,7 @@ def parse_old_style(src):
|
||||
try:
|
||||
if not isinstance(src, str):
|
||||
src = src.decode('utf-8')
|
||||
src = src.replace('PyQt%d.QtCore' % 4, 'PyQt5.QtCore')
|
||||
src = re.sub(r'PyQt(?:4|5).QtCore', r'PyQt6.QtCore', src)
|
||||
src = re.sub(r'cPickle\.loads\(([\'"])', r'cPickle.loads(b\1', src)
|
||||
exec(src, options)
|
||||
except Exception as err:
|
||||
|
@ -205,7 +205,7 @@ def ok_to_import_webengine():
|
||||
from qt.core import QApplication
|
||||
if QApplication.instance() is None:
|
||||
return True
|
||||
if 'PyQt5.QtWebEngineWidgets' in sys.modules:
|
||||
if 'PyQt6.QtWebEngineWidgets' in sys.modules:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user