From ccdae1cb24d317e9b947efdddd9a9a7023988625 Mon Sep 17 00:00:00 2001 From: Daniel Martin Date: Wed, 4 Jan 2023 21:41:12 +1300 Subject: [PATCH] Manual update to Qt6 (still need to migrate enums) --- appveyor.yml | 2 +- documentation/openlp.1 | 2 +- openlp/core/api/deploy.py | 2 +- openlp/core/api/tab.py | 10 +- openlp/core/api/websockets.py | 2 +- openlp/core/api/websocketspoll.py | 2 +- openlp/core/app.py | 10 +- openlp/core/common/__init__.py | 8 +- openlp/core/common/actions.py | 4 +- openlp/core/common/handlers.py | 2 +- openlp/core/common/httputils.py | 2 +- openlp/core/common/i18n.py | 8 +- openlp/core/common/platform.py | 2 +- openlp/core/common/settings.py | 164 +++++++++--------- openlp/core/display/render.py | 2 +- openlp/core/display/screens.py | 2 +- openlp/core/display/webengine.py | 34 ++-- openlp/core/display/window.py | 2 +- openlp/core/lib/__init__.py | 2 +- openlp/core/lib/mediamanageritem.py | 2 +- openlp/core/lib/pluginmanager.py | 2 +- openlp/core/lib/serviceitem.py | 2 +- openlp/core/lib/settingstab.py | 2 +- openlp/core/lib/ui.py | 4 +- openlp/core/pages/__init__.py | 2 +- openlp/core/pages/alignment.py | 2 +- openlp/core/pages/areaposition.py | 2 +- openlp/core/pages/background.py | 2 +- openlp/core/pages/fontselect.py | 2 +- openlp/core/projectors/editform.py | 2 +- openlp/core/projectors/manager.py | 18 +- openlp/core/projectors/pjlink.py | 2 +- openlp/core/projectors/sourceselectform.py | 2 +- openlp/core/projectors/tab.py | 2 +- openlp/core/server.py | 2 +- openlp/core/threading.py | 2 +- openlp/core/ui/__init__.py | 2 +- openlp/core/ui/aboutdialog.py | 6 +- openlp/core/ui/aboutform.py | 2 +- openlp/core/ui/advancedtab.py | 2 +- openlp/core/ui/confirmationdialog.py | 4 +- openlp/core/ui/confirmationform.py | 2 +- openlp/core/ui/exceptiondialog.py | 2 +- openlp/core/ui/exceptionform.py | 2 +- openlp/core/ui/filerenamedialog.py | 5 +- openlp/core/ui/filerenameform.py | 2 +- openlp/core/ui/firsttimeform.py | 16 +- openlp/core/ui/firsttimelanguagedialog.py | 2 +- openlp/core/ui/firsttimelanguageform.py | 2 +- openlp/core/ui/firsttimewizard.py | 2 +- openlp/core/ui/folders.py | 2 +- openlp/core/ui/formattingtagdialog.py | 2 +- openlp/core/ui/formattingtagform.py | 7 +- openlp/core/ui/generaltab.py | 4 +- openlp/core/ui/icons.py | 2 +- openlp/core/ui/library.py | 2 +- openlp/core/ui/mainwindow.py | 16 +- openlp/core/ui/media/mediacontroller.py | 2 +- openlp/core/ui/media/mediatab.py | 2 +- openlp/core/ui/media/vlcplayer.py | 2 +- openlp/core/ui/plugindialog.py | 2 +- openlp/core/ui/pluginform.py | 2 +- openlp/core/ui/printservicedialog.py | 2 +- openlp/core/ui/printserviceform.py | 6 +- openlp/core/ui/screenstab.py | 2 +- openlp/core/ui/serviceitemeditdialog.py | 2 +- openlp/core/ui/serviceitemeditform.py | 2 +- openlp/core/ui/servicemanager.py | 18 +- openlp/core/ui/servicenoteform.py | 2 +- openlp/core/ui/servicetab.py | 5 +- openlp/core/ui/settingsdialog.py | 2 +- openlp/core/ui/settingsform.py | 2 +- openlp/core/ui/shortcutlistdialog.py | 4 +- openlp/core/ui/shortcutlistform.py | 11 +- openlp/core/ui/slidecontroller.py | 2 +- openlp/core/ui/splashscreen.py | 2 +- openlp/core/ui/starttimedialog.py | 2 +- openlp/core/ui/starttimeform.py | 2 +- openlp/core/ui/style.py | 4 +- openlp/core/ui/themeform.py | 2 +- openlp/core/ui/themelayoutdialog.py | 2 +- openlp/core/ui/themelayoutform.py | 2 +- openlp/core/ui/thememanager.py | 2 +- openlp/core/ui/themeprogressdialog.py | 2 +- openlp/core/ui/themeprogressform.py | 2 +- openlp/core/ui/themestab.py | 2 +- openlp/core/ui/themewizard.py | 5 +- openlp/core/version.py | 4 +- openlp/core/widgets/buttons.py | 2 +- openlp/core/widgets/dialogs.py | 2 +- openlp/core/widgets/docks.py | 2 +- openlp/core/widgets/edits.py | 8 +- openlp/core/widgets/labels.py | 2 +- openlp/core/widgets/layouts.py | 2 +- openlp/core/widgets/toolbar.py | 2 +- openlp/core/widgets/views.py | 2 +- openlp/core/widgets/widgets.py | 2 +- openlp/core/widgets/wizard.py | 2 +- openlp/plugins/alerts/forms/alertdialog.py | 2 +- openlp/plugins/alerts/forms/alertform.py | 2 +- openlp/plugins/alerts/lib/alertsmanager.py | 2 +- openlp/plugins/alerts/lib/alertstab.py | 2 +- .../plugins/bibles/forms/bibleimportform.py | 2 +- openlp/plugins/bibles/forms/booknamedialog.py | 8 +- openlp/plugins/bibles/forms/booknameform.py | 18 +- .../plugins/bibles/forms/editbibledialog.py | 2 +- openlp/plugins/bibles/forms/editbibleform.py | 2 +- openlp/plugins/bibles/forms/languagedialog.py | 2 +- openlp/plugins/bibles/forms/languageform.py | 4 +- openlp/plugins/bibles/lib/biblestab.py | 18 +- openlp/plugins/bibles/lib/db.py | 2 +- openlp/plugins/bibles/lib/mediaitem.py | 2 +- openlp/plugins/bibles/lib/upgrade.py | 2 +- .../plugins/custom/forms/editcustomdialog.py | 2 +- openlp/plugins/custom/forms/editcustomform.py | 2 +- .../custom/forms/editcustomslidedialog.py | 2 +- .../custom/forms/editcustomslideform.py | 2 +- openlp/plugins/custom/lib/customtab.py | 6 +- openlp/plugins/custom/lib/mediaitem.py | 2 +- openlp/plugins/images/forms/addgroupdialog.py | 0 openlp/plugins/images/forms/addgroupform.py | 72 ++++++++ .../plugins/images/forms/choosegroupdialog.py | 2 +- .../plugins/images/forms/choosegroupform.py | 2 +- openlp/plugins/images/lib/imagetab.py | 2 +- openlp/plugins/images/lib/mediaitem.py | 2 +- openlp/plugins/media/forms/__init__.py | 2 +- .../media/forms/mediaclipselectordialog.py | 2 +- .../media/forms/mediaclipselectorform.py | 4 +- .../media/forms/networkstreamselectorform.py | 2 +- .../media/forms/streamselectordialog.py | 4 +- openlp/plugins/media/lib/mediaitem.py | 2 +- .../planningcenter/forms/selectplandialog.py | 2 +- .../planningcenter/forms/selectplanform.py | 2 +- .../planningcenter/lib/planningcentertab.py | 2 +- .../presentations/lib/impresscontroller.py | 2 +- openlp/plugins/presentations/lib/mediaitem.py | 4 +- .../presentations/lib/messagelistener.py | 2 +- .../lib/presentationcontroller.py | 4 +- .../presentations/lib/presentationtab.py | 2 +- openlp/plugins/songs/forms/authorsdialog.py | 2 +- openlp/plugins/songs/forms/authorsform.py | 2 +- .../songs/forms/duplicatesongremovalform.py | 2 +- openlp/plugins/songs/forms/editsongdialog.py | 2 +- openlp/plugins/songs/forms/editsongform.py | 4 +- openlp/plugins/songs/forms/editversedialog.py | 2 +- openlp/plugins/songs/forms/editverseform.py | 2 +- .../plugins/songs/forms/mediafilesdialog.py | 2 +- openlp/plugins/songs/forms/mediafilesform.py | 2 +- openlp/plugins/songs/forms/songbookdialog.py | 2 +- openlp/plugins/songs/forms/songbookform.py | 2 +- openlp/plugins/songs/forms/songexportform.py | 10 +- openlp/plugins/songs/forms/songimportform.py | 2 +- .../songs/forms/songmaintenancedialog.py | 2 +- .../songs/forms/songmaintenanceform.py | 2 +- .../plugins/songs/forms/songreviewwidget.py | 2 +- .../plugins/songs/forms/songselectdialog.py | 2 +- openlp/plugins/songs/forms/songselectform.py | 2 +- openlp/plugins/songs/forms/topicsdialog.py | 2 +- openlp/plugins/songs/forms/topicsform.py | 2 +- openlp/plugins/songs/forms/webengine.py | 4 +- openlp/plugins/songs/lib/__init__.py | 2 +- .../plugins/songs/lib/importers/openoffice.py | 2 +- .../plugins/songs/lib/importers/songimport.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 2 +- openlp/plugins/songs/lib/songselect.py | 2 +- openlp/plugins/songs/lib/songstab.py | 16 +- openlp/plugins/songs/lib/ui.py | 2 +- openlp/plugins/songs/songsplugin.py | 2 +- .../songusage/forms/songusagedeletedialog.py | 2 +- .../songusage/forms/songusagedeleteform.py | 2 +- .../songusage/forms/songusagedetaildialog.py | 2 +- .../songusage/forms/songusagedetailform.py | 2 +- openlp/plugins/songusage/songusageplugin.py | 2 +- scripts/check_dependencies.py | 40 ++--- scripts/resources.patch | 2 +- setup.cfg | 2 +- setup.py | 2 +- tests/conftest.py | 2 +- tests/helpers/projector.py | 2 +- .../api/endpoint/test_controller.py | 5 +- tests/openlp_core/api/test_tab.py | 2 +- tests/openlp_core/common/test_actions.py | 32 ++-- .../common/test_network_interfaces.py | 4 +- tests/openlp_core/display/test_screens.py | 2 +- tests/openlp_core/display/test_window.py | 6 +- tests/openlp_core/lib/test_lib.py | 2 +- tests/openlp_core/lib/test_theme.py | 2 +- tests/openlp_core/lib/test_ui.py | 10 +- .../projectors/pjlink/test_misc_pjlink.py | 2 +- .../projectors/test_projector_sourceform.py | 2 +- tests/openlp_core/projectors/ui/test_tab.py | 2 +- tests/openlp_core/test_app.py | 6 +- tests/openlp_core/ui/test_confirmationform.py | 2 +- tests/openlp_core/ui/test_exceptionform.py | 6 +- tests/openlp_core/ui/test_filerenamedialog.py | 6 +- tests/openlp_core/ui/test_firsttimeform.py | 2 +- tests/openlp_core/ui/test_generaltab.py | 2 +- tests/openlp_core/ui/test_icons.py | 2 +- tests/openlp_core/ui/test_library.py | 2 +- tests/openlp_core/ui/test_mainwindow.py | 4 +- .../ui/test_serviceitemeditform.py | 2 +- tests/openlp_core/ui/test_servicemanager.py | 22 ++- .../openlp_core/ui/test_servicenotedialog.py | 2 +- tests/openlp_core/ui/test_settings_form.py | 8 +- tests/openlp_core/ui/test_settingsform.py | 2 +- .../openlp_core/ui/test_shortcutlistdialog.py | 4 +- tests/openlp_core/ui/test_shortcutlistform.py | 14 +- tests/openlp_core/ui/test_slidecontroller.py | 10 +- tests/openlp_core/ui/test_splashscreen.py | 2 +- tests/openlp_core/ui/test_starttimedialog.py | 6 +- tests/openlp_core/ui/test_style.py | 2 +- tests/openlp_core/ui/test_thememanager.py | 2 +- tests/openlp_core/widgets/test_dialogs.py | 24 +-- tests/openlp_core/widgets/test_edits.py | 10 +- tests/openlp_core/widgets/test_views.py | 2 +- tests/openlp_core/widgets/test_widgets.py | 26 +-- .../alerts/forms/test_alertform.py | 2 +- .../bibles/forms/test_bibleimportform.py | 2 +- .../bibles/forms/test_editbibleform.py | 2 +- .../openlp_plugins/bibles/test_bibleimport.py | 2 +- tests/openlp_plugins/bibles/test_mediaitem.py | 2 +- .../custom/forms/test_customform.py | 4 +- .../custom/forms/test_customslideform.py | 6 +- .../images/forms/test_choosegroupform.py | 2 +- tests/openlp_plugins/images/test_mediaitem.py | 2 +- .../media/forms/test_mediaclipselectorform.py | 10 +- .../media/forms/test_streamselectorform.py | 6 +- .../forms/test_selectplanform.py | 30 ++-- .../lib/test_planningcentertab.py | 2 +- .../test_planningcenterplugin.py | 2 +- .../presentations/test_mediaitem.py | 2 +- .../presentations/test_pdfcontroller.py | 2 +- .../presentations/test_presentationtab.py | 20 +-- .../songs/forms/test_authorsform.py | 2 +- .../songs/forms/test_editsongform.py | 2 +- .../songs/forms/test_editverseform.py | 6 +- .../songs/forms/test_songmaintenanceform.py | 2 +- .../songs/forms/test_topicsform.py | 2 +- tests/openlp_plugins/songs/test_mediaitem.py | 2 +- tests/openlp_plugins/songs/test_songselect.py | 2 +- tests/openlp_plugins/songs/test_songstab.py | 14 +- .../forms/test_songusagedeleteform.py | 2 +- .../forms/test_songusagedetailform.py | 2 +- 243 files changed, 667 insertions(+), 583 deletions(-) create mode 100644 openlp/plugins/images/forms/addgroupdialog.py create mode 100644 openlp/plugins/images/forms/addgroupform.py diff --git a/appveyor.yml b/appveyor.yml index 0304cfccf..c31ba4f0c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,7 +31,7 @@ install: # Update pip - python -m pip install --upgrade pip # Install generic dependencies from pypi. - - python -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock psycopg2-binary websockets waitress six requests QtAwesome PyQt5 PyQtWebEngine pymediainfo PyMuPDF QDarkStyle python-vlc flask-cors pytest-qt pyenchant pysword qrcode flask + - python -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock psycopg2-binary websockets waitress six requests QtAwesome PyQt6 PyQtWebEngine pymediainfo PyMuPDF QDarkStyle python-vlc flask-cors pytest-qt pyenchant pysword qrcode flask # Install Windows only dependencies - cmd: python -m pip install pyodbc pypiwin32 - cmd: choco install vlc %CHOCO_VLC_ARG% --no-progress --limit-output diff --git a/documentation/openlp.1 b/documentation/openlp.1 index 7272e7578..3b1eea38c 100644 --- a/documentation/openlp.1 +++ b/documentation/openlp.1 @@ -29,7 +29,7 @@ Ignore the version file and pull the version directly from Bazaar .TP \fB\-s\fR STYLE, \fB\-\-style\fR=\fISTYLE\fR -Set the Qt5 style (passed directly to Qt5). +Set the Qt6 style (passed directly to Qt6). .TP \fB\-\-testing\fR Run by testing framework diff --git a/openlp/core/api/deploy.py b/openlp/core/api/deploy.py index 8515930a2..8d527ac06 100644 --- a/openlp/core/api/deploy.py +++ b/openlp/core/api/deploy.py @@ -27,7 +27,7 @@ import re from datetime import date from zipfile import ZipFile -from PyQt5 import QtCore +from PyQt6 import QtCore from openlp.core.common.applocation import AppLocation from openlp.core.common.httputils import download_file, get_web_page, get_openlp_user_agent diff --git a/openlp/core/api/tab.py b/openlp/core/api/tab.py index 325212016..d8958e200 100644 --- a/openlp/core/api/tab.py +++ b/openlp/core/api/tab.py @@ -27,7 +27,7 @@ from qrcode.image.svg import SvgPathFillImage from time import sleep -from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets from openlp.core.api.deploy import download_and_install, download_version_info, get_installed_version from openlp.core.common import get_network_interfaces @@ -65,8 +65,8 @@ class ApiTab(SettingsTab): self.server_settings_layout.addRow(self.address_label) self.address_edit = QtWidgets.QLineEdit(self.server_settings_group_box) self.address_edit.setSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Fixed) - self.address_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'), - self)) + self.address_edit.setValidator(QtGui.QRegularExpressionValidator(QtCore.QRegularExpression( + r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'), self)) self.address_edit.setObjectName('address_edit') self.address_revert_button = QtWidgets.QToolButton(self.server_settings_group_box) self.address_revert_button.setObjectName('address_revert_button') @@ -372,7 +372,7 @@ class ApiTab(SettingsTab): """ self.twelve_hour = False # we have a set value convert to True/False - if check_state == QtCore.Qt.Checked: + if check_state == QtCore.Qt.CheckState.Checked: self.twelve_hour = True def on_thumbnails_check_box_changed(self, check_state): @@ -381,7 +381,7 @@ class ApiTab(SettingsTab): """ self.thumbnails = False # we have a set value convert to True/False - if check_state == QtCore.Qt.Checked: + if check_state == QtCore.Qt.CheckState.Checked: self.thumbnails = True def on_check_for_updates_button_clicked(self): diff --git a/openlp/core/api/websockets.py b/openlp/core/api/websockets.py index ea0cf244b..03f1af0f6 100644 --- a/openlp/core/api/websockets.py +++ b/openlp/core/api/websockets.py @@ -30,7 +30,7 @@ from dataclasses import asdict, dataclass from typing import Optional, Union import time -from PyQt5 import QtCore +from PyQt6 import QtCore from websockets import serve from openlp.core.common.mixins import LogMixin, RegistryProperties diff --git a/openlp/core/api/websocketspoll.py b/openlp/core/api/websocketspoll.py index c1d541a18..deacbc745 100644 --- a/openlp/core/api/websocketspoll.py +++ b/openlp/core/api/websocketspoll.py @@ -18,7 +18,7 @@ # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # ########################################################################## -from PyQt5 import QtCore +from PyQt6 import QtCore from openlp.core.common.mixins import RegistryProperties diff --git a/openlp/core/app.py b/openlp/core/app.py index 6b6117dfc..c16f43b58 100644 --- a/openlp/core/app.py +++ b/openlp/core/app.py @@ -35,7 +35,7 @@ from pathlib import Path from shutil import copytree, move from traceback import format_exception -from PyQt5 import QtCore, QtGui, QtWebEngineWidgets, QtWidgets # noqa +from PyQt6 import QtCore, QtWebEngineCore, QtWidgets # noqa from openlp.core.api.deploy import check_for_remote_update from openlp.core.common.applocation import AppLocation @@ -327,7 +327,7 @@ def set_up_web_engine_cache(web_cache_path): :param Path web_cache_path: The folder for the web engine files :rtype: None """ - web_engine_profile = QtWebEngineWidgets.QWebEngineProfile.defaultProfile() + web_engine_profile = QtWebEngineCore.QWebEngineProfile.defaultProfile() web_engine_profile.setCachePath(str(web_cache_path)) web_engine_profile.setPersistentStoragePath(str(web_cache_path)) @@ -408,8 +408,6 @@ def apply_dpi_adjustments_stage_qt(hidpi_mode, qt_args): qt_args[platform_index + 1] += ' windows:dpiawareness=0' except ValueError: qt_args.extend(['-platform', 'windows:dpiawareness=0']) - else: - QtWidgets.QApplication.setAttribute(QtCore.Qt.ApplicationAttribute.AA_EnableHighDpiScaling) if hidpi_mode == HiDPIMode.Default: no_custom_factor_rounding = not ('QT_SCALE_FACTOR_ROUNDING_POLICY' in os.environ and bool(os.environ['QT_SCALE_FACTOR_ROUNDING_POLICY'].strip())) @@ -438,8 +436,6 @@ def apply_dpi_adjustments_stage_application(hidpi_mode: HiDPIMode, application: font = application.font() font.setPointSizeF(font.pointSizeF() * application.devicePixelRatio()) application.setFont(font) - if hidpi_mode != HiDPIMode.Windows_Unaware: - application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True) def setup_portable_settings(portable_path: Path | str | None) -> Settings: @@ -514,7 +510,7 @@ def main(): # Instantiating QCoreApplication init_webview_custom_schemes() application = QtWidgets.QApplication(qt_args) - application.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings, True) + application.setAttribute(QtCore.Qt.ApplicationAttribute.AA_DontCreateNativeWidgetSiblings, True) # Doing HiDPI adjustments that need to be done after QCoreApplication instantiation. apply_dpi_adjustments_stage_application(hidpi_mode, application) if no_custom_factor_rounding and hasattr(QtWidgets.QApplication, 'setHighDpiScaleFactorRoundingPolicy'): diff --git a/openlp/core/common/__init__.py b/openlp/core/common/__init__.py index e51ba8394..54be12ed5 100644 --- a/openlp/core/common/__init__.py +++ b/openlp/core/common/__init__.py @@ -31,9 +31,9 @@ import traceback from ipaddress import IPv4Address, IPv6Address, AddressValueError from shutil import which -from PyQt5 import QtGui -from PyQt5.QtCore import QCryptographicHash as QHash -from PyQt5.QtNetwork import QAbstractSocket, QHostAddress, QNetworkInterface +from PyQt6 import QtGui +from PyQt6.QtCore import QCryptographicHash as QHash +from PyQt6.QtNetwork import QAbstractSocket, QHostAddress, QNetworkInterface from chardet.universaldetector import UniversalDetector log = logging.getLogger(__name__ + '.__init__') @@ -282,7 +282,7 @@ def sha256_file_hash(filename): def qmd5_hash(salt=None, data=None): """ Returns the hashed output of MD5Sum on salt, data - using PyQt5.QCryptographicHash. Function returns a + using PyQt6.QCryptographicHash. Function returns a QByteArray instead of a text string. If you need a string instead, call with diff --git a/openlp/core/common/actions.py b/openlp/core/common/actions.py index d27dec56a..9a3df4749 100644 --- a/openlp/core/common/actions.py +++ b/openlp/core/common/actions.py @@ -24,7 +24,7 @@ by the shortcuts system. """ import logging -from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt6 import QtCore, QtGui from openlp.core.common.registry import Registry @@ -356,7 +356,7 @@ class ActionList(object): affected_actions = [] if global_context: affected_actions = [a for a in self.get_all_child_objects(action.parent()) if isinstance(a, - QtWidgets.QAction)] + QtGui.QAction)] for existing_action in existing_actions: if action is existing_action: continue diff --git a/openlp/core/common/handlers.py b/openlp/core/common/handlers.py index fe848aa41..35b487ccf 100644 --- a/openlp/core/common/handlers.py +++ b/openlp/core/common/handlers.py @@ -26,7 +26,7 @@ from contextlib import contextmanager from pathlib import Path from typing import Optional -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from openlp.core.common.i18n import translate diff --git a/openlp/core/common/httputils.py b/openlp/core/common/httputils.py index 97ce98576..73c9ba7cb 100644 --- a/openlp/core/common/httputils.py +++ b/openlp/core/common/httputils.py @@ -30,7 +30,7 @@ from random import randint from tempfile import gettempdir import requests -from PyQt5 import QtCore +from PyQt6 import QtCore from openlp.core.common import trace_error_handler from openlp.core.common.registry import Registry diff --git a/openlp/core/common/i18n.py b/openlp/core/common/i18n.py index 5aea6ab7f..fbdf1c414 100644 --- a/openlp/core/common/i18n.py +++ b/openlp/core/common/i18n.py @@ -27,7 +27,7 @@ import logging import re from collections import namedtuple -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets from openlp.core.common import Singleton from openlp.core.common.applocation import AppLocation @@ -40,7 +40,7 @@ log = logging.getLogger(__name__) # Due to dependency issues, this HAS to be at the top of the file def translate(context, text, comment=None, qt_translate=QtCore.QCoreApplication.translate): """ - A special shortcut method to wrap around the Qt5 translation functions. This abstracts the translation procedure so + A special shortcut method to wrap around the Qt6 translation functions. This abstracts the translation procedure so that we can change it if at a later date if necessary, without having to redo the whole of OpenLP. :param context: The translation context, used to give each string a context or a namespace. @@ -233,7 +233,7 @@ class LanguageManager(object): # A translator for buttons and other default strings provided by Qt. if not is_win() and not is_macosx(): lang_path = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath) - # As of Qt5, the core translations come in 2 files per language + # As of Qt6, the core translations come in 2 files per language default_translator = QtCore.QTranslator() default_translator.load('qt_%s' % language, lang_path) base_translator = QtCore.QTranslator() @@ -312,7 +312,7 @@ class LanguageManager(object): LanguageManager.__qm_list__ = {} qm_files = LanguageManager.find_qm_files() for counter, qmf in enumerate(qm_files): - reg_ex = QtCore.QRegExp("^.*i18n/(.*).qm") + reg_ex = QtCore.QRegularExpression("^.*i18n/(.*).qm") if reg_ex.exactMatch(qmf): name = '{regex}'.format(regex=reg_ex.cap(1)) LanguageManager.__qm_list__[ diff --git a/openlp/core/common/platform.py b/openlp/core/common/platform.py index d1b7fe798..02a0c9418 100644 --- a/openlp/core/common/platform.py +++ b/openlp/core/common/platform.py @@ -110,7 +110,7 @@ def is_xorg_platform(): :return: True if the Qt is running on X.org/XWayland display server (Linux/*nix), otherwise False. """ - from PyQt5 import QtGui + from PyQt6 import QtGui return QtGui.QGuiApplication.platformName() == 'xcb' diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index 00ea8f519..435a0f731 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -29,7 +29,7 @@ from enum import IntEnum from pathlib import Path from tempfile import gettempdir -from PyQt5 import QtCore, QtGui +from PyQt6 import QtCore, QtGui from openlp.core.common import SlideLimits, ThemeLevel from openlp.core.common.enum import AlertLocation, BibleSearch, CustomSearch, HiDPIMode, ImageThemeMode, LayoutStyle, \ @@ -300,7 +300,7 @@ class Settings(QtCore.QSettings): 'media/status': PluginStatus.Inactive, 'media/media files': [], 'media/last directory': None, - 'media/media auto start': QtCore.Qt.Unchecked, + 'media/media auto start': QtCore.Qt.CheckState.Unchecked, 'media/vlc arguments': '', 'media/live volume': 50, 'media/preview volume': 0, @@ -316,18 +316,18 @@ class Settings(QtCore.QSettings): 'planningcenter/application_id': '', 'planningcenter/secret': '', 'presentations/status': PluginStatus.Inactive, - 'presentations/override app': QtCore.Qt.Unchecked, - 'presentations/maclo': QtCore.Qt.Checked, - 'presentations/Impress': QtCore.Qt.Checked, - 'presentations/Powerpoint': QtCore.Qt.Checked, - 'presentations/Pdf': QtCore.Qt.Checked, - 'presentations/Keynote': QtCore.Qt.Checked, - 'presentations/PowerPointMac': QtCore.Qt.Checked, + 'presentations/override app': QtCore.Qt.CheckState.Unchecked, + 'presentations/maclo': QtCore.Qt.CheckState.Checked, + 'presentations/Impress': QtCore.Qt.CheckState.Checked, + 'presentations/Powerpoint': QtCore.Qt.CheckState.Checked, + 'presentations/Pdf': QtCore.Qt.CheckState.Checked, + 'presentations/Keynote': QtCore.Qt.CheckState.Checked, + 'presentations/PowerPointMac': QtCore.Qt.CheckState.Checked, 'presentations/presentations files': [], 'presentations/thumbnail_scheme': '', - 'presentations/powerpoint slide click advance': QtCore.Qt.Unchecked, - 'presentations/powerpoint control window': QtCore.Qt.Unchecked, - 'presentations/impress use display setting': QtCore.Qt.Unchecked, + 'presentations/powerpoint slide click advance': QtCore.Qt.CheckState.Unchecked, + 'presentations/powerpoint control window': QtCore.Qt.CheckState.Unchecked, + 'presentations/impress use display setting': QtCore.Qt.CheckState.Unchecked, 'presentations/last directory': None, 'presentations/db type': 'sqlite', 'presentations/db username': '', @@ -533,17 +533,18 @@ class Settings(QtCore.QSettings): def init_default_shortcuts(self): # Add shortcuts here so QKeySequence has a QApplication instance to use. Settings.__default_settings__.update({ - 'shortcuts/aboutItem': [QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_F1)], + 'shortcuts/aboutItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Control + QtCore.Qt.Key.Key_F1)], 'shortcuts/addToService': [], 'shortcuts/audioPauseItem': [], 'shortcuts/displayTagItem': [], - 'shortcuts/blankScreen': [QtGui.QKeySequence(QtCore.Qt.Key_Period)], - 'shortcuts/collapse': [QtGui.QKeySequence(QtCore.Qt.Key_Minus)], - 'shortcuts/desktopScreen': [QtGui.QKeySequence(QtCore.Qt.Key_D), QtGui.QKeySequence(QtCore.Qt.Key_Escape)], + 'shortcuts/blankScreen': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Period)], + 'shortcuts/collapse': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Minus)], + 'shortcuts/desktopScreen': [QtGui.QKeySequence(QtCore.Qt.Key.Key_D), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Escape)], 'shortcuts/delete': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)], - 'shortcuts/down': [QtGui.QKeySequence(QtCore.Qt.Key_Down)], + 'shortcuts/down': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Down)], 'shortcuts/editSong': [], - 'shortcuts/expand': [QtGui.QKeySequence(QtCore.Qt.Key_Plus)], + 'shortcuts/expand': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Plus)], 'shortcuts/exportThemeItem': [], 'shortcuts/fileNewItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.New)], 'shortcuts/fileSaveAsItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.SaveAs)], @@ -555,82 +556,85 @@ class Settings(QtCore.QSettings): 'shortcuts/importThemeItem': [], 'shortcuts/importBibleItem': [], 'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)], - 'shortcuts/listViewBiblesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.Key_Enter)], - 'shortcuts/listViewBiblesLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Enter)], - 'shortcuts/listViewBiblesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus), - QtGui.QKeySequence(QtCore.Qt.Key_Equal)], + 'shortcuts/listViewBiblesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewBiblesLiveItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Shift + QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Shift + QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewBiblesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Plus), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Equal)], 'shortcuts/listViewCustomDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)], - 'shortcuts/listViewCustomPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.Key_Enter)], - 'shortcuts/listViewCustomLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Enter)], - 'shortcuts/listViewCustomServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus), - QtGui.QKeySequence(QtCore.Qt.Key_Equal)], + 'shortcuts/listViewCustomPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewCustomLiveItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Shift + QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Shift + QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewCustomServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Plus), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Equal)], 'shortcuts/listViewImagesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)], - 'shortcuts/listViewImagesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.Key_Enter)], - 'shortcuts/listViewImagesLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Enter)], - 'shortcuts/listViewImagesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus), - QtGui.QKeySequence(QtCore.Qt.Key_Equal)], + 'shortcuts/listViewImagesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewImagesLiveItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Shift + QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Shift + QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewImagesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Plus), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Equal)], 'shortcuts/listViewMediaDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)], - 'shortcuts/listViewMediaPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.Key_Enter)], - 'shortcuts/listViewMediaLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Enter)], - 'shortcuts/listViewMediaServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus), - QtGui.QKeySequence(QtCore.Qt.Key_Equal)], + 'shortcuts/listViewMediaPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewMediaLiveItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Shift + QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Shift + QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewMediaServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Plus), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Equal)], 'shortcuts/listViewPresentationsDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)], - 'shortcuts/listViewPresentationsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.Key_Enter)], - 'shortcuts/listViewPresentationsLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Enter)], - 'shortcuts/listViewPresentationsServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus), - QtGui.QKeySequence(QtCore.Qt.Key_Equal)], + 'shortcuts/listViewPresentationsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewPresentationsLiveItem': [QtGui.QKeySequence(QtCore.Qt.Key_Shift + + QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key_Shift + + QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewPresentationsServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Plus), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Equal)], 'shortcuts/listViewSongsDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)], - 'shortcuts/listViewSongsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.Key_Enter)], - 'shortcuts/listViewSongsLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return), - QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Enter)], - 'shortcuts/listViewSongsServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus), - QtGui.QKeySequence(QtCore.Qt.Key_Equal)], + 'shortcuts/listViewSongsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewSongsLiveItem': [QtGui.QKeySequence(QtCore.Qt.Key_Shift + QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key_Shift + QtCore.Qt.Key.Key_Enter)], + 'shortcuts/listViewSongsServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Plus), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Equal)], 'shortcuts/lockPanel': [], 'shortcuts/modeDefaultItem': [], 'shortcuts/modeLiveItem': [], - 'shortcuts/make_live': [QtGui.QKeySequence(QtCore.Qt.Key_Return), QtGui.QKeySequence(QtCore.Qt.Key_Enter)], - 'shortcuts/moveUp': [QtGui.QKeySequence(QtCore.Qt.Key_PageUp)], - 'shortcuts/moveTop': [QtGui.QKeySequence(QtCore.Qt.Key_Home)], + 'shortcuts/make_live': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Return), + QtGui.QKeySequence(QtCore.Qt.Key.Key_Enter)], + 'shortcuts/moveUp': [QtGui.QKeySequence(QtCore.Qt.Key.Key_PageUp)], + 'shortcuts/moveTop': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Home)], 'shortcuts/modeSetupItem': [], - 'shortcuts/moveBottom': [QtGui.QKeySequence(QtCore.Qt.Key_End)], - 'shortcuts/moveDown': [QtGui.QKeySequence(QtCore.Qt.Key_PageDown)], + 'shortcuts/moveBottom': [QtGui.QKeySequence(QtCore.Qt.Key.Key_End)], + 'shortcuts/moveDown': [QtGui.QKeySequence(QtCore.Qt.Key.Key_PageDown)], 'shortcuts/nextTrackItem': [], - 'shortcuts/nextItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Down), - QtGui.QKeySequence(QtCore.Qt.Key_PageDown)], - 'shortcuts/nextItem_preview': [QtGui.QKeySequence(QtCore.Qt.Key_Down), - QtGui.QKeySequence(QtCore.Qt.Key_PageDown)], - 'shortcuts/nextService': [QtGui.QKeySequence(QtCore.Qt.Key_Right)], + 'shortcuts/nextItem_live': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Down), + QtGui.QKeySequence(QtCore.Qt.Key.Key_PageDown)], + 'shortcuts/nextItem_preview': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Down), + QtGui.QKeySequence(QtCore.Qt.Key.Key_PageDown)], + 'shortcuts/nextService': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Right)], 'shortcuts/newService': [], 'shortcuts/openService': [], 'shortcuts/saveService': [], - 'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up), - QtGui.QKeySequence(QtCore.Qt.Key_PageUp)], + 'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Up), + QtGui.QKeySequence(QtCore.Qt.Key.Key_PageUp)], 'shortcuts/playbackPause': [], 'shortcuts/playbackPlay': [], 'shortcuts/playbackStop': [], 'shortcuts/playSlidesLoop': [], 'shortcuts/playSlidesOnce': [], - 'shortcuts/previousService': [QtGui.QKeySequence(QtCore.Qt.Key_Left)], - 'shortcuts/previousItem_preview': [QtGui.QKeySequence(QtCore.Qt.Key_Up), - QtGui.QKeySequence(QtCore.Qt.Key_PageUp)], + 'shortcuts/previousService': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Left)], + 'shortcuts/previousItem_preview': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Up), + QtGui.QKeySequence(QtCore.Qt.Key.Key_PageUp)], 'shortcuts/printServiceItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Print)], 'shortcuts/songExportItem': [], - 'shortcuts/songUsageStatus': [QtGui.QKeySequence(QtCore.Qt.Key_F4)], + 'shortcuts/songUsageStatus': [QtGui.QKeySequence(QtCore.Qt.Key.Key_F4)], 'shortcuts/searchShortcut': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Find)], 'shortcuts/settingsShortcutsItem': [], 'shortcuts/settingsImportItem': [], - 'shortcuts/settingsPluginListItem': [QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_F7)], + 'shortcuts/settingsPluginListItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Alt + QtCore.Qt.Key.Key_F7)], 'shortcuts/songUsageDelete': [], 'shortcuts/settingsConfigureItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Preferences)], 'shortcuts/shortcutAction_B': [QtGui.QKeySequence(QtCore.Qt.Key_B)], @@ -654,22 +658,22 @@ class Settings(QtCore.QSettings): 'shortcuts/settingsExportItem': [], 'shortcuts/songUsageReport': [], 'shortcuts/songImportItem': [], - 'shortcuts/themeScreen': [QtGui.QKeySequence(QtCore.Qt.Key_T)], + 'shortcuts/themeScreen': [QtGui.QKeySequence(QtCore.Qt.Key.Key_T)], 'shortcuts/toolsReindexItem': [], 'shortcuts/toolsFindDuplicates': [], 'shortcuts/toolsSongListReport': [], - 'shortcuts/toolsAlertItem': [QtGui.QKeySequence(QtCore.Qt.Key_F7)], + 'shortcuts/toolsAlertItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_F7)], 'shortcuts/toolsFirstTimeWizard': [], 'shortcuts/toolsOpenDataFolder': [], 'shortcuts/toolsAddToolItem': [], 'shortcuts/updateThemeImages': [], - 'shortcuts/up': [QtGui.QKeySequence(QtCore.Qt.Key_Up)], - 'shortcuts/viewProjectorManagerItem': [QtGui.QKeySequence(QtCore.Qt.Key_F6)], - 'shortcuts/viewThemeManagerItem': [QtGui.QKeySequence(QtCore.Qt.Key_F10)], - 'shortcuts/viewMediaManagerItem': [QtGui.QKeySequence(QtCore.Qt.Key_F8)], - 'shortcuts/viewPreviewPanel': [QtGui.QKeySequence(QtCore.Qt.Key_F11)], - 'shortcuts/viewLivePanel': [QtGui.QKeySequence(QtCore.Qt.Key_F12)], - 'shortcuts/viewServiceManagerItem': [QtGui.QKeySequence(QtCore.Qt.Key_F9)], + 'shortcuts/up': [QtGui.QKeySequence(QtCore.Qt.Key.Key_Up)], + 'shortcuts/viewProjectorManagerItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_F6)], + 'shortcuts/viewThemeManagerItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_F10)], + 'shortcuts/viewMediaManagerItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_F8)], + 'shortcuts/viewPreviewPanel': [QtGui.QKeySequence(QtCore.Qt.Key.Key_F11)], + 'shortcuts/viewLivePanel': [QtGui.QKeySequence(QtCore.Qt.Key.Key_F12)], + 'shortcuts/viewServiceManagerItem': [QtGui.QKeySequence(QtCore.Qt.Key.Key_F9)], 'shortcuts/webSiteItem': [] }) diff --git a/openlp/core/display/render.py b/openlp/core/display/render.py index d40fafd8f..31ef78897 100644 --- a/openlp/core/display/render.py +++ b/openlp/core/display/render.py @@ -28,7 +28,7 @@ import math import os import re -from PyQt5 import QtWidgets, QtGui +from PyQt6 import QtWidgets, QtGui from openlp.core.common import ThemeLevel from openlp.core.common.enum import ServiceItemType diff --git a/openlp/core/display/screens.py b/openlp/core/display/screens.py index cbb0b5ad5..c15019ff0 100644 --- a/openlp/core/display/screens.py +++ b/openlp/core/display/screens.py @@ -26,7 +26,7 @@ import logging import copy from functools import cmp_to_key -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets from openlp.core.common import Singleton from openlp.core.common.i18n import translate diff --git a/openlp/core/display/webengine.py b/openlp/core/display/webengine.py index 04897f2df..24837c20f 100644 --- a/openlp/core/display/webengine.py +++ b/openlp/core/display/webengine.py @@ -25,7 +25,7 @@ Heavily inspired by https://stackoverflow.com/questions/33467776/qt-qwebengine-r import logging import os.path -from PyQt5 import QtCore, QtWebEngineWidgets, QtWidgets, QtWebEngineCore +from PyQt6 import QtCore, QtWebEngineCore, QtWebEngineWidgets, QtWidgets from typing import Tuple from openlp.core.common import Singleton @@ -35,16 +35,16 @@ from openlp.core.common.platform import is_win LOG_LEVELS = { - QtWebEngineWidgets.QWebEnginePage.InfoMessageLevel: logging.INFO, - QtWebEngineWidgets.QWebEnginePage.WarningMessageLevel: logging.WARNING, - QtWebEngineWidgets.QWebEnginePage.ErrorMessageLevel: logging.ERROR + QtWebEngineCore.QWebEnginePage.JavaScriptConsoleMessageLevel.InfoMessageLevel: logging.INFO, + QtWebEngineCore.QWebEnginePage.JavaScriptConsoleMessageLevel.WarningMessageLevel: logging.WARNING, + QtWebEngineCore.QWebEnginePage.JavaScriptConsoleMessageLevel.ErrorMessageLevel: logging.ERROR } log = logging.getLogger(__name__) -class WebEnginePage(QtWebEngineWidgets.QWebEnginePage): +class WebEnginePage(QtWebEngineCore.QWebEnginePage): """ A custom WebEngine page to capture Javascript console logging """ @@ -76,12 +76,16 @@ class WebEngineView(QtWebEngineWidgets.QWebEngineView): """ super(WebEngineView, self).__init__(parent) self.setPage(WebEnginePage(self)) - self.settings().setAttribute(QtWebEngineWidgets.QWebEngineSettings.LocalStorageEnabled, True) - self.settings().setAttribute(QtWebEngineWidgets.QWebEngineSettings.LocalContentCanAccessFileUrls, True) - self.settings().setAttribute(QtWebEngineWidgets.QWebEngineSettings.LocalContentCanAccessRemoteUrls, True) - self.page().settings().setAttribute(QtWebEngineWidgets.QWebEngineSettings.LocalStorageEnabled, True) - self.page().settings().setAttribute(QtWebEngineWidgets.QWebEngineSettings.LocalContentCanAccessFileUrls, True) - self.page().settings().setAttribute(QtWebEngineWidgets.QWebEngineSettings.LocalContentCanAccessRemoteUrls, True) + self.settings().setAttribute(QtWebEngineCore.QWebEngineSettings.WebAttribute.LocalStorageEnabled, True) + self.settings().setAttribute( + QtWebEngineCore.QWebEngineSettings.WebAttribute.LocalContentCanAccessFileUrls, True) + self.settings().setAttribute( + QtWebEngineCore.QWebEngineSettings.WebAttribute.LocalContentCanAccessRemoteUrls, True) + self.page().settings().setAttribute(QtWebEngineCore.QWebEngineSettings.WebAttribute.LocalStorageEnabled, True) + self.page().settings().setAttribute( + QtWebEngineCore.QWebEngineSettings.WebAttribute.LocalContentCanAccessFileUrls, True) + self.page().settings().setAttribute( + QtWebEngineCore.QWebEngineSettings.WebAttribute.LocalContentCanAccessRemoteUrls, True) self.setContextMenuPolicy(QtCore.Qt.PreventContextMenu) def eventFilter(self, obj, ev): @@ -89,9 +93,9 @@ class WebEngineView(QtWebEngineWidgets.QWebEngineView): Emit delegatePaint on paint event of the last added QOpenGLWidget child """ if obj == self._child: - if ev.type() == QtCore.QEvent.MouseButtonPress or ev.type() == QtCore.QEvent.TouchBegin: + if ev.type() == QtCore.QEvent.Type.MouseButtonPress or ev.type() == QtCore.QEvent.Type.TouchBegin: self.display_clicked() - if ev.type() == QtCore.QEvent.Paint: + if ev.type() == QtCore.QEvent.Type.Paint: self.delegatePaint.emit() return super(WebEngineView, self).eventFilter(obj, ev) @@ -105,7 +109,7 @@ class WebEngineView(QtWebEngineWidgets.QWebEngineView): """ Handle events """ - if ev.type() == QtCore.QEvent.ChildAdded: + if ev.type() == QtCore.QEvent.Type.ChildAdded: # Only use QWidget child (used to be QOpenGLWidget) w = ev.child() if w and isinstance(w, QtWidgets.QWidget): @@ -217,7 +221,7 @@ class WebViewCustomScheme(QtCore.QObject): def init_handler(self, profile=None): if profile is None: - profile = QtWebEngineWidgets.QWebEngineProfile.defaultProfile() + profile = QtWebEngineCore.QWebEngineProfile.defaultProfile() handler = profile.urlSchemeHandler(self.scheme_name) if handler is not None: profile.removeUrlSchemeHandler(handler) diff --git a/openlp/core/display/window.py b/openlp/core/display/window.py index fd026278a..cbd944f74 100644 --- a/openlp/core/display/window.py +++ b/openlp/core/display/window.py @@ -27,7 +27,7 @@ import os import copy import re -from PyQt5 import QtCore, QtWebChannel, QtWidgets +from PyQt6 import QtCore, QtWebChannel, QtWidgets from openlp.core.common.enum import ServiceItemType from openlp.core.common.i18n import translate diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 4d157504d..033678a98 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -28,7 +28,7 @@ import base64 from enum import IntEnum from pathlib import Path -from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets from openlp.core.common.i18n import UiStrings, translate diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 95086a000..d9f77430c 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -23,7 +23,7 @@ Provides the generic functions for interfacing plugins with the Media Manager. """ import re -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.mixins import LogMixin, RegistryProperties diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index 1e59f42bd..076773677 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -23,7 +23,7 @@ Provide plugin management """ import os -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from openlp.core.state import State, MessageType from openlp.core.common import extension_loader diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 9455d686b..e46ed542e 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -30,7 +30,7 @@ from copy import deepcopy from pathlib import Path from shutil import copytree, copy, move -from PyQt5 import QtGui +from PyQt6 import QtGui from openlp.core.common import ThemeLevel, sha256_file_hash from openlp.core.common.applocation import AppLocation diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 6746fea32..d82906261 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -22,7 +22,7 @@ The :mod:`~openlp.core.lib.settingstab` module contains the base SettingsTab class which plugins use for adding their own tab to the settings dialog. """ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from openlp.core.common.mixins import RegistryProperties diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index d1dcc6941..c4ba0aaa5 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -23,7 +23,7 @@ The :mod:`ui` module provides standard UI components for OpenLP. """ import logging -from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets from openlp.core.common.actions import ActionList from openlp.core.common.i18n import UiStrings, translate @@ -268,7 +268,7 @@ def create_action(parent, name, **kwargs): ``triggers`` A slot which is connected to the actions ``triggered()`` slot. """ - action = QtWidgets.QAction(parent) + action = QtGui.QAction(parent) action.setObjectName(name) if is_macosx(): action.setIconVisibleInMenu(False) diff --git a/openlp/core/pages/__init__.py b/openlp/core/pages/__init__.py index 672db29b4..0785bc6ad 100644 --- a/openlp/core/pages/__init__.py +++ b/openlp/core/pages/__init__.py @@ -21,7 +21,7 @@ """ The :mod:`~openlp.core.pages` module contains wizard pages used in OpenLP """ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets class GridLayoutPage(QtWidgets.QWizardPage): diff --git a/openlp/core/pages/alignment.py b/openlp/core/pages/alignment.py index 759b0ab27..8e2621196 100644 --- a/openlp/core/pages/alignment.py +++ b/openlp/core/pages/alignment.py @@ -21,7 +21,7 @@ """ The :mod:`~openlp.core.pages.alignment` module contains the alignment page used in the theme wizard """ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from openlp.core.common.i18n import translate from openlp.core.lib.theme import HorizontalType, VerticalType, TransitionType, TransitionSpeed, TransitionDirection diff --git a/openlp/core/pages/areaposition.py b/openlp/core/pages/areaposition.py index 03c23a1fb..3fec160df 100644 --- a/openlp/core/pages/areaposition.py +++ b/openlp/core/pages/areaposition.py @@ -21,7 +21,7 @@ """ The :mod:`~openlp.core.pages.areaposition` module contains the area position page used in the theme wizard """ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from openlp.core.common.i18n import translate from openlp.core.pages import GridLayoutPage diff --git a/openlp/core/pages/background.py b/openlp/core/pages/background.py index 37846f27e..c06ce041e 100644 --- a/openlp/core/pages/background.py +++ b/openlp/core/pages/background.py @@ -21,7 +21,7 @@ """ The :mod:`~openlp.core.pages.background` module contains the background page used in the theme wizard """ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from openlp.core.common import get_images_filter from openlp.core.common.i18n import UiStrings, translate diff --git a/openlp/core/pages/fontselect.py b/openlp/core/pages/fontselect.py index d0c8ce44c..f0bf858e2 100644 --- a/openlp/core/pages/fontselect.py +++ b/openlp/core/pages/fontselect.py @@ -21,7 +21,7 @@ """ The :mod:`~openlp.core.pages.fontselect` module contains the font selection page used in the theme wizard """ -from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets from openlp.core.common.i18n import UiStrings, translate from openlp.core.pages import GridLayoutPage diff --git a/openlp/core/projectors/editform.py b/openlp/core/projectors/editform.py index 1c96fa5dd..d8027fa5f 100644 --- a/openlp/core/projectors/editform.py +++ b/openlp/core/projectors/editform.py @@ -24,7 +24,7 @@ database. """ import logging -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets from openlp.core.common import verify_ip_address, Singleton from openlp.core.common.i18n import translate diff --git a/openlp/core/projectors/manager.py b/openlp/core/projectors/manager.py index dc2e2aa6b..9f1019e88 100644 --- a/openlp/core/projectors/manager.py +++ b/openlp/core/projectors/manager.py @@ -26,7 +26,7 @@ Provides the functions for the display/control of Projectors. import logging -from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets from openlp.core.common.i18n import translate from openlp.core.common.mixins import LogMixin, RegistryProperties @@ -417,7 +417,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM Builds menu for 'Select Input' option, then calls the selected projector item to change input source. - :param opt: Needed by PyQt5 + :param opt: Needed by PyQt6 """ self.get_settings() # In case the dialog interface setting was changed list_item = self.projector_list_widget.item(self.projector_list_widget.currentRow()) @@ -443,7 +443,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM """ Calls edit dialog to add a new projector to the database - :param opt: Needed by PyQt5 + :param opt: Needed by PyQt6 """ self.projector_form.exec() @@ -490,7 +490,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM """ Deletes a projector from the list and the database - :param opt: Needed by PyQt5 + :param opt: Needed by PyQt6 """ list_item = self.projector_list_widget.item(self.projector_list_widget.currentRow()) if list_item is None: @@ -567,7 +567,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM """ Calls edit dialog with selected projector to edit information - :param opt: Needed by PyQt5 + :param opt: Needed by PyQt6 """ list_item = self.projector_list_widget.item(self.projector_list_widget.currentRow()) projector = list_item.data(QtCore.Qt.UserRole) @@ -621,7 +621,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM """ Builds message box with projector status information - :param opt: Needed by PyQt5 + :param opt: Needed by PyQt6 """ lwi = self.projector_list_widget.item(self.projector_list_widget.currentRow()) projector = lwi.data(QtCore.Qt.UserRole) @@ -701,7 +701,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM """ Calls edit dialog as readonly with selected projector to show information - :param opt: Needed by PyQt5 + :param opt: Needed by PyQt6 """ list_item = self.projector_list_widget.item(self.projector_list_widget.currentRow()) projector = list_item.data(QtCore.Qt.UserRole) @@ -758,7 +758,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM Add a projector from the edit dialog :param ip: IP address of new record item to find - :param opts: Needed by PyQt5 + :param opts: Needed by PyQt6 """ log.debug(f'add_projector_from_wizard(ip={ip})') item = self.projectordb.get_projector_by_ip(ip) @@ -839,7 +839,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM return self.update_icons() def get_toolbar_item(self, name, enabled=False, hidden=False): - item = self.one_toolbar.findChild(QtWidgets.QAction, name) + item = self.one_toolbar.findChild(QtGui.QAction, name) if item == 0: log.debug(f'No item found with name "{name}"') return diff --git a/openlp/core/projectors/pjlink.py b/openlp/core/projectors/pjlink.py index 940315da1..7312895ac 100644 --- a/openlp/core/projectors/pjlink.py +++ b/openlp/core/projectors/pjlink.py @@ -49,7 +49,7 @@ import logging from codecs import decode from copy import copy -from PyQt5 import QtCore, QtNetwork +from PyQt6 import QtCore, QtNetwork from openlp.core.common import qmd5_hash from openlp.core.common.i18n import translate diff --git a/openlp/core/projectors/sourceselectform.py b/openlp/core/projectors/sourceselectform.py index e989501c3..cd14c155a 100644 --- a/openlp/core/projectors/sourceselectform.py +++ b/openlp/core/projectors/sourceselectform.py @@ -25,7 +25,7 @@ Provides the dialog window for selecting video source for projector. """ import logging -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets from openlp.core.common.i18n import translate from openlp.core.common.platform import is_macosx diff --git a/openlp/core/projectors/tab.py b/openlp/core/projectors/tab.py index 4e05a4379..7ae1b71e7 100644 --- a/openlp/core/projectors/tab.py +++ b/openlp/core/projectors/tab.py @@ -23,7 +23,7 @@ The :mod:`openlp.core.ui.projector.tab` module provides the settings tab in the """ import logging -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.registry import Registry diff --git a/openlp/core/server.py b/openlp/core/server.py index 5ddcd6a21..30215d73c 100644 --- a/openlp/core/server.py +++ b/openlp/core/server.py @@ -21,7 +21,7 @@ from pathlib import Path from typing import Optional -from PyQt5 import QtCore, QtNetwork +from PyQt6 import QtCore, QtNetwork from openlp.core.common.mixins import LogMixin from openlp.core.common.registry import Registry diff --git a/openlp/core/threading.py b/openlp/core/threading.py index 04df03050..495f975f2 100644 --- a/openlp/core/threading.py +++ b/openlp/core/threading.py @@ -21,7 +21,7 @@ """ The :mod:`openlp.core.threading` module contains some common threading code """ -from PyQt5 import QtCore +from PyQt6 import QtCore from openlp.core.common.mixins import LogMixin from openlp.core.common.registry import Registry diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 15785e10d..99164739d 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -21,7 +21,7 @@ """ The :mod:`ui` module provides the core user interface for OpenLP """ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets class HideMode(object): diff --git a/openlp/core/ui/aboutdialog.py b/openlp/core/ui/aboutdialog.py index 6a0bd861d..535a3de09 100644 --- a/openlp/core/ui/aboutdialog.py +++ b/openlp/core/ui/aboutdialog.py @@ -20,7 +20,7 @@ ########################################################################## import datetime -from PyQt5 import QtGui, QtWidgets +from PyQt6 import QtGui, QtWidgets from openlp.core.common.i18n import UiStrings, translate from openlp.core.lib.ui import create_button, create_button_box @@ -123,8 +123,8 @@ class UiAboutDialog(object): 'libraries:') build_tech = ('