diff --git a/i18n_update.py b/i18n_update.py index 1f95a228c..8ffd889d9 100755 --- a/i18n_update.py +++ b/i18n_update.py @@ -18,9 +18,9 @@ import os import re +import shutil import subprocess import sys -import shutil from argparse import ArgumentParser from pathlib import Path from typing import Iterable @@ -29,8 +29,8 @@ TS_DIR = Path("lisp/i18n/ts") QM_DIR = Path("lisp/i18n/qm") -PYLUPDATE = "pylupdate5" -LRELEASE = "lrelease" if shutil.which("lrelease") else "lrelease-qt5" +PYLUPDATE = "pylupdate6" +LRELEASE = "lrelease" if shutil.which("lrelease") else "lrelease-qt6" def dirs_path(path: str): diff --git a/lisp/application.py b/lisp/application.py index 70273d525..66a3c9849 100644 --- a/lisp/application.py +++ b/lisp/application.py @@ -19,7 +19,7 @@ import logging from os.path import exists, dirname, abspath, realpath -from PyQt5.QtWidgets import QDialog, qApp +from PyQt6.QtWidgets import QDialog, QApplication from lisp import layout, __version__ as lisp_version from lisp.command.stack import CommandsStack @@ -140,7 +140,7 @@ def __new_session_dialog(self): try: # Prompt the user for a new layout dialog = LayoutSelect(self, parent=self.window) - if dialog.exec() == QDialog.Accepted: + if dialog.exec() == QDialog.DialogCode.Accepted: # If a file is selected load it, otherwise load the layout if dialog.sessionPath: self.__load_from_file(dialog.sessionPath) @@ -150,12 +150,12 @@ def __new_session_dialog(self): if self.__session is None: # If the user close the dialog, and no layout exists # the application is closed - qApp.quit() + QApplication.instance().quit() except Exception: logger.critical( translate("ApplicationError", "Startup error"), exc_info=True ) - qApp.quit() + QApplication.instance().quit() def __new_session(self, layout): self.__delete_session() diff --git a/lisp/core/clock.py b/lisp/core/clock.py index 3b3819092..05612a170 100644 --- a/lisp/core/clock.py +++ b/lisp/core/clock.py @@ -17,7 +17,7 @@ from threading import Lock -from PyQt5.QtCore import QTimer +from PyQt6.QtCore import QTimer class Clock(QTimer): diff --git a/lisp/core/plugins_manager.py b/lisp/core/plugins_manager.py index 1c90f4953..46dd61e90 100644 --- a/lisp/core/plugins_manager.py +++ b/lisp/core/plugins_manager.py @@ -23,9 +23,9 @@ from typing import Dict, Type, Union from lisp import USER_PLUGINS_PATH, app_dirs, PLUGINS_PACKAGE, PLUGINS_PATH -from lisp.core.configuration import JSONFileConfiguration, DummyConfiguration +from lisp.core.configuration import JSONFileConfiguration from lisp.core.loading import load_classes -from lisp.core.plugin import Plugin, PluginNotLoadedError, PluginState +from lisp.core.plugin import Plugin, PluginNotLoadedError from lisp.core.plugin_loader import PluginsLoader from lisp.ui.ui_utils import translate, install_translation diff --git a/lisp/core/qmeta.py b/lisp/core/qmeta.py index c0dc72935..13b1911a4 100644 --- a/lisp/core/qmeta.py +++ b/lisp/core/qmeta.py @@ -17,7 +17,7 @@ from abc import ABCMeta -from PyQt5.QtCore import QObject +from PyQt6.QtCore import QObject class QMeta(type(QObject), type): diff --git a/lisp/core/signal.py b/lisp/core/signal.py index 1b38188e9..8d3c7db53 100644 --- a/lisp/core/signal.py +++ b/lisp/core/signal.py @@ -23,8 +23,8 @@ from threading import RLock from types import MethodType, BuiltinMethodType -from PyQt5.QtCore import QEvent, QObject -from PyQt5.QtWidgets import QApplication +from PyQt6.QtCore import QEvent, QObject +from PyQt6.QtWidgets import QApplication from lisp.core.decorators import async_function from lisp.core.util import weak_call_proxy diff --git a/lisp/core/singleton.py b/lisp/core/singleton.py index e51fd1260..8f654de17 100644 --- a/lisp/core/singleton.py +++ b/lisp/core/singleton.py @@ -17,7 +17,7 @@ from abc import ABCMeta -from PyQt5.QtCore import QObject +from PyQt6.QtCore import QObject from lisp.core.qmeta import QABCMeta diff --git a/lisp/cues/media_cue.py b/lisp/cues/media_cue.py index a3e08c0b7..66061bb6c 100644 --- a/lisp/cues/media_cue.py +++ b/lisp/cues/media_cue.py @@ -17,7 +17,7 @@ from threading import Lock -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.core.decorators import async_function from lisp.core.fade_functions import FadeInType, FadeOutType diff --git a/lisp/layout/cue_layout.py b/lisp/layout/cue_layout.py index e2f0ad6d0..721e7e0d6 100644 --- a/lisp/layout/cue_layout.py +++ b/lisp/layout/cue_layout.py @@ -17,7 +17,7 @@ from abc import abstractmethod -from PyQt5.QtCore import Qt +from PyQt6.QtCore import Qt from lisp.command.cue import UpdateCueCommand, UpdateCuesCommand from lisp.command.model import ModelRemoveItemsCommand @@ -224,7 +224,7 @@ def show_cue_context_menu(self, cues, position): if cues: menu = self.CuesMenu.create_qmenu(cues, self.view) # Avoid "leaking" references kept in the menu - menu.setAttribute(Qt.WA_DeleteOnClose) + menu.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) menu.move(position) menu.show() diff --git a/lisp/layout/cue_menu.py b/lisp/layout/cue_menu.py index e8d611071..e81c992d3 100644 --- a/lisp/layout/cue_menu.py +++ b/lisp/layout/cue_menu.py @@ -17,7 +17,8 @@ from functools import partial -from PyQt5.QtWidgets import QAction, QMenu +from PyQt6.QtGui import QAction +from PyQt6.QtWidgets import QMenu from lisp.core.class_based_registry import ClassBasedRegistry from lisp.core.util import greatest_common_superclass diff --git a/lisp/main.py b/lisp/main.py index c0f74d82a..c51357fe8 100644 --- a/lisp/main.py +++ b/lisp/main.py @@ -23,9 +23,9 @@ from functools import partial from logging.handlers import RotatingFileHandler -from PyQt5.QtCore import QLocale, QLibraryInfo, QTimer -from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QApplication +from PyQt6.QtCore import QLocale, QLibraryInfo, QTimer +from PyQt6.QtGui import QIcon +from PyQt6.QtWidgets import QApplication from lisp import app_dirs, DEFAULT_APP_CONFIG, USER_APP_CONFIG, plugins from lisp.application import Application @@ -124,7 +124,7 @@ def main(): ) # Qt platform translation - qt_tr_path = QLibraryInfo.location(QLibraryInfo.TranslationsPath) + qt_tr_path = QLibraryInfo.path(QLibraryInfo.LibraryPath.TranslationsPath) # install_translation("qt", tr_path=qt_tr_path) install_translation("qtbase", tr_path=qt_tr_path) # Main app translations diff --git a/lisp/plugins/action_cues/collection_cue.py b/lisp/plugins/action_cues/collection_cue.py index 6822639a7..29300c2a2 100644 --- a/lisp/plugins/action_cues/collection_cue.py +++ b/lisp/plugins/action_cues/collection_cue.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt +from PyQt6.QtWidgets import ( QAbstractItemView, QDialog, QDialogButtonBox, @@ -76,7 +76,7 @@ def __init__(self, **kwargs): self.cueDialog = CueSelectDialog( cues=Application().cue_model, - selection_mode=QAbstractItemView.ExtendedSelection, + selection_mode=QAbstractItemView.SelectionMode.ExtendedSelection, ) self.collectionModel = CollectionModel() @@ -94,20 +94,20 @@ def __init__(self, **kwargs): # Buttons self.dialogButtons = QDialogButtonBox(self.collectionGroup) self.dialogButtons.setSizePolicy( - QSizePolicy.Minimum, QSizePolicy.Minimum + QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum ) self.collectionGroup.layout().addWidget(self.dialogButtons) self.addButton = QPushButton(self.dialogButtons) self.dialogButtons.addButton( - self.addButton, QDialogButtonBox.ActionRole + self.addButton, QDialogButtonBox.ButtonRole.ActionRole ) self.addButton.clicked.connect(self._showAddCueDialog) self.delButton = QPushButton(self.dialogButtons) self.delButton.setEnabled(False) self.dialogButtons.addButton( - self.delButton, QDialogButtonBox.ActionRole + self.delButton, QDialogButtonBox.ButtonRole.ActionRole ) self.delButton.clicked.connect(self._removeCurrentCue) @@ -145,7 +145,7 @@ def _addCue(self, cue, action): self.delButton.setEnabled(True) def _showAddCueDialog(self): - if self.cueDialog.exec() == QDialog.Accepted: + if self.cueDialog.exec() == QDialog.DialogCode.Accepted: for target in self.cueDialog.selected_cues(): self._addCue(target, target.CueActions[0]) @@ -165,16 +165,18 @@ class CollectionView(QTableView): def __init__(self, cueModel, cueSelect, **kwargs): super().__init__(**kwargs) - self.setSelectionBehavior(QTableView.SelectRows) - self.setSelectionMode(QTableView.SingleSelection) + self.setSelectionBehavior(QTableView.SelectionBehavior.SelectRows) + self.setSelectionMode(QTableView.SelectionMode.SingleSelection) self.setShowGrid(False) self.setAlternatingRowColors(True) - self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) + self.horizontalHeader().setSectionResizeMode( + QHeaderView.ResizeMode.Stretch + ) self.horizontalHeader().setHighlightSections(False) - self.verticalHeader().sectionResizeMode(QHeaderView.Fixed) + self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Fixed) self.verticalHeader().setDefaultSectionSize(26) self.verticalHeader().setHighlightSections(False) @@ -197,7 +199,7 @@ def __init__(self): ] ) - def setData(self, index, value, role=Qt.DisplayRole): + def setData(self, index, value, role=Qt.ItemDataRole.DisplayRole): result = super().setData(index, value, role) if result and role == CueClassRole: @@ -206,7 +208,7 @@ def setData(self, index, value, role=Qt.DisplayRole): self.dataChanged.emit( self.index(index.row(), 1), self.index(index.row(), 1), - [Qt.DisplayRole, Qt.EditRole], + [Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.EditRole], ) return result diff --git a/lisp/plugins/action_cues/command_cue.py b/lisp/plugins/action_cues/command_cue.py index 2aa2b01a4..d38d8c975 100644 --- a/lisp/plugins/action_cues/command_cue.py +++ b/lisp/plugins/action_cues/command_cue.py @@ -18,8 +18,8 @@ import logging import subprocess -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt -from PyQt5.QtWidgets import QCheckBox, QGroupBox, QLineEdit, QVBoxLayout +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt +from PyQt6.QtWidgets import QCheckBox, QGroupBox, QLineEdit, QVBoxLayout from lisp import RUNNING_IN_FLATPAK from lisp.core.decorators import async_function @@ -128,7 +128,7 @@ class CommandCueSettings(SettingsPage): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.group = QGroupBox(self) self.group.setLayout(QVBoxLayout(self.group)) @@ -179,10 +179,10 @@ def enableCheck(self, enabled): self.runOnHost.setTristate(enabled) if enabled: - self.noOutputCheckBox.setCheckState(Qt.PartiallyChecked) - self.killCheckBox.setCheckState(Qt.PartiallyChecked) - self.killCheckBox.setCheckState(Qt.PartiallyChecked) - self.runOnHost.setChecked(Qt.PartiallyChecked) + self.noOutputCheckBox.setCheckState(Qt.CheckState.PartiallyChecked) + self.killCheckBox.setCheckState(Qt.CheckState.PartiallyChecked) + self.killCheckBox.setCheckState(Qt.CheckState.PartiallyChecked) + self.runOnHost.setChecked(Qt.CheckState.PartiallyChecked) def loadSettings(self, settings): self.commandLineEdit.setText(settings.get("command", "")) @@ -199,13 +199,13 @@ def getSettings(self): and self.commandLineEdit.text().strip() ): settings["command"] = self.commandLineEdit.text() - if self.noOutputCheckBox.checkState() != Qt.PartiallyChecked: + if self.noOutputCheckBox.checkState() != Qt.CheckState.PartiallyChecked: settings["no_output"] = self.noOutputCheckBox.isChecked() - if self.noErrorCheckBox.checkState() != Qt.PartiallyChecked: + if self.noErrorCheckBox.checkState() != Qt.CheckState.PartiallyChecked: settings["no_error"] = self.noErrorCheckBox.isChecked() - if self.killCheckBox.checkState() != Qt.PartiallyChecked: + if self.killCheckBox.checkState() != Qt.CheckState.PartiallyChecked: settings["kill"] = self.killCheckBox.isChecked() - if self.runOnHost.checkState() != Qt.PartiallyChecked: + if self.runOnHost.checkState() != Qt.CheckState.PartiallyChecked: settings["run_on_host"] = self.runOnHost.isChecked() return settings diff --git a/lisp/plugins/action_cues/index_action_cue.py b/lisp/plugins/action_cues/index_action_cue.py index d25ae2ac4..fead5bb9d 100644 --- a/lisp/plugins/action_cues/index_action_cue.py +++ b/lisp/plugins/action_cues/index_action_cue.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import ( QCheckBox, QGroupBox, QLabel, @@ -78,7 +78,7 @@ class IndexActionCueSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self._cue_index = 0 self._target_class = Cue @@ -97,7 +97,7 @@ def __init__(self, **kwargs): self.indexGroup.layout().addWidget(self.targetIndexSpin, 1, 0) self.targetIndexLabel = QLabel(self) - self.targetIndexLabel.setAlignment(Qt.AlignCenter) + self.targetIndexLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.indexGroup.layout().addWidget(self.targetIndexLabel, 1, 1) self.actionGroup = QGroupBox(self) @@ -116,7 +116,7 @@ def __init__(self, **kwargs): self.layout().addWidget(self.suggestionGroup) self.suggestionPreview = QLineEdit(self.suggestionGroup) - self.suggestionPreview.setAlignment(Qt.AlignCenter) + self.suggestionPreview.setAlignment(Qt.AlignmentFlag.AlignCenter) self.suggestionPreview.setText( IndexActionCueSettings.DEFAULT_SUGGESTION ) diff --git a/lisp/plugins/action_cues/seek_cue.py b/lisp/plugins/action_cues/seek_cue.py index a95ba65b0..2f873413c 100644 --- a/lisp/plugins/action_cues/seek_cue.py +++ b/lisp/plugins/action_cues/seek_cue.py @@ -15,9 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5 import QtCore -from PyQt5.QtCore import QT_TRANSLATE_NOOP, QTime -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP, QTime, Qt +from PyQt6.QtWidgets import ( QGroupBox, QHBoxLayout, QLabel, @@ -71,7 +70,7 @@ class SeekCueSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(QtCore.Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.targetCueId = -1 @@ -88,7 +87,7 @@ def __init__(self, **kwargs): self.cueGroup.layout().addWidget(self.cueButton) self.cueLabel = QLabel(self.cueGroup) - self.cueLabel.setAlignment(QtCore.Qt.AlignCenter) + self.cueLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.cueGroup.layout().addWidget(self.cueLabel) self.seekGroup = QGroupBox(self) @@ -97,11 +96,11 @@ def __init__(self, **kwargs): self.seekEdit = QTimeEdit(self.seekGroup) self.seekEdit.setDisplayFormat("HH:mm:ss.zzz") - self.seekEdit.setCurrentSection(QDateTimeEdit.SecondSection) + self.seekEdit.setCurrentSection(QDateTimeEdit.Section.SecondSection) self.seekGroup.layout().addWidget(self.seekEdit) self.seekLabel = QLabel(self.seekGroup) - self.seekLabel.setAlignment(QtCore.Qt.AlignCenter) + self.seekLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.seekGroup.layout().addWidget(self.seekLabel) self.retranslateUi() @@ -114,7 +113,7 @@ def retranslateUi(self): self.seekLabel.setText(translate("SeekCue", "Time to reach")) def select_cue(self): - if self.cueDialog.exec() == self.cueDialog.Accepted: + if self.cueDialog.exec() == CueSelectDialog.DialogCode.Accepted: cue = self.cueDialog.selected_cue() if cue is not None: diff --git a/lisp/plugins/action_cues/stop_all.py b/lisp/plugins/action_cues/stop_all.py index baa79fff9..147ef2fe9 100644 --- a/lisp/plugins/action_cues/stop_all.py +++ b/lisp/plugins/action_cues/stop_all.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt -from PyQt5.QtWidgets import QComboBox, QGroupBox, QVBoxLayout +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt +from PyQt6.QtWidgets import QComboBox, QGroupBox, QVBoxLayout from lisp.core.properties import Property from lisp.cues.cue import Cue, CueAction @@ -63,7 +63,7 @@ class StopAllSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.group = QGroupBox(self) self.group.setLayout(QVBoxLayout(self.group)) diff --git a/lisp/plugins/action_cues/volume_control.py b/lisp/plugins/action_cues/volume_control.py index cbde53fd8..2f970058a 100644 --- a/lisp/plugins/action_cues/volume_control.py +++ b/lisp/plugins/action_cues/volume_control.py @@ -17,8 +17,8 @@ import logging -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt +from PyQt6.QtWidgets import ( QDoubleSpinBox, QGroupBox, QHBoxLayout, @@ -134,7 +134,7 @@ class VolumeSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.__v_edit_flag = False self.cue_id = -1 @@ -147,7 +147,7 @@ def __init__(self, **kwargs): self.layout().addWidget(self.cueGroup) self.cueLabel = QLabel(self.cueGroup) - self.cueLabel.setAlignment(Qt.AlignCenter) + self.cueLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.cueLabel.setStyleSheet("font-weight: bold;") self.cueGroup.layout().addWidget(self.cueLabel) @@ -194,7 +194,7 @@ def retranslateUi(self): self.fadeGroup.setTitle(translate("VolumeControl", "Fade")) def select_cue(self): - if self.cueDialog.exec() == self.cueDialog.Accepted: + if self.cueDialog.exec() == CueSelectDialog.DialogCode.Accepted: cue = self.cueDialog.selected_cue() if cue is not None: diff --git a/lisp/plugins/cache_manager/cache_manager.py b/lisp/plugins/cache_manager/cache_manager.py index 1e9685689..ad6fb317b 100644 --- a/lisp/plugins/cache_manager/cache_manager.py +++ b/lisp/plugins/cache_manager/cache_manager.py @@ -3,8 +3,8 @@ from threading import Thread import humanize -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt +from PyQt6.QtWidgets import ( QVBoxLayout, QGroupBox, QPushButton, @@ -101,7 +101,7 @@ class CacheManagerSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.warningGroup = QGroupBox(self) self.warningGroup.setLayout(QHBoxLayout()) @@ -122,7 +122,7 @@ def __init__(self, **kwargs): self.layout().addWidget(self.cleanGroup) self.currentSizeLabel = QLabel(self.cleanGroup) - self.currentSizeLabel.setAlignment(Qt.AlignCenter) + self.currentSizeLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.cleanGroup.layout().addWidget(self.currentSizeLabel) self.cleanButton = QPushButton(self) diff --git a/lisp/plugins/cart_layout/cue_widget.py b/lisp/plugins/cart_layout/cue_widget.py index d654a0f7b..6b2fc1bdc 100644 --- a/lisp/plugins/cart_layout/cue_widget.py +++ b/lisp/plugins/cart_layout/cue_widget.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QMimeData, pyqtSignal, QPoint -from PyQt5.QtGui import QColor, QDrag -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QMimeData, pyqtSignal, QPoint +from PyQt6.QtGui import QColor, QDrag +from PyQt6.QtWidgets import ( QProgressBar, QLCDNumber, QLabel, @@ -60,7 +60,7 @@ def __init__(self, cue, **kwargs): self._volumeElement = None self._fadeElement = None - self.setAttribute(Qt.WA_TranslucentBackground) + self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) self.setLayout(QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) @@ -74,11 +74,11 @@ def __init__(self, cue, **kwargs): self.nameButton = QClickLabel(self) self.nameButton.setObjectName("ButtonCueWidget") self.nameButton.setWordWrap(True) - self.nameButton.setAlignment(Qt.AlignCenter) - self.nameButton.setFocusPolicy(Qt.NoFocus) + self.nameButton.setAlignment(Qt.AlignmentFlag.AlignCenter) + self.nameButton.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.nameButton.clicked.connect(self._clicked) self.nameButton.setSizePolicy( - QSizePolicy.Ignored, QSizePolicy.Preferred + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Preferred ) self.hLayout.addWidget(self.nameButton, 5) @@ -89,23 +89,25 @@ def __init__(self, cue, **kwargs): ) self.seekSlider = QClickSlider(self.nameButton) - self.seekSlider.setOrientation(Qt.Horizontal) - self.seekSlider.setFocusPolicy(Qt.NoFocus) + self.seekSlider.setOrientation(Qt.Orientation.Horizontal) + self.seekSlider.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.seekSlider.setVisible(False) self.volumeSlider = QClickSlider(self.nameButton) self.volumeSlider.setObjectName("VolumeSlider") - self.volumeSlider.setOrientation(Qt.Vertical) - self.volumeSlider.setFocusPolicy(Qt.NoFocus) + self.volumeSlider.setOrientation(Qt.Orientation.Vertical) + self.volumeSlider.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.volumeSlider.setRange(0, CueWidget.SLIDER_RANGE) self.volumeSlider.setPageStep(10) self.volumeSlider.valueChanged.connect( - self._changeVolume, Qt.DirectConnection + self._changeVolume, Qt.ConnectionType.DirectConnection ) self.volumeSlider.setVisible(False) self.dbMeter = QDigitalMeter(self) - self.dbMeter.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) + self.dbMeter.setSizePolicy( + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Ignored + ) self.dbMeter.setVisible(False) self.timeBar = QProgressBar(self) @@ -114,11 +116,13 @@ def __init__(self, cue, **kwargs): self.timeBar.layout().setContentsMargins(0, 0, 0, 0) self.timeDisplay = QLCDNumber(self.timeBar) self.timeDisplay.setStyleSheet("background-color: transparent") - self.timeDisplay.setSegmentStyle(QLCDNumber.Flat) + self.timeDisplay.setSegmentStyle(QLCDNumber.SegmentStyle.Flat) self.timeDisplay.setDigitCount(8) self.timeDisplay.display("00:00:00") self.timeBar.layout().addWidget(self.timeDisplay) - self.timeBar.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Fixed) + self.timeBar.setSizePolicy( + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Fixed + ) self.timeBar.setVisible(False) self._setCue(cue) @@ -143,9 +147,9 @@ def contextMenuEvent(self, event): self.contextMenuRequested.emit(event.globalPos()) def mouseMoveEvent(self, event): - if event.buttons() == Qt.LeftButton and ( - event.modifiers() == Qt.ControlModifier - or event.modifiers() == Qt.ShiftModifier + if event.buttons() == Qt.MouseButton.LeftButton and ( + event.modifiers() == Qt.KeyboardModifier.ControlModifier + or event.modifiers() == Qt.KeyboardModifier.ShiftModifier ): mime_data = QMimeData() mime_data.setText(CartPageWidget.DRAG_MAGIC) @@ -154,10 +158,10 @@ def mouseMoveEvent(self, event): drag.setMimeData(mime_data) drag.setPixmap(self.grab(self.rect())) - if event.modifiers() == Qt.ControlModifier: - drag.exec_(Qt.CopyAction) + if event.modifiers() == Qt.KeyboardModifier.ControlModifier: + drag.exec(Qt.DropAction.CopyAction) else: - drag.exec_(Qt.MoveAction) + drag.exec(Qt.DropAction.MoveAction) def setCountdownMode(self, mode): self._countdownMode = mode @@ -306,10 +310,10 @@ def _clicked(self, event): self.seekSlider.geometry().contains(event.pos()) and self.seekSlider.isVisible() ): - if event.button() != Qt.RightButton: - if event.modifiers() == Qt.ShiftModifier: + if event.button() != Qt.MouseButton.RightButton: + if event.modifiers() == Qt.KeyboardModifier.ShiftModifier: self.editRequested.emit(self._cue) - elif event.modifiers() == Qt.ControlModifier: + elif event.modifiers() == Qt.KeyboardModifier.ControlModifier: self.selected = not self.selected else: self._cue.execute() diff --git a/lisp/plugins/cart_layout/layout.py b/lisp/plugins/cart_layout/layout.py index aa793f263..f2246e920 100644 --- a/lisp/plugins/cart_layout/layout.py +++ b/lisp/plugins/cart_layout/layout.py @@ -17,8 +17,9 @@ import re -from PyQt5.QtCore import QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import QAction, QInputDialog, QMessageBox +from PyQt6.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtGui import QAction +from PyQt6.QtWidgets import QInputDialog, QMessageBox from lisp.command.model import ModelInsertItemsCommand, ModelMoveItemCommand from lisp.core.configuration import DummyConfiguration @@ -264,7 +265,7 @@ def remove_current_page(self): if self._cart_view.count(): confirm = RemovePageConfirmBox(self._cart_view) - if confirm.exec() == QMessageBox.Yes: + if confirm.exec() == QMessageBox.StandardButton.Yes: self.remove_page(self._cart_view.currentIndex()) def remove_page(self, index): @@ -487,7 +488,7 @@ class RemovePageConfirmBox(QMessageBox): def __init__(self, *args): super().__init__(*args) - self.setIcon(self.Question) + self.setIcon(self.Icon.Question) self.setWindowTitle(translate("CartLayout", "Warning")) self.setText( translate("CartLayout", "Every cue in the page will be lost.") @@ -496,5 +497,7 @@ def __init__(self, *args): translate("CartLayout", "Are you sure to continue?") ) - self.setStandardButtons(QMessageBox.Yes | QMessageBox.No) - self.setDefaultButton(QMessageBox.No) + self.setStandardButtons( + QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No + ) + self.setDefaultButton(QMessageBox.StandardButton.No) diff --git a/lisp/plugins/cart_layout/page_widget.py b/lisp/plugins/cart_layout/page_widget.py index 1b7e46fd7..e7803b60e 100644 --- a/lisp/plugins/cart_layout/page_widget.py +++ b/lisp/plugins/cart_layout/page_widget.py @@ -17,8 +17,8 @@ import math -from PyQt5.QtCore import pyqtSignal, Qt, QPoint -from PyQt5.QtWidgets import QWidget, QGridLayout, QSizePolicy +from PyQt6.QtCore import pyqtSignal, Qt, QPoint +from PyQt6.QtWidgets import QWidget, QGridLayout, QSizePolicy from sortedcontainers import SortedDict from lisp.backend import get_backend @@ -54,7 +54,9 @@ def initLayout(self): def addWidget(self, widget, row, column): self._checkIndex(row, column) if (row, column) not in self.__widgets: - widget.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) + widget.setSizePolicy( + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Ignored + ) self.__widgets[(row, column)] = widget self.layout().addWidget(widget, row, column) widget.show() @@ -114,9 +116,9 @@ def dropEvent(self, event): row, column = self.indexAt(event.pos()) if self.layout().itemAtPosition(row, column) is None: - if event.proposedAction() == Qt.MoveAction: + if event.proposedAction() == Qt.DropAction.MoveAction: self.moveWidgetRequested.emit(event.source(), row, column) - elif event.proposedAction() == Qt.CopyAction: + elif event.proposedAction() == Qt.DropAction.CopyAction: self.copyWidgetRequested.emit(event.source(), row, column) def indexAt(self, pos): diff --git a/lisp/plugins/cart_layout/settings.py b/lisp/plugins/cart_layout/settings.py index e6fc3feae..793aee4e1 100644 --- a/lisp/plugins/cart_layout/settings.py +++ b/lisp/plugins/cart_layout/settings.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import ( QGroupBox, QVBoxLayout, QCheckBox, @@ -35,7 +35,7 @@ class CartLayoutSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.behaviorsGroup = QGroupBox(self) self.behaviorsGroup.setLayout(QVBoxLayout()) diff --git a/lisp/plugins/cart_layout/tab_widget.py b/lisp/plugins/cart_layout/tab_widget.py index b706aa239..34ec12c43 100644 --- a/lisp/plugins/cart_layout/tab_widget.py +++ b/lisp/plugins/cart_layout/tab_widget.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, pyqtSignal -from PyQt5.QtGui import QKeyEvent -from PyQt5.QtWidgets import QTabWidget +from PyQt6.QtCore import Qt, pyqtSignal +from PyQt6.QtGui import QKeyEvent +from PyQt6.QtWidgets import QTabWidget from lisp.ui.widgets.qeditabletabbar import QEditableTabBar @@ -33,7 +33,7 @@ def __init__(self, **kwargs): self.tabBar().setDrawBase(False) self.tabBar().setObjectName("CartTabBar") - self.setFocusPolicy(Qt.StrongFocus) + self.setFocusPolicy(Qt.FocusPolicy.StrongFocus) self.setAcceptDrops(True) def dragEnterEvent(self, event): diff --git a/lisp/plugins/controller/common.py b/lisp/plugins/controller/common.py index 7f7a09eff..2ac31886a 100644 --- a/lisp/plugins/controller/common.py +++ b/lisp/plugins/controller/common.py @@ -17,7 +17,7 @@ from enum import Enum -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.ui.ui_utils import translate diff --git a/lisp/plugins/controller/controller_settings.py b/lisp/plugins/controller/controller_settings.py index 16be655e4..f46d5b775 100644 --- a/lisp/plugins/controller/controller_settings.py +++ b/lisp/plugins/controller/controller_settings.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.plugins.controller import protocols from lisp.ui.settings.pages import SettingsPagesTabWidget, CuePageMixin diff --git a/lisp/plugins/controller/protocols/keyboard.py b/lisp/plugins/controller/protocols/keyboard.py index 74013e64e..1cc41d9b0 100644 --- a/lisp/plugins/controller/protocols/keyboard.py +++ b/lisp/plugins/controller/protocols/keyboard.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtGui import QKeySequence -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtGui import QKeySequence +from PyQt6.QtWidgets import ( QGroupBox, QGridLayout, QTableView, @@ -36,8 +36,7 @@ ) from lisp.ui.qmodels import SimpleTableModel from lisp.ui.settings.pages import SettingsPage, CuePageMixin -from lisp.ui.ui_utils import translate -from lisp.ui.widgets.hotkeyedit import keyEventKeySequence +from lisp.ui.ui_utils import translate, key_sequence_from_event class KeyboardSettings(SettingsPage): @@ -46,7 +45,7 @@ class KeyboardSettings(SettingsPage): def __init__(self, actionDelegate, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.keyGroup = QGroupBox(self) self.keyGroup.setLayout(QGridLayout()) @@ -125,16 +124,19 @@ class KeyboardView(QTableView): def __init__(self, actionDelegate, **kwargs): super().__init__(**kwargs) - self.setSelectionBehavior(QTableView.SelectRows) - self.setSelectionMode(QTableView.SingleSelection) + self.setSelectionBehavior(QTableView.SelectionBehavior.SelectRows) + self.setSelectionMode(QTableView.SelectionMode.SingleSelection) self.setShowGrid(False) self.setAlternatingRowColors(True) - self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) + self.horizontalHeader().setSectionResizeMode( + QHeaderView.ResizeMode.Stretch + ) + self.horizontalHeader().setStretchLastSection(True) self.horizontalHeader().setHighlightSections(False) - self.verticalHeader().sectionResizeMode(QHeaderView.Fixed) + self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Fixed) self.verticalHeader().setDefaultSectionSize(24) self.verticalHeader().setHighlightSections(False) @@ -156,8 +158,8 @@ def reset(self): def __key_pressed(self, key_event): if not key_event.isAutoRepeat(): - sequence = keyEventKeySequence(key_event) + sequence = key_sequence_from_event(key_event) if sequence: self.protocol_event.emit( - sequence.toString(QKeySequence.PortableText) + sequence.toString(QKeySequence.SequenceFormat.PortableText) ) diff --git a/lisp/plugins/controller/protocols/midi.py b/lisp/plugins/controller/protocols/midi.py index e5cb280df..92dd7c833 100644 --- a/lisp/plugins/controller/protocols/midi.py +++ b/lisp/plugins/controller/protocols/midi.py @@ -16,8 +16,8 @@ # along with Linux Show Player. If not, see . import logging -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import ( QGroupBox, QPushButton, QComboBox, @@ -31,8 +31,8 @@ QHBoxLayout, ) -from lisp.plugins import get_plugin from lisp.core.plugin import PluginNotLoadedError +from lisp.plugins import get_plugin from lisp.plugins.controller.common import LayoutAction, tr_layout_action from lisp.plugins.controller.protocol import Protocol from lisp.plugins.midi.midi_utils import ( @@ -54,7 +54,6 @@ from lisp.ui.settings.pages import CuePageMixin, SettingsPage from lisp.ui.ui_utils import translate - logger = logging.getLogger(__name__) @@ -66,7 +65,7 @@ class MidiSettings(SettingsPage): def __init__(self, actionDelegate, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.midiGroup = QGroupBox(self) self.midiGroup.setTitle(translate("ControllerMidiSettings", "MIDI")) @@ -95,7 +94,7 @@ def __init__(self, actionDelegate, **kwargs): self.midiGroup.layout().addLayout(self.filterLayout, 2, 1) self.filterLabel = QLabel(self.midiGroup) - self.filterLabel.setAlignment(Qt.AlignCenter) + self.filterLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.filterLayout.addWidget(self.filterLabel) self.filterTypeCombo = QComboBox(self.midiGroup) @@ -166,7 +165,7 @@ def capture_message(self): handler.alternate_mode = False def __add_message(self, message): - mgs_filter = self.filterTypeCombo.currentData(Qt.UserRole) + mgs_filter = self.filterTypeCombo.currentData(Qt.ItemDataRole.UserRole) if mgs_filter == self.FILTER_ALL or message.type == mgs_filter: if hasattr(message, "velocity"): message = message.copy(velocity=0) @@ -175,7 +174,7 @@ def __add_message(self, message): def __new_message(self): dialog = MIDIMessageEditDialog() - if dialog.exec() == MIDIMessageEditDialog.Accepted: + if dialog.exec() == MIDIMessageEditDialog.DialogCode.Accepted: message = midi_from_dict(dialog.getMessageDict()) if hasattr(message, "velocity"): message.velocity = 0 @@ -221,7 +220,7 @@ def _text(self, option, index): class MidiValueDelegate(LabelDelegate): def _text(self, option, index): - option.displayAlignment = Qt.AlignCenter + option.displayAlignment = Qt.AlignmentFlag.AlignCenter value = index.data() if value is not None: @@ -270,7 +269,7 @@ def getMessage(self, row): def flags(self, index): if index.column() <= 3: - return Qt.ItemIsEnabled | Qt.ItemIsSelectable + return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable else: return super().flags(index) @@ -287,20 +286,20 @@ def __init__(self, actionDelegate, **kwargs): actionDelegate, ] - self.setSelectionBehavior(QTableWidget.SelectRows) - self.setSelectionMode(QTableView.SingleSelection) + self.setSelectionBehavior(QTableWidget.SelectionBehavior.SelectRows) + self.setSelectionMode(QTableView.SelectionMode.SingleSelection) self.setShowGrid(False) self.setAlternatingRowColors(True) self.horizontalHeader().setSectionResizeMode( - QHeaderView.ResizeToContents + QHeaderView.ResizeMode.ResizeToContents ) self.horizontalHeader().setMinimumSectionSize(80) self.horizontalHeader().setStretchLastSection(True) self.horizontalHeader().setHighlightSections(False) - self.verticalHeader().sectionResizeMode(QHeaderView.Fixed) + self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Fixed) self.verticalHeader().setDefaultSectionSize(24) self.verticalHeader().setHighlightSections(False) @@ -316,7 +315,7 @@ def __doubleClicked(self, index): dialog = MIDIMessageEditDialog() dialog.setMessageDict(message.dict()) - if dialog.exec() == MIDIMessageEditDialog.Accepted: + if dialog.exec() == MIDIMessageEditDialog.DialogCode.Accepted: self.model().updateMessage( index.row(), midi_from_dict(dialog.getMessageDict()), action ) diff --git a/lisp/plugins/controller/protocols/osc.py b/lisp/plugins/controller/protocols/osc.py index 383f0227d..3c0b2e898 100644 --- a/lisp/plugins/controller/protocols/osc.py +++ b/lisp/plugins/controller/protocols/osc.py @@ -20,8 +20,8 @@ import ast import logging -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import ( QGroupBox, QPushButton, QVBoxLayout, @@ -89,8 +89,8 @@ def __init__(self, **kwargs): self.layout().addItem(QSpacerItem(0, 20), 4, 0, 1, 2) self.buttons = QDialogButtonBox(self) - self.buttons.addButton(QDialogButtonBox.Cancel) - self.buttons.addButton(QDialogButtonBox.Ok) + self.buttons.addButton(QDialogButtonBox.StandardButton.Cancel) + self.buttons.addButton(QDialogButtonBox.StandardButton.Ok) self.layout().addWidget(self.buttons, 5, 0, 1, 2) self.buttons.accepted.connect(self.accept) @@ -175,7 +175,7 @@ def __removeArgument(self): def __argumentChanged(self, topLeft, bottomRight, roles): # If the "Type" column has changed - if Qt.EditRole in roles and bottomRight.column() == 0: + if Qt.ItemDataRole.EditRole in roles and bottomRight.column() == 0: # Get the edited row row = self.model.rows[topLeft.row()] oscType = row[0] @@ -209,16 +209,19 @@ def __init__(self, **kwargs): OscArgumentDelegate(), ] - self.setSelectionBehavior(QTableWidget.SelectRows) - self.setSelectionMode(QTableView.SingleSelection) + self.setSelectionBehavior(QTableWidget.SelectionBehavior.SelectRows) + self.setSelectionMode(QTableView.SelectionMode.SingleSelection) self.setShowGrid(False) self.setAlternatingRowColors(True) - self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) + self.horizontalHeader().setSectionResizeMode( + QHeaderView.ResizeMode.Stretch + ) + self.horizontalHeader().setStretchLastSection(True) self.horizontalHeader().setHighlightSections(False) - self.verticalHeader().sectionResizeMode(QHeaderView.Fixed) + self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Fixed) self.verticalHeader().setDefaultSectionSize(24) self.verticalHeader().setHighlightSections(False) @@ -232,7 +235,7 @@ class OscSettings(SettingsPage): def __init__(self, actionDelegate, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.oscGroup = QGroupBox(self) self.oscGroup.setTitle(translate("ControllerOscSettings", "OSC")) @@ -257,7 +260,7 @@ def __init__(self, actionDelegate, **kwargs): self.oscCapture.clicked.connect(self.capture_message) self.oscGroup.layout().addWidget(self.oscCapture, 2, 0) - self.captureDialog = QDialog(self, flags=Qt.Dialog) + self.captureDialog = QDialog(self, flags=Qt.WindowType.Dialog) self.captureDialog.resize(300, 150) self.captureDialog.setMaximumSize(self.captureDialog.size()) self.captureDialog.setMinimumSize(self.captureDialog.size()) @@ -266,13 +269,14 @@ def __init__(self, actionDelegate, **kwargs): ) self.captureDialog.setModal(True) self.captureLabel = QLabel("Waiting for message:") - self.captureLabel.setAlignment(Qt.AlignCenter) + self.captureLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.captureDialog.setLayout(QVBoxLayout()) self.captureDialog.layout().addWidget(self.captureLabel) self.buttonBox = QDialogButtonBox( - QDialogButtonBox.Ok | QDialogButtonBox.Cancel, - Qt.Horizontal, + QDialogButtonBox.StandardButton.Ok + | QDialogButtonBox.StandardButton.Cancel, + Qt.Orientation.Horizontal, self.captureDialog, ) self.buttonBox.accepted.connect(self.captureDialog.accept) @@ -325,7 +329,10 @@ def capture_message(self): self.__osc.server.new_message.connect(self.__show_message) result = self.captureDialog.exec() - if result == QDialog.Accepted and self.capturedMessage["path"]: + if ( + result == QDialog.DialogCode.Accepted + and self.capturedMessage["path"] + ): args = str(self.capturedMessage["args"])[1:-1] self.oscModel.appendRow( self.capturedMessage["path"], @@ -407,16 +414,19 @@ def __init__(self, actionDelegate, **kwargs): actionDelegate, ] - self.setSelectionBehavior(QTableWidget.SelectRows) - self.setSelectionMode(QTableView.SingleSelection) + self.setSelectionBehavior(QTableWidget.SelectionBehavior.SelectRows) + self.setSelectionMode(QTableView.SelectionMode.SingleSelection) self.setShowGrid(False) self.setAlternatingRowColors(True) - self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) + self.horizontalHeader().setSectionResizeMode( + QHeaderView.ResizeMode.Stretch + ) + self.horizontalHeader().setStretchLastSection(True) self.horizontalHeader().setHighlightSections(False) - self.verticalHeader().sectionResizeMode(QHeaderView.Fixed) + self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Fixed) self.verticalHeader().setDefaultSectionSize(24) self.verticalHeader().setHighlightSections(False) @@ -431,7 +441,7 @@ def __doubleClicked(self, index): dialog = OscMessageDialog() dialog.setMessage(row[0], row[1], row[2]) - if dialog.exec() == dialog.Accepted: + if dialog.exec() == OscMessageDialog.DialogCode.Accepted: path, types, arguments = dialog.getMessage() self.model().updateRow( index.row(), path, types, arguments, row[3] @@ -451,7 +461,7 @@ def __init__(self): def flags(self, index): if index.column() <= 2: - return Qt.ItemIsEnabled | Qt.ItemIsSelectable + return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable return super().flags(index) diff --git a/lisp/plugins/gst_backend/config/alsa_sink.py b/lisp/plugins/gst_backend/config/alsa_sink.py index d8039bbec..5c62473a3 100644 --- a/lisp/plugins/gst_backend/config/alsa_sink.py +++ b/lisp/plugins/gst_backend/config/alsa_sink.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.plugins.gst_backend.elements.alsa_sink import AlsaSink from lisp.plugins.gst_backend.settings.alsa_sink import AlsaSinkSettings diff --git a/lisp/plugins/gst_backend/elements/alsa_sink.py b/lisp/plugins/gst_backend/elements/alsa_sink.py index c1664867c..e63d01fb1 100644 --- a/lisp/plugins/gst_backend/elements/alsa_sink.py +++ b/lisp/plugins/gst_backend/elements/alsa_sink.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.plugins.gst_backend import GstBackend diff --git a/lisp/plugins/gst_backend/elements/audio_dynamic.py b/lisp/plugins/gst_backend/elements/audio_dynamic.py index 5652ffeb0..2071ebb01 100644 --- a/lisp/plugins/gst_backend/elements/audio_dynamic.py +++ b/lisp/plugins/gst_backend/elements/audio_dynamic.py @@ -17,7 +17,7 @@ from enum import Enum -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.plugins.gst_backend.gi_repository import Gst diff --git a/lisp/plugins/gst_backend/elements/audio_pan.py b/lisp/plugins/gst_backend/elements/audio_pan.py index 0698f1487..4b21e3f02 100644 --- a/lisp/plugins/gst_backend/elements/audio_pan.py +++ b/lisp/plugins/gst_backend/elements/audio_pan.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.plugins.gst_backend.gi_repository import Gst diff --git a/lisp/plugins/gst_backend/elements/auto_sink.py b/lisp/plugins/gst_backend/elements/auto_sink.py index 27b3fb35b..435293a4a 100644 --- a/lisp/plugins/gst_backend/elements/auto_sink.py +++ b/lisp/plugins/gst_backend/elements/auto_sink.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.plugins.gst_backend.gi_repository import Gst diff --git a/lisp/plugins/gst_backend/elements/auto_src.py b/lisp/plugins/gst_backend/elements/auto_src.py index 88b7473a1..83c7d0d04 100644 --- a/lisp/plugins/gst_backend/elements/auto_src.py +++ b/lisp/plugins/gst_backend/elements/auto_src.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import MediaType from lisp.plugins.gst_backend.gi_repository import Gst diff --git a/lisp/plugins/gst_backend/elements/db_meter.py b/lisp/plugins/gst_backend/elements/db_meter.py index 9a334c430..f5a4b17ea 100644 --- a/lisp/plugins/gst_backend/elements/db_meter.py +++ b/lisp/plugins/gst_backend/elements/db_meter.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.core.signal import Signal diff --git a/lisp/plugins/gst_backend/elements/equalizer10.py b/lisp/plugins/gst_backend/elements/equalizer10.py index 6dc4d3324..f06f8e1b1 100644 --- a/lisp/plugins/gst_backend/elements/equalizer10.py +++ b/lisp/plugins/gst_backend/elements/equalizer10.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.plugins.gst_backend.gi_repository import Gst diff --git a/lisp/plugins/gst_backend/elements/jack_sink.py b/lisp/plugins/gst_backend/elements/jack_sink.py index 2d96ec4a1..0c12a431e 100644 --- a/lisp/plugins/gst_backend/elements/jack_sink.py +++ b/lisp/plugins/gst_backend/elements/jack_sink.py @@ -18,7 +18,7 @@ import logging import jack -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.core.properties import Property diff --git a/lisp/plugins/gst_backend/elements/pitch.py b/lisp/plugins/gst_backend/elements/pitch.py index c629b690a..b8f051ee5 100644 --- a/lisp/plugins/gst_backend/elements/pitch.py +++ b/lisp/plugins/gst_backend/elements/pitch.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.plugins.gst_backend.gi_repository import Gst diff --git a/lisp/plugins/gst_backend/elements/preset_src.py b/lisp/plugins/gst_backend/elements/preset_src.py index 6dd007761..a8c90cfed 100644 --- a/lisp/plugins/gst_backend/elements/preset_src.py +++ b/lisp/plugins/gst_backend/elements/preset_src.py @@ -17,7 +17,7 @@ import math -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import MediaType from lisp.core.properties import Property diff --git a/lisp/plugins/gst_backend/elements/pulse_sink.py b/lisp/plugins/gst_backend/elements/pulse_sink.py index acaf3ecec..be4d8c1ca 100644 --- a/lisp/plugins/gst_backend/elements/pulse_sink.py +++ b/lisp/plugins/gst_backend/elements/pulse_sink.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.plugins.gst_backend.gi_repository import Gst diff --git a/lisp/plugins/gst_backend/elements/speed.py b/lisp/plugins/gst_backend/elements/speed.py index 815511d19..6a05ccd0c 100644 --- a/lisp/plugins/gst_backend/elements/speed.py +++ b/lisp/plugins/gst_backend/elements/speed.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.core.properties import Property diff --git a/lisp/plugins/gst_backend/elements/uri_input.py b/lisp/plugins/gst_backend/elements/uri_input.py index e51851e34..ca239fd71 100644 --- a/lisp/plugins/gst_backend/elements/uri_input.py +++ b/lisp/plugins/gst_backend/elements/uri_input.py @@ -18,7 +18,7 @@ from concurrent.futures import ThreadPoolExecutor from pathlib import Path -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import MediaType from lisp.core.decorators import async_in_pool diff --git a/lisp/plugins/gst_backend/elements/user_element.py b/lisp/plugins/gst_backend/elements/user_element.py index d869a7301..ff0bbb89f 100644 --- a/lisp/plugins/gst_backend/elements/user_element.py +++ b/lisp/plugins/gst_backend/elements/user_element.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.core.properties import Property diff --git a/lisp/plugins/gst_backend/elements/volume.py b/lisp/plugins/gst_backend/elements/volume.py index 5082e72f5..5b04d14cf 100644 --- a/lisp/plugins/gst_backend/elements/volume.py +++ b/lisp/plugins/gst_backend/elements/volume.py @@ -17,7 +17,7 @@ from typing import Optional -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.backend.media_element import ElementType, MediaType from lisp.plugins.gst_backend.gi_repository import Gst, GstController diff --git a/lisp/plugins/gst_backend/gst_backend.py b/lisp/plugins/gst_backend/gst_backend.py index 111692f98..a7d2146f9 100644 --- a/lisp/plugins/gst_backend/gst_backend.py +++ b/lisp/plugins/gst_backend/gst_backend.py @@ -17,9 +17,9 @@ import os.path -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtGui import QCursor -from PyQt5.QtWidgets import QFileDialog, QApplication +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtGui import QCursor +from PyQt6.QtWidgets import QFileDialog, QApplication from lisp import backend from lisp.backend.backend import Backend as BaseBackend @@ -155,7 +155,7 @@ def add_cue_from_urls(self, urls): self.add_cue_from_files(files) def add_cue_from_files(self, files): - QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) + QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor)) # Create media cues, and add them to the Application cue_model factory = UriAudioCueFactory(GstBackend.Config["pipeline"]) diff --git a/lisp/plugins/gst_backend/gst_media_settings.py b/lisp/plugins/gst_backend/gst_media_settings.py index 0c06f0a77..c9465b979 100644 --- a/lisp/plugins/gst_backend/gst_media_settings.py +++ b/lisp/plugins/gst_backend/gst_media_settings.py @@ -17,8 +17,8 @@ from copy import deepcopy -from PyQt5.QtCore import QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import ( QGridLayout, QListWidget, QPushButton, @@ -70,7 +70,9 @@ def loadSettings(self, settings): if page is not None and issubclass(page, SettingsPage): page = page(parent=self) - page.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) + page.setSizePolicy( + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Ignored + ) page.loadSettings( settings.get("elements", {}).get( element, page.ELEMENT.class_defaults() @@ -123,7 +125,7 @@ def __edit_pipe(self): # Show the dialog dialog = GstPipeEditDialog(self._settings.get("pipe", ()), parent=self) - if dialog.exec() == dialog.Accepted: + if dialog.exec() == dialog.DialogCode.Accepted: # Reset the view self.listWidget.clear() if self._current_page is not None: diff --git a/lisp/plugins/gst_backend/gst_pipe_edit.py b/lisp/plugins/gst_backend/gst_pipe_edit.py index 89649fb98..f93c65dcf 100644 --- a/lisp/plugins/gst_backend/gst_pipe_edit.py +++ b/lisp/plugins/gst_backend/gst_pipe_edit.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QDialog, QGridLayout, QComboBox, @@ -38,7 +38,7 @@ class GstPipeEdit(QWidget): def __init__(self, pipe, app_mode=False, **kwargs): super().__init__(**kwargs) self.setLayout(QGridLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.layout().setContentsMargins(0, 0, 0, 0) self._app_mode = app_mode @@ -51,7 +51,9 @@ def __init__(self, pipe, app_mode=False, **kwargs): # Current plugins list self.currentList = QListWidget(self) self.currentList.setDragEnabled(True) - self.currentList.setDragDropMode(QAbstractItemView.InternalMove) + self.currentList.setDragDropMode( + QAbstractItemView.DragDropMode.InternalMove + ) self.layout().addWidget(self.currentList, 1, 0) # Available plugins list @@ -66,19 +68,25 @@ def __init__(self, pipe, app_mode=False, **kwargs): # Add/Remove plugins buttons self.buttonsLayout = QVBoxLayout() self.layout().addLayout(self.buttonsLayout, 1, 1) - self.layout().setAlignment(self.buttonsLayout, Qt.AlignHCenter) + self.layout().setAlignment( + self.buttonsLayout, Qt.AlignmentFlag.AlignHCenter + ) self.addButton = QPushButton(self) self.addButton.setIcon(IconTheme.get("go-previous-symbolic")) self.addButton.clicked.connect(self.__add_plugin) self.buttonsLayout.addWidget(self.addButton) - self.buttonsLayout.setAlignment(self.addButton, Qt.AlignHCenter) + self.buttonsLayout.setAlignment( + self.addButton, Qt.AlignmentFlag.AlignHCenter + ) self.delButton = QPushButton(self) self.delButton.setIcon(IconTheme.get("go-next-symbolic")) self.delButton.clicked.connect(self.__remove_plugin) self.buttonsLayout.addWidget(self.delButton) - self.buttonsLayout.setAlignment(self.delButton, Qt.AlignHCenter) + self.buttonsLayout.setAlignment( + self.delButton, Qt.AlignmentFlag.AlignHCenter + ) # Load the pipeline self.set_pipe(pipe) @@ -100,7 +108,7 @@ def set_pipe(self, pipe): def get_pipe(self): pipe = [] if self._app_mode else [self.inputBox.currentData()] for n in range(self.currentList.count()): - pipe.append(self.currentList.item(n).data(Qt.UserRole)) + pipe.append(self.currentList.item(n).data(Qt.ItemDataRole.UserRole)) pipe.append(self.outputBox.currentData()) return tuple(pipe) @@ -138,7 +146,7 @@ def __init_current_plugins(self, pipe): item = QListWidgetItem( translate("MediaElementName", elements.plugin_name(plugin)) ) - item.setData(Qt.UserRole, plugin) + item.setData(Qt.ItemDataRole.UserRole, plugin) self.currentList.addItem(item) def __init_available_plugins(self, pipe): @@ -149,7 +157,7 @@ def __init_available_plugins(self, pipe): item = QListWidgetItem( translate("MediaElementName", elements.plugin_name(plugin)) ) - item.setData(Qt.UserRole, plugin) + item.setData(Qt.ItemDataRole.UserRole, plugin) self.availableList.addItem(item) def __add_plugin(self): @@ -165,7 +173,7 @@ class GstPipeEditDialog(QDialog): def __init__(self, pipe, app_mode=False, **kwargs): super().__init__(**kwargs) self.setWindowTitle(translate("GstPipelineEdit", "Edit Pipeline")) - self.setWindowModality(Qt.ApplicationModal) + self.setWindowModality(Qt.WindowModality.ApplicationModal) self.setMaximumSize(500, 400) self.setMinimumSize(500, 400) self.resize(500, 400) @@ -178,7 +186,8 @@ def __init__(self, pipe, app_mode=False, **kwargs): # Confirm/Cancel buttons self.dialogButtons = QDialogButtonBox(self) self.dialogButtons.setStandardButtons( - QDialogButtonBox.Cancel | QDialogButtonBox.Ok + QDialogButtonBox.StandardButton.Cancel + | QDialogButtonBox.StandardButton.Ok ) self.layout().addWidget(self.dialogButtons) diff --git a/lisp/plugins/gst_backend/gst_settings.py b/lisp/plugins/gst_backend/gst_settings.py index f0cc92a1d..25bd3365f 100644 --- a/lisp/plugins/gst_backend/gst_settings.py +++ b/lisp/plugins/gst_backend/gst_settings.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import QVBoxLayout, QGroupBox, QLabel +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import QVBoxLayout, QGroupBox, QLabel from lisp.plugins.gst_backend.gst_pipe_edit import GstPipeEdit from lisp.ui.settings.pages import SettingsPage @@ -29,7 +29,7 @@ class GstSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.pipeGroup = QGroupBox(self) self.pipeGroup.setLayout(QVBoxLayout()) @@ -39,7 +39,7 @@ def __init__(self, **kwargs): self.layout().addWidget(self.pipeGroup) self.noticeLabel = QLabel(self.pipeGroup) - self.noticeLabel.setAlignment(Qt.AlignCenter) + self.noticeLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) font = self.noticeLabel.font() font.setPointSizeF(font.pointSizeF() * 0.9) self.noticeLabel.setFont(font) diff --git a/lisp/plugins/gst_backend/settings/alsa_sink.py b/lisp/plugins/gst_backend/settings/alsa_sink.py index dcaedd0ea..995e241e0 100644 --- a/lisp/plugins/gst_backend/settings/alsa_sink.py +++ b/lisp/plugins/gst_backend/settings/alsa_sink.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QGroupBox, QComboBox, QLabel, @@ -37,7 +37,7 @@ class AlsaSinkSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.devices = {} self.discover_output_pcm_devices() diff --git a/lisp/plugins/gst_backend/settings/audio_dynamic.py b/lisp/plugins/gst_backend/settings/audio_dynamic.py index 277ac0824..f52946195 100644 --- a/lisp/plugins/gst_backend/settings/audio_dynamic.py +++ b/lisp/plugins/gst_backend/settings/audio_dynamic.py @@ -17,9 +17,9 @@ import math -from PyQt5 import QtCore -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6 import QtCore +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QGroupBox, QGridLayout, QComboBox, @@ -42,7 +42,7 @@ class AudioDynamicSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.groupBox = QGroupBox(self) self.groupBox.setGeometry(0, 0, self.width(), 240) @@ -60,7 +60,7 @@ def __init__(self, **kwargs): self.groupBox.layout().addWidget(self.modeComboBox, 0, 0, 1, 1) self.modeLabel = QLabel(self.groupBox) - self.modeLabel.setAlignment(QtCore.Qt.AlignCenter) + self.modeLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.groupBox.layout().addWidget(self.modeLabel, 0, 1, 1, 1) # AudioDynamic characteristic @@ -74,7 +74,7 @@ def __init__(self, **kwargs): self.groupBox.layout().addWidget(self.chComboBox, 1, 0, 1, 1) self.chLabel = QLabel(self.groupBox) - self.chLabel.setAlignment(QtCore.Qt.AlignCenter) + self.chLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.groupBox.layout().addWidget(self.chLabel, 1, 1, 1, 1) # AudioDynamic ratio @@ -82,7 +82,7 @@ def __init__(self, **kwargs): self.groupBox.layout().addWidget(self.ratioSpin, 2, 0, 1, 1) self.ratioLabel = QLabel(self.groupBox) - self.ratioLabel.setAlignment(QtCore.Qt.AlignCenter) + self.ratioLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.groupBox.layout().addWidget(self.ratioLabel, 2, 1, 1, 1) # AudioDynamic threshold @@ -93,7 +93,7 @@ def __init__(self, **kwargs): self.groupBox.layout().addWidget(self.thresholdSpin, 3, 0, 1, 1) self.thresholdLabel = QLabel(self.groupBox) - self.thresholdLabel.setAlignment(QtCore.Qt.AlignCenter) + self.thresholdLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.groupBox.layout().addWidget(self.thresholdLabel, 3, 1, 1, 1) self.retranslateUi() diff --git a/lisp/plugins/gst_backend/settings/audio_pan.py b/lisp/plugins/gst_backend/settings/audio_pan.py index 2e27e8c7b..6a1757c91 100644 --- a/lisp/plugins/gst_backend/settings/audio_pan.py +++ b/lisp/plugins/gst_backend/settings/audio_pan.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QGroupBox, QHBoxLayout, QSlider, QLabel, QVBoxLayout +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import QGroupBox, QHBoxLayout, QSlider, QLabel, QVBoxLayout from lisp.plugins.gst_backend.elements.audio_pan import AudioPan from lisp.ui.settings.pages import SettingsPage @@ -30,7 +30,7 @@ class AudioPanSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.panBox = QGroupBox(self) self.panBox.setGeometry(0, 0, self.width(), 80) @@ -40,12 +40,12 @@ def __init__(self, **kwargs): self.panSlider = QSlider(self.panBox) self.panSlider.setRange(-10, 10) self.panSlider.setPageStep(1) - self.panSlider.setOrientation(Qt.Horizontal) + self.panSlider.setOrientation(Qt.Orientation.Horizontal) self.panSlider.valueChanged.connect(self.pan_changed) self.panBox.layout().addWidget(self.panSlider) self.panLabel = QLabel(self.panBox) - self.panLabel.setAlignment(Qt.AlignCenter) + self.panLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.panBox.layout().addWidget(self.panLabel) self.panBox.layout().setStretch(0, 5) diff --git a/lisp/plugins/gst_backend/settings/db_meter.py b/lisp/plugins/gst_backend/settings/db_meter.py index 3d83d038d..7d54c16fd 100644 --- a/lisp/plugins/gst_backend/settings/db_meter.py +++ b/lisp/plugins/gst_backend/settings/db_meter.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5 import QtCore -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6 import QtCore +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QGroupBox, QGridLayout, QSpinBox, @@ -38,7 +38,7 @@ class DbMeterSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.groupBox = QGroupBox(self) self.groupBox.setGeometry(0, 0, self.width(), 180) @@ -53,7 +53,7 @@ def __init__(self, **kwargs): self.groupBox.layout().addWidget(self.intervalSpin, 0, 0) self.intervalLabel = QLabel(self.groupBox) - self.intervalLabel.setAlignment(QtCore.Qt.AlignCenter) + self.intervalLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.groupBox.layout().addWidget(self.intervalLabel, 0, 1) # Peak ttl (sec/100) @@ -64,7 +64,7 @@ def __init__(self, **kwargs): self.groupBox.layout().addWidget(self.ttlSpin, 1, 0) self.ttlLabel = QLabel(self.groupBox) - self.ttlLabel.setAlignment(QtCore.Qt.AlignCenter) + self.ttlLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.groupBox.layout().addWidget(self.ttlLabel, 1, 1) # Peak falloff (unit per time) @@ -74,7 +74,7 @@ def __init__(self, **kwargs): self.groupBox.layout().addWidget(self.falloffSpin, 2, 0) self.falloffLabel = QLabel(self.groupBox) - self.falloffLabel.setAlignment(QtCore.Qt.AlignCenter) + self.falloffLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.groupBox.layout().addWidget(self.falloffLabel, 2, 1) self.retranslateUi() diff --git a/lisp/plugins/gst_backend/settings/equalizer10.py b/lisp/plugins/gst_backend/settings/equalizer10.py index 1a69d4410..2c9661822 100644 --- a/lisp/plugins/gst_backend/settings/equalizer10.py +++ b/lisp/plugins/gst_backend/settings/equalizer10.py @@ -15,10 +15,10 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5 import QtCore -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QFontMetrics -from PyQt5.QtWidgets import QGroupBox, QGridLayout, QLabel, QSlider, QVBoxLayout +from PyQt6 import QtCore +from PyQt6.QtCore import Qt +from PyQt6.QtGui import QFontMetrics +from PyQt6.QtWidgets import QGroupBox, QGridLayout, QLabel, QSlider, QVBoxLayout from lisp.plugins.gst_backend.elements.equalizer10 import Equalizer10 from lisp.ui.settings.pages import SettingsPage @@ -45,7 +45,7 @@ class Equalizer10Settings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.groupBox = QGroupBox(self) self.groupBox.resize(self.size()) @@ -61,7 +61,7 @@ def __init__(self, **kwargs): for n in range(10): label = QLabel(self.groupBox) label.setMinimumWidth(QFontMetrics(label.font()).width("000")) - label.setAlignment(QtCore.Qt.AlignCenter) + label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) label.setNum(0) self.groupBox.layout().addWidget(label, 0, n) @@ -69,15 +69,17 @@ def __init__(self, **kwargs): slider.setRange(-24, 12) slider.setPageStep(1) slider.setValue(0) - slider.setOrientation(QtCore.Qt.Vertical) + slider.setOrientation(QtCore.Qt.Orientation.Vertical) slider.valueChanged.connect(label.setNum) self.groupBox.layout().addWidget(slider, 1, n) - self.groupBox.layout().setAlignment(slider, QtCore.Qt.AlignHCenter) + self.groupBox.layout().setAlignment( + slider, QtCore.Qt.AlignmentFlag.AlignHCenter + ) self.sliders["band" + str(n)] = slider fLabel = QLabel(self.groupBox) fLabel.setStyleSheet("font-size: 8pt;") - fLabel.setAlignment(QtCore.Qt.AlignCenter) + fLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) fLabel.setText(self.FREQ[n]) self.groupBox.layout().addWidget(fLabel, 2, n) diff --git a/lisp/plugins/gst_backend/settings/jack_sink.py b/lisp/plugins/gst_backend/settings/jack_sink.py index 9f9b4703f..7817bc529 100644 --- a/lisp/plugins/gst_backend/settings/jack_sink.py +++ b/lisp/plugins/gst_backend/settings/jack_sink.py @@ -18,9 +18,9 @@ import logging import jack -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QPainter, QPolygon, QPainterPath -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QPointF +from PyQt6.QtGui import QPainter, QPainterPath, QPolygonF +from PyQt6.QtWidgets import ( QGroupBox, QWidget, QHBoxLayout, @@ -47,7 +47,7 @@ class JackSinkSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.jackGroup = QGroupBox(self) self.jackGroup.setLayout(QHBoxLayout()) @@ -104,7 +104,7 @@ def __edit_connections(self): dialog.set_connections(self.connections.copy()) dialog.exec() - if dialog.result() == dialog.Accepted: + if dialog.result() == dialog.DialogCode.Accepted: self.connections = dialog.connections @@ -148,7 +148,7 @@ def paintEvent(self, QPaintEvent): h2 = self._input_widget.header().sizeHint().height() painter = QPainter(self) - painter.setRenderHint(QPainter.Antialiasing) + painter.setRenderHint(QPainter.RenderHint.Antialiasing) for output, out_conn in enumerate(self.connections): y1 = int( @@ -179,11 +179,16 @@ def draw_connection_line(painter, x1, y1, x2, y2, h1, h2): painter.drawLine(x1, y1, x1 + 4, y1) # Setup control points - spline = QPolygon(4) cp = int((x2 - x1 - 8) * 0.4) - spline.setPoints( - x1 + 4, y1, x1 + 4 + cp, y1, x2 - 4 - cp, y2, x2 - 4, y2 + spline = QPolygonF( + [ + QPointF(x1 + 4, y1), + QPointF(x1 + 4 + cp, y1), + QPointF(x2 - 4 - cp, y2), + QPointF(x2 - 4, y2), + ] ) + # The connection line path = QPainterPath() path.moveTo(spline.at(0)) @@ -249,7 +254,8 @@ def __init__(self, jack_client, parent=None, **kwargs): self.layout().addWidget(self.connectButton, 1, 1) self.dialogButtons = QDialogButtonBox( - QDialogButtonBox.Cancel | QDialogButtonBox.Ok + QDialogButtonBox.StandardButton.Cancel + | QDialogButtonBox.StandardButton.Ok ) self.dialogButtons.accepted.connect(self.accept) self.dialogButtons.rejected.connect(self.reject) diff --git a/lisp/plugins/gst_backend/settings/pitch.py b/lisp/plugins/gst_backend/settings/pitch.py index afada0e4f..685c6a3b4 100644 --- a/lisp/plugins/gst_backend/settings/pitch.py +++ b/lisp/plugins/gst_backend/settings/pitch.py @@ -17,9 +17,9 @@ import math -from PyQt5 import QtCore -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QGroupBox, QHBoxLayout, QSlider, QLabel, QVBoxLayout +from PyQt6 import QtCore +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import QGroupBox, QHBoxLayout, QSlider, QLabel, QVBoxLayout from lisp.plugins.gst_backend.elements.pitch import Pitch from lisp.ui.settings.pages import SettingsPage @@ -33,7 +33,7 @@ class PitchSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.groupBox = QGroupBox(self) self.groupBox.setLayout(QHBoxLayout()) @@ -44,13 +44,13 @@ def __init__(self, **kwargs): self.pitchSlider.setMaximum(12) self.pitchSlider.setPageStep(1) self.pitchSlider.setValue(0) - self.pitchSlider.setOrientation(QtCore.Qt.Horizontal) - self.pitchSlider.setTickPosition(QSlider.TicksAbove) + self.pitchSlider.setOrientation(QtCore.Qt.Orientation.Horizontal) + self.pitchSlider.setTickPosition(QSlider.TickPosition.TicksAbove) self.pitchSlider.setTickInterval(1) self.groupBox.layout().addWidget(self.pitchSlider) self.pitchLabel = QLabel(self.groupBox) - self.pitchLabel.setAlignment(QtCore.Qt.AlignCenter) + self.pitchLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.groupBox.layout().addWidget(self.pitchLabel) self.groupBox.layout().setStretch(0, 3) diff --git a/lisp/plugins/gst_backend/settings/preset_src.py b/lisp/plugins/gst_backend/settings/preset_src.py index fe0369d5c..83fcb23ed 100644 --- a/lisp/plugins/gst_backend/settings/preset_src.py +++ b/lisp/plugins/gst_backend/settings/preset_src.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QTime -from PyQt5.QtWidgets import QGroupBox, QComboBox, QVBoxLayout, QTimeEdit +from PyQt6.QtCore import Qt, QTime +from PyQt6.QtWidgets import QGroupBox, QComboBox, QVBoxLayout, QTimeEdit from lisp.plugins.gst_backend.elements.preset_src import PresetSrc from lisp.ui.settings.pages import SettingsPage @@ -30,7 +30,7 @@ class PresetSrcSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.functionGroup = QGroupBox(self) self.functionGroup.setTitle(translate("PresetSrcSettings", "Presets")) diff --git a/lisp/plugins/gst_backend/settings/speed.py b/lisp/plugins/gst_backend/settings/speed.py index 587bc659b..4947cd0d4 100644 --- a/lisp/plugins/gst_backend/settings/speed.py +++ b/lisp/plugins/gst_backend/settings/speed.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5 import QtCore -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6 import QtCore +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QGroupBox, QHBoxLayout, QDoubleSpinBox, @@ -37,7 +37,7 @@ class SpeedSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.groupBox = QGroupBox(self) self.groupBox.setLayout(QHBoxLayout()) @@ -51,7 +51,7 @@ def __init__(self, **kwargs): self.groupBox.layout().addWidget(self.speedSpinBox) self.speedLabel = QLabel(self.groupBox) - self.speedLabel.setAlignment(QtCore.Qt.AlignCenter) + self.speedLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.groupBox.layout().addWidget(self.speedLabel) self.retranslateUi() diff --git a/lisp/plugins/gst_backend/settings/uri_input.py b/lisp/plugins/gst_backend/settings/uri_input.py index a3c7e3822..c5aa920e0 100644 --- a/lisp/plugins/gst_backend/settings/uri_input.py +++ b/lisp/plugins/gst_backend/settings/uri_input.py @@ -17,8 +17,8 @@ import os -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QGroupBox, QHBoxLayout, QPushButton, @@ -46,7 +46,7 @@ class UriInputSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.fileGroup = QGroupBox(self) self.fileGroup.setLayout(QHBoxLayout()) @@ -74,7 +74,7 @@ def __init__(self, **kwargs): self.bufferingGroup.layout().addWidget(self.bufferSize, 2, 0) self.bufferSizeLabel = QLabel(self.bufferingGroup) - self.bufferSizeLabel.setAlignment(Qt.AlignCenter) + self.bufferSizeLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.bufferingGroup.layout().addWidget(self.bufferSizeLabel, 2, 1) self.buttonFindFile.clicked.connect(self.select_file) diff --git a/lisp/plugins/gst_backend/settings/user_element.py b/lisp/plugins/gst_backend/settings/user_element.py index b1e5f7e20..8fc427e08 100644 --- a/lisp/plugins/gst_backend/settings/user_element.py +++ b/lisp/plugins/gst_backend/settings/user_element.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5 import QtCore -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QGroupBox, QVBoxLayout, QPlainTextEdit, QLabel +from PyQt6 import QtCore +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import QGroupBox, QVBoxLayout, QPlainTextEdit, QLabel from lisp.plugins.gst_backend.elements.user_element import UserElement from lisp.ui.settings.pages import SettingsPage @@ -31,7 +31,7 @@ class UserElementSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.groupBox = QGroupBox(self) self.groupBox.setGeometry(self.geometry()) @@ -42,7 +42,7 @@ def __init__(self, **kwargs): self.groupBox.layout().addWidget(self.textEdit) self.warning = QLabel(self.groupBox) - self.warning.setAlignment(QtCore.Qt.AlignCenter) + self.warning.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.warning.setStyleSheet("color: #FF2222; font-weight: bold") self.groupBox.layout().addWidget(self.warning) diff --git a/lisp/plugins/gst_backend/settings/volume.py b/lisp/plugins/gst_backend/settings/volume.py index cd0804c28..f8f38319b 100644 --- a/lisp/plugins/gst_backend/settings/volume.py +++ b/lisp/plugins/gst_backend/settings/volume.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QGroupBox, QHBoxLayout, QLabel, @@ -39,7 +39,7 @@ class VolumeSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.normalizedVolume = 1 @@ -59,7 +59,7 @@ def __init__(self, **kwargs): self.muteButton.setFixedHeight(self.volumeSpinBox.height()) self.volumeLabel = QLabel(self.volumeGroup) - self.volumeLabel.setAlignment(Qt.AlignCenter) + self.volumeLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.volumeGroup.layout().addWidget(self.volumeLabel) self.volumeGroup.layout().setStretch(0, 1) @@ -71,13 +71,13 @@ def __init__(self, **kwargs): self.layout().addWidget(self.normalizedGroup) self.normalizedLabel = QLabel(self.normalizedGroup) - self.normalizedLabel.setAlignment(Qt.AlignCenter) + self.normalizedLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.normalizedGroup.layout().addWidget(self.normalizedLabel) self.normalizedReset = QCheckBox(self.normalizedGroup) self.normalizedGroup.layout().addWidget(self.normalizedReset) self.normalizedGroup.layout().setAlignment( - self.normalizedReset, Qt.AlignCenter + self.normalizedReset, Qt.AlignmentFlag.AlignCenter ) self.retranslateUi() diff --git a/lisp/plugins/list_layout/control_buttons.py b/lisp/plugins/list_layout/control_buttons.py index c358fea85..f43d19677 100644 --- a/lisp/plugins/list_layout/control_buttons.py +++ b/lisp/plugins/list_layout/control_buttons.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QSize -from PyQt5.QtWidgets import QWidget, QGridLayout, QSizePolicy +from PyQt6.QtCore import Qt, QSize +from PyQt6.QtWidgets import QWidget, QGridLayout, QSizePolicy from lisp.ui.icons import IconTheme from lisp.ui.ui_utils import translate @@ -66,8 +66,10 @@ def retranslateUi(self): def newButton(self, icon): button = QIconPushButton(self) - button.setFocusPolicy(Qt.NoFocus) - button.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) + button.setFocusPolicy(Qt.FocusPolicy.NoFocus) + button.setSizePolicy( + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Ignored + ) button.setIcon(icon) button.setIconSize(QSize(32, 32)) return button @@ -117,8 +119,10 @@ def startMode(self): def newButton(self, icon): button = QIconPushButton(self) - button.setFocusPolicy(Qt.NoFocus) - button.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) + button.setFocusPolicy(Qt.FocusPolicy.NoFocus) + button.setSizePolicy( + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Ignored + ) button.setIcon(icon) button.setIconSize(QSize(32, 32)) return button diff --git a/lisp/plugins/list_layout/info_panel.py b/lisp/plugins/list_layout/info_panel.py index c3678b2a9..f507c5f9f 100644 --- a/lisp/plugins/list_layout/info_panel.py +++ b/lisp/plugins/list_layout/info_panel.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QTextDocument -from PyQt5.QtWidgets import QWidget, QTextEdit, QLineEdit, QVBoxLayout +from PyQt6.QtCore import Qt +from PyQt6.QtGui import QTextDocument +from PyQt6.QtWidgets import QWidget, QTextEdit, QLineEdit, QVBoxLayout from lisp.ui.ui_utils import translate @@ -32,14 +32,14 @@ def __init__(self, *args): # cue name self.cueName = QLineEdit(self) - self.cueName.setFocusPolicy(Qt.NoFocus) + self.cueName.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.cueName.setReadOnly(True) self.layout().addWidget(self.cueName) # cue description self.cueDescription = QTextEdit(self) self.cueDescription.setObjectName("InfoPanelDescription") - self.cueDescription.setFocusPolicy(Qt.NoFocus) + self.cueDescription.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.cueDescription.setReadOnly(True) self.layout().addWidget(self.cueDescription) diff --git a/lisp/plugins/list_layout/layout.py b/lisp/plugins/list_layout/layout.py index d10b5471d..96c3eb590 100644 --- a/lisp/plugins/list_layout/layout.py +++ b/lisp/plugins/list_layout/layout.py @@ -15,9 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP, QTimer -from PyQt5.QtGui import QKeySequence -from PyQt5.QtWidgets import QAction +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP, QTimer +from PyQt6.QtGui import QKeySequence, QAction from lisp.command.model import ModelInsertItemsCommand from lisp.core.configuration import DummyConfiguration @@ -34,7 +33,6 @@ from lisp.plugins.list_layout.models import CueListModel, RunningCueModel from lisp.plugins.list_layout.view import ListLayoutView from lisp.ui.ui_utils import translate -from lisp.ui.widgets.hotkeyedit import keyEventKeySequence class ListLayout(CueLayout): @@ -274,23 +272,25 @@ def invert_selection(self): def _key_pressed(self, event): event.ignore() if not event.isAutoRepeat(): - sequence = keyEventKeySequence(event) + sequence = QKeySequence(event.keyCombination()) goSequence = QKeySequence( - ListLayout.Config["goKey"], QKeySequence.NativeText + ListLayout.Config["goKey"], + QKeySequence.SequenceFormat.NativeText, ) - if sequence in goSequence: + + if sequence == goSequence: event.accept() if not ( self.go_key_disabled_while_playing and len(self._running_model) ): self.__go_slot() - elif sequence == QKeySequence.Delete: + elif sequence == QKeySequence.StandardKey.Delete: event.accept() self._remove_cues(self.selected_cues()) elif ( - event.key() == Qt.Key_Space - and event.modifiers() == Qt.ShiftModifier + event.key() == Qt.Key.Key_Space + and event.modifiers() == Qt.KeyboardModifier.ShiftModifier ): event.accept() cue = self.standby_cue() @@ -356,14 +356,18 @@ def _set_index_visible(self, visible): def _set_selection_mode(self, enable): self.selection_mode_action.setChecked(enable) if enable: - self._view.listView.setSelectionMode(CueListView.ExtendedSelection) + self._view.listView.setSelectionMode( + CueListView.SelectionMode.ExtendedSelection + ) standby = self.standby_index() if standby >= 0: self._view.listView.topLevelItem(standby).setSelected(True) else: self.deselect_all() - self._view.listView.setSelectionMode(CueListView.NoSelection) + self._view.listView.setSelectionMode( + CueListView.SelectionMode.NoSelection + ) @selection_mode.get def _get_selection_mode(self): diff --git a/lisp/plugins/list_layout/list_view.py b/lisp/plugins/list_layout/list_view.py index 57bfd25cb..8b8a2ff97 100644 --- a/lisp/plugins/list_layout/list_view.py +++ b/lisp/plugins/list_layout/list_view.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import ( +from PyQt6.QtCore import ( pyqtSignal, Qt, QDataStream, @@ -23,8 +23,8 @@ QT_TRANSLATE_NOOP, QTimer, ) -from PyQt5.QtGui import QKeyEvent, QContextMenuEvent, QBrush, QColor -from PyQt5.QtWidgets import QTreeWidget, QHeaderView, QTreeWidgetItem +from PyQt6.QtGui import QKeyEvent, QContextMenuEvent, QBrush, QColor +from PyQt6.QtWidgets import QTreeWidget, QHeaderView, QTreeWidgetItem from lisp.application import Application from lisp.backend import get_backend @@ -38,6 +38,7 @@ NextActionIcon, PostWaitWidget, IndexWidget, + NoFocusDelegate, ) from lisp.ui.ui_utils import translate, css_to_dict, dict_to_css @@ -71,12 +72,12 @@ class CueListView(QTreeWidget): # TODO: add ability to show/hide # TODO: implement columns (cue-type / target / etc..) COLUMNS = [ - ListColumn("", CueStatusIcons, QHeaderView.Fixed, width=45), - ListColumn("#", IndexWidget, QHeaderView.ResizeToContents), + ListColumn("", CueStatusIcons, QHeaderView.ResizeMode.Fixed, width=45), + ListColumn("#", IndexWidget, QHeaderView.ResizeMode.ResizeToContents), ListColumn( QT_TRANSLATE_NOOP("ListLayoutHeader", "Cue"), NameWidget, - QHeaderView.Stretch, + QHeaderView.ResizeMode.Stretch, ), ListColumn( QT_TRANSLATE_NOOP("ListLayoutHeader", "Pre wait"), PreWaitWidget @@ -87,10 +88,10 @@ class CueListView(QTreeWidget): ListColumn( QT_TRANSLATE_NOOP("ListLayoutHeader", "Post wait"), PostWaitWidget ), - ListColumn("", NextActionIcon, QHeaderView.Fixed, width=18), + ListColumn("", NextActionIcon, QHeaderView.ResizeMode.Fixed, width=18), ] - ITEM_DEFAULT_BG = QBrush(Qt.transparent) + ITEM_DEFAULT_BG = QBrush(Qt.GlobalColor.transparent) ITEM_CURRENT_BG = QBrush(QColor(250, 220, 0, 100)) def __init__(self, listModel, parent=None): @@ -119,17 +120,18 @@ def __init__(self, listModel, parent=None): self.header().setDragEnabled(False) self.header().setStretchLastSection(False) - self.setDragDropMode(self.InternalMove) + self.setDragDropMode(QTreeWidget.DragDropMode.InternalMove) # Set some visual options self.setIndentation(0) self.setAlternatingRowColors(True) - self.setVerticalScrollMode(self.ScrollPerItem) + self.setVerticalScrollMode(QTreeWidget.ScrollMode.ScrollPerItem) + self.setItemDelegate(NoFocusDelegate()) # This allows to have some spare space at the end of the scroll-area self.verticalScrollBar().rangeChanged.connect(self.__updateScrollRange) self.currentItemChanged.connect( - self.__currentItemChanged, Qt.QueuedConnection + self.__currentItemChanged, Qt.ConnectionType.QueuedConnection ) def dragEnterEvent(self, event): @@ -174,11 +176,11 @@ def dropEvent(self, event): rows.append(row) - if event.proposedAction() == Qt.MoveAction: + if event.proposedAction() == Qt.DropAction.MoveAction: Application().commands_stack.do( ModelMoveItemsCommand(self._model, rows, to_index) ) - elif event.proposedAction() == Qt.CopyAction: + elif event.proposedAction() == Qt.DropAction.CopyAction: new_cues = [] for row in sorted(rows): new_cues.append( @@ -203,8 +205,8 @@ def keyPressEvent(self, event): def mousePressEvent(self, event): if ( - not event.buttons() & Qt.RightButton - or not self.selectionMode() == QTreeWidget.NoSelection + not event.buttons() & Qt.MouseButton.RightButton + or not self.selectionMode() == QTreeWidget.SelectionMode.NoSelection ): super().mousePressEvent(event) @@ -226,17 +228,19 @@ def updateHeadersSizes(self): """ header = self.header() for i, column in enumerate(CueListView.COLUMNS): - if column.resize == QHeaderView.Stretch: + if column.resize == QHeaderView.ResizeMode.Stretch: # Make the header calculate the content size - header.setSectionResizeMode(i, QHeaderView.ResizeToContents) + header.setSectionResizeMode( + i, QHeaderView.ResizeMode.ResizeToContents + ) contentWidth = header.sectionSize(i) # Make the header calculate the stretched size - header.setSectionResizeMode(i, QHeaderView.Stretch) + header.setSectionResizeMode(i, QHeaderView.ResizeMode.Stretch) stretchWidth = header.sectionSize(i) # Set the maximum size as fixed size for the section - header.setSectionResizeMode(i, QHeaderView.Fixed) + header.setSectionResizeMode(i, QHeaderView.ResizeMode.Fixed) header.resizeSection(i, max(contentWidth, stretchWidth)) def __currentItemChanged(self, current, previous): @@ -248,11 +252,13 @@ def __currentItemChanged(self, current, previous): current.current = True self.__updateItemStyle(current) - if self.selectionMode() == QTreeWidget.NoSelection: + if self.selectionMode() == QTreeWidget.SelectionMode.NoSelection: # Ensure the current item is in the middle of the viewport. # This is skipped in "selection-mode" otherwise it creates - # confusion during drang&drop operations - self.scrollToItem(current, QTreeWidget.PositionAtCenter) + # confusion during drag&drop operations + self.scrollToItem( + current, QTreeWidget.ScrollHint.PositionAtCenter + ) elif not self.selectedIndexes(): current.setSelected(True) @@ -286,7 +292,7 @@ def __cuePropChanged(self, cue, property_name, _): def __cueAdded(self, cue): item = CueTreeWidgetItem(cue) - item.setFlags(item.flags() & ~Qt.ItemIsDropEnabled) + item.setFlags(item.flags() & ~Qt.ItemFlag.ItemIsDropEnabled) cue.property_changed.connect(self.__cuePropChanged) self.insertTopLevelItem(cue.index, item) diff --git a/lisp/plugins/list_layout/list_widgets.py b/lisp/plugins/list_layout/list_widgets.py index 69d422b6a..2034f7e97 100644 --- a/lisp/plugins/list_layout/list_widgets.py +++ b/lisp/plugins/list_layout/list_widgets.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QRect, QSize, Qt -from PyQt5.QtGui import ( +from PyQt6.QtCore import QRect, QSize, Qt +from PyQt6.QtGui import ( QBrush, QColor, QFontDatabase, @@ -24,7 +24,13 @@ QPainterPath, QPen, ) -from PyQt5.QtWidgets import QLabel, QProgressBar, QWidget +from PyQt6.QtWidgets import ( + QLabel, + QProgressBar, + QWidget, + QStyledItemDelegate, + QStyle, +) from lisp.core.signal import Connection from lisp.core.util import strtime @@ -34,16 +40,24 @@ from lisp.ui.widgets.cue_next_actions import tr_next_action +class NoFocusDelegate(QStyledItemDelegate): + def paint(self, painter, option, index): + if option.state & QStyle.StateFlag.State_HasFocus: + option.state ^= QStyle.StateFlag.State_HasFocus + + super().paint(painter, option, index) + + class IndexWidget(QLabel): def __init__(self, item, *args, **kwargs): super().__init__(*args, **kwargs) - self.setAttribute(Qt.WA_TranslucentBackground) - self.setAlignment(Qt.AlignCenter) + self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) + self.setAlignment(Qt.AlignmentFlag.AlignCenter) # This value will be used to provide some spacing for the widget # the value depends on the current font. self.sizeIncrement = QSize( - self.fontMetrics().size(Qt.TextSingleLine, "00").width(), 0 + self.fontMetrics().size(Qt.TextFlag.TextSingleLine, "00").width(), 0 ) item.cue.changed("index").connect(self.__update, Connection.QtQueued) @@ -59,7 +73,7 @@ def __update(self, newIndex): class NameWidget(QLabel): def __init__(self, item, *args, **kwargs): super().__init__(*args, **kwargs) - self.setAttribute(Qt.WA_TranslucentBackground) + self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) self._item = item self._item.cue.changed("name").connect( @@ -77,7 +91,7 @@ class CueStatusIcons(QWidget): def __init__(self, item, *args): super().__init__(*args) - self.setAttribute(Qt.WA_TranslucentBackground) + self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) self._icon = None self._item = item @@ -109,7 +123,7 @@ def _size(self): def paintEvent(self, event): qp = QPainter() qp.begin(self) - qp.setRenderHint(QPainter.HighQualityAntialiasing, True) + qp.setRenderHint(QPainter.RenderHint.Antialiasing, True) status_size = self._size() indicator_height = self.height() @@ -151,8 +165,8 @@ class NextActionIcon(QLabel): def __init__(self, item, *args): super().__init__(*args) - self.setAttribute(Qt.WA_TranslucentBackground) - self.setAlignment(Qt.AlignCenter) + self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) + self.setAlignment(Qt.AlignmentFlag.AlignCenter) item.cue.changed("next_action").connect( self._updateIcon, Connection.QtQueued @@ -184,7 +198,9 @@ def __init__(self, item, *args): self.setObjectName("ListTimeWidget") self.setValue(0) self.setTextVisible(True) - self.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont)) + self.setFont( + QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont) + ) self.cue = item.cue self.duration = 0 diff --git a/lisp/plugins/list_layout/playing_view.py b/lisp/plugins/list_layout/playing_view.py index 505df84e1..cf11b8b65 100644 --- a/lisp/plugins/list_layout/playing_view.py +++ b/lisp/plugins/list_layout/playing_view.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QListWidget, QListWidgetItem +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import QListWidget, QListWidgetItem from lisp.core.signal import Connection from lisp.plugins.list_layout.playing_widgets import get_running_widget @@ -25,10 +25,10 @@ class RunningCuesListWidget(QListWidget): def __init__(self, running_model, config, **kwargs): super().__init__(**kwargs) - self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - self.setFocusPolicy(Qt.NoFocus) - self.setSelectionMode(self.NoSelection) + self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) + self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) + self.setFocusPolicy(Qt.FocusPolicy.NoFocus) + self.setSelectionMode(self.SelectionMode.NoSelection) self._config = config diff --git a/lisp/plugins/list_layout/playing_widgets.py b/lisp/plugins/list_layout/playing_widgets.py index 5ada11956..f54b2b203 100644 --- a/lisp/plugins/list_layout/playing_widgets.py +++ b/lisp/plugins/list_layout/playing_widgets.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QTimer -from PyQt5.QtGui import QColor -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QTimer +from PyQt6.QtGui import QColor +from PyQt6.QtWidgets import ( QWidget, QGridLayout, QSizePolicy, @@ -48,7 +48,7 @@ def get_running_widget(cue, config, **kwargs): class RunningCueWidget(QWidget): def __init__(self, cue, config, **kwargs): super().__init__(**kwargs) - self.setFocusPolicy(Qt.NoFocus) + self.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.setLayout(QHBoxLayout(self)) self.layout().setContentsMargins(0, 0, 0, 1) @@ -67,7 +67,9 @@ def __init__(self, cue, config, **kwargs): self.layout().addWidget(self.gridLayoutWidget) self.nameLabel = ElidedLabel(self.gridLayoutWidget) - self.nameLabel.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) + self.nameLabel.setSizePolicy( + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Ignored + ) self.nameLabel.setText(cue.name) self.nameLabel.setToolTip(cue.name) self.gridLayout.addWidget(self.nameLabel, 0, 0, 1, 2) @@ -79,7 +81,7 @@ def __init__(self, cue, config, **kwargs): self.timeDisplay = QLCDNumber(self.gridLayoutWidget) self.timeDisplay.setStyleSheet("background-color: transparent") - self.timeDisplay.setSegmentStyle(QLCDNumber.Flat) + self.timeDisplay.setSegmentStyle(QLCDNumber.SegmentStyle.Flat) self.timeDisplay.setDigitCount(8) self.timeDisplay.display(strtime(cue.duration)) self.gridLayout.addWidget(self.timeDisplay, 1, 1) @@ -202,10 +204,10 @@ def __init__(self, cue, config, **kwargs): ) else: self.seekSlider = QClickSlider(self.gridLayoutWidget) - self.seekSlider.setOrientation(Qt.Horizontal) + self.seekSlider.setOrientation(Qt.Orientation.Horizontal) self.seekSlider.setRange(0, cue.duration) - self.seekSlider.setFocusPolicy(Qt.NoFocus) + self.seekSlider.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.seekSlider.sliderMoved.connect(self._seek) self.seekSlider.sliderJumped.connect(self._seek) self.seekSlider.setVisible(False) diff --git a/lisp/plugins/list_layout/settings.py b/lisp/plugins/list_layout/settings.py index 522df9f4a..865254538 100644 --- a/lisp/plugins/list_layout/settings.py +++ b/lisp/plugins/list_layout/settings.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtGui import QKeySequence -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtGui import QKeySequence +from PyQt6.QtWidgets import ( QGroupBox, QVBoxLayout, QCheckBox, @@ -43,7 +43,7 @@ def __init__(self, **kwargs): self.setWidgetResizable(True) self.contentWidget = QWidget(self) self.contentWidget.setLayout(QVBoxLayout()) - self.contentWidget.layout().setAlignment(Qt.AlignTop) + self.contentWidget.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.defaultBehaviorsGroup = QGroupBox(self.contentWidget) self.defaultBehaviorsGroup.setLayout(QVBoxLayout()) @@ -161,7 +161,9 @@ def loadSettings(self, settings): settings["goKeyDisabledWhilePlaying"] ) self.goKeyEdit.setKeySequence( - QKeySequence(settings["goKey"], QKeySequence.NativeText) + QKeySequence( + settings["goKey"], QKeySequence.SequenceFormat.NativeText + ) ) self.goActionCombo.setCurrentItem(settings["goAction"]) self.goDelaySpin.setValue(settings["goDelay"]) @@ -182,7 +184,7 @@ def getSettings(self): "autoContinue": self.autoNext.isChecked(), "selectionMode": self.selectionMode.isChecked(), "goKey": self.goKeyEdit.keySequence().toString( - QKeySequence.NativeText + QKeySequence.SequenceFormat.NativeText ), "goAction": self.goActionCombo.currentItem(), "goDelay": self.goDelaySpin.value(), diff --git a/lisp/plugins/list_layout/view.py b/lisp/plugins/list_layout/view.py index 99139fc7c..1dc5c5bd2 100644 --- a/lisp/plugins/list_layout/view.py +++ b/lisp/plugins/list_layout/view.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QWidget, QSizePolicy, QSplitter, QVBoxLayout +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import QWidget, QSizePolicy, QSplitter, QVBoxLayout from lisp.plugins.list_layout.list_view import CueListView from lisp.plugins.list_layout.playing_view import RunningCuesListWidget @@ -33,7 +33,7 @@ def __init__(self, listModel, runModel, config, *args): self.listModel = listModel - self.mainSplitter = QSplitter(Qt.Vertical, self) + self.mainSplitter = QSplitter(Qt.Orientation.Vertical, self) self.layout().addWidget(self.mainSplitter) self.topSplitter = QSplitter(self.mainSplitter) @@ -46,14 +46,18 @@ def __init__(self, listModel, runModel, config, *args): self.goButton = DynamicFontSizePushButton(parent=self) self.goButton.setText("GO") self.goButton.setMinimumWidth(60) - self.goButton.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) - self.goButton.setFocusPolicy(Qt.NoFocus) + self.goButton.setSizePolicy( + QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum + ) + self.goButton.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.topSplitter.addWidget(self.goButton) # INFO PANEL (top-center) self.infoPanel = InfoPanel(self) self.infoPanel.setMinimumWidth(300) - self.infoPanel.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Ignored) + self.infoPanel.setSizePolicy( + QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Ignored + ) self.infoPanel.cueDescription.setFontPointSize( config.get( "infoPanelFontSize", @@ -66,7 +70,7 @@ def __init__(self, listModel, runModel, config, *args): self.controlButtons = ShowControlButtons(self) self.controlButtons.setMinimumWidth(100) self.controlButtons.setSizePolicy( - QSizePolicy.Minimum, QSizePolicy.Minimum + QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum ) self.topSplitter.addWidget(self.controlButtons) @@ -80,7 +84,9 @@ def __init__(self, listModel, runModel, config, *args): # PLAYING VIEW (center-right) self.runView = RunningCuesListWidget(runModel, config, parent=self) self.runView.setMinimumWidth(200) - self.runView.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) + self.runView.setSizePolicy( + QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum + ) self.centralSplitter.addWidget(self.runView) self.__userResized = False diff --git a/lisp/plugins/media_info/media_info.py b/lisp/plugins/media_info/media_info.py index d48f737f3..490ebd723 100644 --- a/lisp/plugins/media_info/media_info.py +++ b/lisp/plugins/media_info/media_info.py @@ -17,8 +17,8 @@ from urllib.parse import unquote -from PyQt5 import QtCore -from PyQt5.QtWidgets import ( +from PyQt6 import QtCore +from PyQt6.QtWidgets import ( QMessageBox, QDialog, QVBoxLayout, @@ -124,7 +124,7 @@ def __init__(self, parent, info, title): self.setWindowTitle( translate("MediaInfo", "Media Info") + " - " + title ) - self.setWindowModality(QtCore.Qt.ApplicationModal) + self.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) self.setMinimumSize(600, 300) self.resize(600, 300) self.setLayout(QVBoxLayout(self)) @@ -135,16 +135,20 @@ def __init__(self, parent, info, title): [translate("MediaInfo", "Info"), translate("MediaInfo", "Value")] ) self.infoTree.setAlternatingRowColors(True) - self.infoTree.setSelectionMode(QAbstractItemView.NoSelection) - self.infoTree.setEditTriggers(QAbstractItemView.NoEditTriggers) + self.infoTree.setSelectionMode( + QAbstractItemView.SelectionMode.NoSelection + ) + self.infoTree.setEditTriggers( + QAbstractItemView.EditTrigger.NoEditTriggers + ) self.infoTree.header().setStretchLastSection(False) self.infoTree.header().setSectionResizeMode( - QHeaderView.ResizeToContents + QHeaderView.ResizeMode.ResizeToContents ) self.layout().addWidget(self.infoTree) self.buttonBox = QDialogButtonBox(self) - self.buttonBox.setStandardButtons(QDialogButtonBox.Close) + self.buttonBox.setStandardButtons(QDialogButtonBox.StandardButton.Close) self.buttonBox.rejected.connect(self.close) self.layout().addWidget(self.buttonBox) diff --git a/lisp/plugins/midi/midi.py b/lisp/plugins/midi/midi.py index 1838f752a..3f9e57f77 100644 --- a/lisp/plugins/midi/midi.py +++ b/lisp/plugins/midi/midi.py @@ -18,7 +18,7 @@ import logging import mido -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.core.plugin import Plugin from lisp.core.signal import Connection diff --git a/lisp/plugins/midi/midi_cue.py b/lisp/plugins/midi/midi_cue.py index afa9aa951..07247277d 100644 --- a/lisp/plugins/midi/midi_cue.py +++ b/lisp/plugins/midi/midi_cue.py @@ -17,8 +17,8 @@ import logging -from PyQt5.QtCore import QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import QVBoxLayout +from PyQt6.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import QVBoxLayout from lisp.core.properties import Property from lisp.cues.cue import Cue, CueAction diff --git a/lisp/plugins/midi/midi_settings.py b/lisp/plugins/midi/midi_settings.py index 7cc264858..273660a4e 100644 --- a/lisp/plugins/midi/midi_settings.py +++ b/lisp/plugins/midi/midi_settings.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP, QTimer -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP, QTimer +from PyQt6.QtWidgets import ( QGroupBox, QVBoxLayout, QComboBox, @@ -40,7 +40,7 @@ class MIDISettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.portsGroup = QGroupBox(self) self.portsGroup.setLayout(QGridLayout()) diff --git a/lisp/plugins/midi/midi_utils.py b/lisp/plugins/midi/midi_utils.py index eb3e26aa2..f6029166c 100644 --- a/lisp/plugins/midi/midi_utils.py +++ b/lisp/plugins/midi/midi_utils.py @@ -18,7 +18,7 @@ from typing import Iterable import mido -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP MIDI_MSGS_SPEC = { "note_on": ["channel", "note", "velocity"], diff --git a/lisp/plugins/midi/widgets.py b/lisp/plugins/midi/widgets.py index 289f46da5..4816d3884 100644 --- a/lisp/plugins/midi/widgets.py +++ b/lisp/plugins/midi/widgets.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QGroupBox, QVBoxLayout, QGridLayout, @@ -48,7 +48,7 @@ class MIDIMessageEdit(QWidget): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.msgGroup = QGroupBox(self) self.msgGroup.setLayout(QGridLayout()) @@ -66,8 +66,8 @@ def __init__(self, **kwargs): self.msgGroup.layout().addWidget(self.msgTypeCombo, 0, 1) line = QFrame(self.msgGroup) - line.setFrameShape(QFrame.HLine) - line.setFrameShadow(QFrame.Sunken) + line.setFrameShape(QFrame.Shape.HLine) + line.setFrameShadow(QFrame.Shadow.Sunken) self.msgGroup.layout().addWidget(line, 1, 0, 1, 2) # Data widgets @@ -140,7 +140,8 @@ def __init__(self, **kwargs): self.layout().addWidget(self.editor) self.buttons = QDialogButtonBox( - QDialogButtonBox.Ok | QDialogButtonBox.Cancel + QDialogButtonBox.StandardButton.Ok + | QDialogButtonBox.StandardButton.Cancel ) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) diff --git a/lisp/plugins/network/discovery_dialogs.py b/lisp/plugins/network/discovery_dialogs.py index 3e1da28d2..ccf6c20d4 100644 --- a/lisp/plugins/network/discovery_dialogs.py +++ b/lisp/plugins/network/discovery_dialogs.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QSize -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QSize +from PyQt6.QtWidgets import ( QVBoxLayout, QListWidget, QDialogButtonBox, @@ -38,7 +38,7 @@ class HostDiscoveryDialog(QDialog): def __init__(self, port, magic, **kwargs): super().__init__(**kwargs) - self.setWindowModality(Qt.WindowModal) + self.setWindowModality(Qt.WindowModality.WindowModal) self.setLayout(QGridLayout()) self.setMinimumSize(300, 200) self.resize(500, 200) @@ -48,7 +48,9 @@ def __init__(self, port, magic, **kwargs): self.listWidget = QListWidget(self) self.listWidget.setAlternatingRowColors(True) - self.listWidget.setSelectionMode(self.listWidget.MultiSelection) + self.listWidget.setSelectionMode( + self.listWidget.SelectionMode.MultiSelection + ) self.layout().addWidget(self.listWidget, 1, 0, 1, 2) self.progressSpinner = QWaitingSpinner( @@ -60,7 +62,7 @@ def __init__(self, port, magic, **kwargs): self.layout().addWidget(self.progressSpinner, 2, 0) self.dialogButton = QDialogButtonBox(self) - self.dialogButton.setStandardButtons(self.dialogButton.Ok) + self.dialogButton.setStandardButtons(QDialogButtonBox.StandardButton.Ok) self.dialogButton.accepted.connect(self.accept) self.layout().addWidget(self.dialogButton, 2, 1) @@ -94,7 +96,7 @@ def exec(self): def hosts(self): return [ - (item.data(Qt.UserRole), item.text()) + (item.data(Qt.ItemDataRole.UserRole), item.text()) for item in self.listWidget.selectedItems() ] @@ -105,7 +107,7 @@ def _host_discovered(self, host, fqdn): item_text = host item = QListWidgetItem(item_text) - item.setData(Qt.UserRole, host) + item.setData(Qt.ItemDataRole.UserRole, host) item.setSizeHint(QSize(100, 30)) self.listWidget.addItem(item) @@ -119,7 +121,7 @@ def __init__(self, hosts, discovery_port, discovery_magic, **kwargs): self.discovery_port = discovery_port self.discovery_magic = discovery_magic - self.setWindowModality(Qt.WindowModal) + self.setWindowModality(Qt.WindowModality.WindowModal) self.setLayout(QHBoxLayout()) self.setMinimumSize(500, 200) self.resize(500, 200) @@ -150,7 +152,7 @@ def __init__(self, hosts, discovery_port, discovery_magic, **kwargs): self.buttonsLayout.addSpacing(70) self.dialogButton = QDialogButtonBox(self) - self.dialogButton.setStandardButtons(self.dialogButton.Ok) + self.dialogButton.setStandardButtons(QDialogButtonBox.StandardButton.Ok) self.dialogButton.accepted.connect(self.accept) self.buttonsLayout.addWidget(self.dialogButton) @@ -193,9 +195,9 @@ def addHosts(self, hosts): self.addHost(*host) def addHost(self, hostname, display_name): - if not self.listWidget.findItems(hostname, Qt.MatchEndsWith): + if not self.listWidget.findItems(hostname, Qt.MatchFlag.MatchEndsWith): item = QListWidgetItem(display_name) - item.setData(Qt.UserRole, hostname) + item.setData(Qt.ItemDataRole.UserRole, hostname) item.setSizeHint(QSize(100, 30)) self.listWidget.addItem(item) @@ -204,7 +206,7 @@ def discoverHosts(self): self.discovery_port, self.discovery_magic, parent=self ) - if dialog.exec() == dialog.Accepted: + if dialog.exec() == dialog.DialogCode.Accepted: for hostname, display_name in dialog.hosts(): self.addHost(hostname, display_name) @@ -219,6 +221,6 @@ def hosts(self): hosts = [] for index in range(self.listWidget.count()): item = self.listWidget.item(index) - hosts.append((item.data(Qt.UserRole), item.text())) + hosts.append((item.data(Qt.ItemDataRole.UserRole), item.text())) return hosts diff --git a/lisp/plugins/osc/osc.py b/lisp/plugins/osc/osc.py index f79639e6d..d1a6c344c 100644 --- a/lisp/plugins/osc/osc.py +++ b/lisp/plugins/osc/osc.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.core.plugin import Plugin from lisp.plugins.osc.osc_cue import OscCue diff --git a/lisp/plugins/osc/osc_cue.py b/lisp/plugins/osc/osc_cue.py index a80276c78..03efd36e6 100644 --- a/lisp/plugins/osc/osc_cue.py +++ b/lisp/plugins/osc/osc_cue.py @@ -18,9 +18,9 @@ import logging -from PyQt5 import QtCore -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt -from PyQt5.QtWidgets import ( +from PyQt6 import QtCore +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt +from PyQt6.QtWidgets import ( QDoubleSpinBox, QGridLayout, QGroupBox, @@ -177,7 +177,7 @@ class OscCueSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.oscGroup = QGroupBox(self) self.oscGroup.setLayout(QGridLayout()) @@ -220,14 +220,14 @@ def __init__(self, **kwargs): self.fadeGroup.layout().addWidget(self.fadeSpin, 0, 0) self.fadeLabel = QLabel(self.fadeGroup) - self.fadeLabel.setAlignment(QtCore.Qt.AlignCenter) + self.fadeLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.fadeGroup.layout().addWidget(self.fadeLabel, 0, 1) self.fadeCurveCombo = FadeComboBox(parent=self.fadeGroup) self.fadeGroup.layout().addWidget(self.fadeCurveCombo, 1, 0) self.fadeCurveLabel = QLabel(self.fadeGroup) - self.fadeCurveLabel.setAlignment(QtCore.Qt.AlignCenter) + self.fadeCurveLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.fadeGroup.layout().addWidget(self.fadeCurveLabel, 1, 1) self.pathEdit.textEdited.connect(self.__fixPath) @@ -316,16 +316,18 @@ def __init__(self, **kwargs): BoolCheckBoxDelegate(), ] - self.setSelectionBehavior(QTableWidget.SelectRows) - self.setSelectionMode(QTableView.SingleSelection) + self.setSelectionBehavior(QTableWidget.SelectionBehavior.SelectRows) + self.setSelectionMode(QTableView.SelectionMode.SingleSelection) self.setShowGrid(False) self.setAlternatingRowColors(True) - self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) + self.horizontalHeader().setSectionResizeMode( + QHeaderView.ResizeMode.Stretch + ) self.horizontalHeader().setHighlightSections(False) - self.verticalHeader().sectionResizeMode(QHeaderView.Fixed) + self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Fixed) self.verticalHeader().setDefaultSectionSize(24) self.verticalHeader().setHighlightSections(False) @@ -379,7 +381,7 @@ def _toString(self, modelRow): modelRow[COL_START_VALUE] = "text" def _dataChanged(self, _, bottom_right, roles): - if Qt.EditRole not in roles: + if Qt.ItemDataRole.EditRole not in roles: return # NOTE: We assume one item will change at the time diff --git a/lisp/plugins/osc/osc_delegate.py b/lisp/plugins/osc/osc_delegate.py index 106cedcf1..fd80e0e50 100644 --- a/lisp/plugins/osc/osc_delegate.py +++ b/lisp/plugins/osc/osc_delegate.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtWidgets import QStyledItemDelegate, QSpinBox, QDoubleSpinBox +from PyQt6.QtWidgets import QStyledItemDelegate, QSpinBox, QDoubleSpinBox class OscArgumentDelegate(QStyledItemDelegate): diff --git a/lisp/plugins/osc/osc_settings.py b/lisp/plugins/osc/osc_settings.py index b3a149c0c..fb2a5f9f9 100644 --- a/lisp/plugins/osc/osc_settings.py +++ b/lisp/plugins/osc/osc_settings.py @@ -16,8 +16,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt +from PyQt6.QtWidgets import ( QVBoxLayout, QGridLayout, QGroupBox, @@ -37,14 +37,14 @@ class OscSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.inwardsGroupBox = QGroupBox(self) self.inwardsGroupBox.setLayout(QGridLayout()) self.layout().addWidget(self.inwardsGroupBox) self.inwardsLabel = QLabel() - self.inwardsLabel.setAlignment(Qt.AlignCenter) + self.inwardsLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) font = self.inwardsLabel.font() font.setPointSizeF(font.pointSizeF() * 0.9) self.inwardsLabel.setFont(font) @@ -67,7 +67,7 @@ def __init__(self, **kwargs): self.layout().addWidget(self.outwardsGroupBox) self.outwardsLabel = QLabel() - self.outwardsLabel.setAlignment(Qt.AlignCenter) + self.outwardsLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.outwardsLabel.setFont(font) self.outwardsGroupBox.layout().addWidget(self.outwardsLabel, 0, 0, 1, 2) diff --git a/lisp/plugins/presets/presets.py b/lisp/plugins/presets/presets.py index 693c6f35e..95e783de2 100644 --- a/lisp/plugins/presets/presets.py +++ b/lisp/plugins/presets/presets.py @@ -17,7 +17,7 @@ import os -from PyQt5.QtWidgets import QAction +from PyQt6.QtGui import QAction from lisp.core.plugin import Plugin from lisp.layout.cue_layout import CueLayout diff --git a/lisp/plugins/presets/presets_ui.py b/lisp/plugins/presets/presets_ui.py index 2ec93d7d7..2ab662b9c 100644 --- a/lisp/plugins/presets/presets_ui.py +++ b/lisp/plugins/presets/presets_ui.py @@ -18,8 +18,8 @@ import logging from zipfile import BadZipFile -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QComboBox, QDialog, QInputDialog, @@ -115,10 +115,11 @@ def check_override_dialog(preset_name): "Presets", 'Preset "{}" already exists, overwrite?', ).format(preset_name), - buttons=QMessageBox.Yes | QMessageBox.Cancel, + buttons=QMessageBox.StandardButton.Yes + | QMessageBox.StandardButton.Cancel, ) - return answer == QMessageBox.Yes + return answer == QMessageBox.StandardButton.Yes def save_preset_dialog(base_name=""): @@ -147,9 +148,11 @@ def __init__(self, app, **kwargs): # TODO: natural sorting (QStringListModel + QListView + ProxyModel) self.presetsList = QListWidget(self) self.presetsList.setAlternatingRowColors(True) - self.presetsList.setFocusPolicy(Qt.NoFocus) + self.presetsList.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.presetsList.setSortingEnabled(True) - self.presetsList.setSelectionMode(QListWidget.ExtendedSelection) + self.presetsList.setSelectionMode( + QListWidget.SelectionMode.ExtendedSelection + ) self.presetsList.itemSelectionChanged.connect(self.__selection_changed) self.presetsList.itemDoubleClicked.connect(self.__edit_preset) self.layout().addWidget(self.presetsList, 0, 0) @@ -159,7 +162,9 @@ def __init__(self, app, **kwargs): self.presetsButtons.setLayout(QVBoxLayout()) self.presetsButtons.layout().setContentsMargins(0, 0, 0, 0) self.layout().addWidget(self.presetsButtons, 0, 1) - self.layout().setAlignment(self.presetsButtons, Qt.AlignTop) + self.layout().setAlignment( + self.presetsButtons, Qt.AlignmentFlag.AlignTop + ) self.addPresetButton = QPushButton(self.presetsButtons) self.addPresetButton.clicked.connect(self.__add_preset) @@ -190,7 +195,7 @@ def __init__(self, app, **kwargs): self.ieButtons.setLayout(QHBoxLayout()) self.ieButtons.layout().setContentsMargins(0, 0, 0, 0) self.layout().addWidget(self.ieButtons, 1, 0) - self.layout().setAlignment(self.ieButtons, Qt.AlignLeft) + self.layout().setAlignment(self.ieButtons, Qt.AlignmentFlag.AlignLeft) self.exportSelectedButton = QPushButton(self.ieButtons) self.exportSelectedButton.clicked.connect(self.__export_presets) @@ -202,7 +207,9 @@ def __init__(self, app, **kwargs): # Dialog buttons self.dialogButtons = QDialogButtonBox(self) - self.dialogButtons.setStandardButtons(QDialogButtonBox.Ok) + self.dialogButtons.setStandardButtons( + QDialogButtonBox.StandardButton.Ok + ) self.dialogButtons.accepted.connect(self.accept) self.layout().addWidget(self.dialogButtons, 1, 1) @@ -245,7 +252,7 @@ def __remove_preset(self): def __add_preset(self): dialog = NewPresetDialog(parent=self) - if dialog.exec() == QDialog.Accepted: + if dialog.exec() == QDialog.DialogCode.Accepted: preset_name = dialog.get_name() cue_type = dialog.get_type() @@ -291,7 +298,7 @@ def __edit_preset(self): edit_dialog = CueSettingsDialog(cue_class) edit_dialog.loadSettings(preset) - if edit_dialog.exec() == edit_dialog.Accepted: + if edit_dialog.exec() == edit_dialog.DialogCode.Accepted: preset.update(edit_dialog.getSettings()) try: write_preset(item.text(), preset) @@ -357,10 +364,11 @@ def __import_presets(self): "Presets", "Some presets already exists, overwrite?", ), - buttons=QMessageBox.Yes | QMessageBox.Cancel, + buttons=QMessageBox.StandardButton.Yes + | QMessageBox.StandardButton.Cancel, ) - if answer != QMessageBox.Yes: + if answer != QMessageBox.StandardButton.Yes: return import_presets(archive) @@ -408,7 +416,8 @@ def __init__(self, **kwargs): self.dialogButtons = QDialogButtonBox(self) self.dialogButtons.setStandardButtons( - QDialogButtonBox.Ok | QDialogButtonBox.Cancel + QDialogButtonBox.StandardButton.Ok + | QDialogButtonBox.StandardButton.Cancel ) self.dialogButtons.accepted.connect(self.accept) self.dialogButtons.rejected.connect(self.reject) diff --git a/lisp/plugins/rename_cues/rename_cues.py b/lisp/plugins/rename_cues/rename_cues.py index f40c02da1..d2cc61ff6 100644 --- a/lisp/plugins/rename_cues/rename_cues.py +++ b/lisp/plugins/rename_cues/rename_cues.py @@ -16,7 +16,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtWidgets import QAction, QDialog +from PyQt6.QtGui import QAction +from PyQt6.QtWidgets import QDialog from lisp.core.plugin import Plugin from lisp.plugins.rename_cues.command import RenameCuesCommand @@ -55,7 +56,7 @@ def rename(self): renameUi.exec() - if renameUi.result() == QDialog.Accepted: + if renameUi.result() == QDialog.DialogCode.Accepted: self.app.commands_stack.do( RenameCuesCommand(self.app.cue_model, renameUi.cues_list) ) diff --git a/lisp/plugins/rename_cues/rename_ui.py b/lisp/plugins/rename_cues/rename_ui.py index b8b835d85..e1f1a5994 100644 --- a/lisp/plugins/rename_cues/rename_ui.py +++ b/lisp/plugins/rename_cues/rename_ui.py @@ -19,8 +19,8 @@ import logging import re -from PyQt5.QtCore import Qt, QSize -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QSize +from PyQt6.QtWidgets import ( QDialog, QDialogButtonBox, QGridLayout, @@ -44,7 +44,7 @@ def __init__(self, parent=None, selected_cues=()): super().__init__(parent) self.setWindowTitle(translate("RenameCues", "Rename cues")) - self.setWindowModality(Qt.ApplicationModal) + self.setWindowModality(Qt.WindowModality.ApplicationModal) self.resize(650, 350) self.setLayout(QGridLayout()) @@ -61,7 +61,9 @@ def __init__(self, parent=None, selected_cues=()): self.previewList.resizeColumnToContents(0) self.previewList.resizeColumnToContents(1) self.previewList.setColumnWidth(0, 300) - self.previewList.setSelectionMode(QAbstractItemView.ExtendedSelection) + self.previewList.setSelectionMode( + QAbstractItemView.SelectionMode.ExtendedSelection + ) self.previewList.itemSelectionChanged.connect( self.onPreviewListItemSelectionChanged ) @@ -133,7 +135,8 @@ def __init__(self, parent=None, selected_cues=()): # OK / Cancel buttons self.dialogButtons = QDialogButtonBox() self.dialogButtons.setStandardButtons( - QDialogButtonBox.Ok | QDialogButtonBox.Cancel + QDialogButtonBox.StandardButton.Ok + | QDialogButtonBox.StandardButton.Cancel ) self.layout().addWidget(self.dialogButtons, 6, 3) @@ -228,7 +231,7 @@ def onResetButtonClicked(self): def onHelpButtonClicked(self): msg = QMessageBox() - msg.setIcon(QMessageBox.Information) + msg.setIcon(QMessageBox.Icon.Information) msg.setWindowTitle(translate("RenameCues", "Regex help")) msg.setText( translate( diff --git a/lisp/plugins/replay_gain/gain_ui.py b/lisp/plugins/replay_gain/gain_ui.py index 801fe3ab1..712c354a6 100644 --- a/lisp/plugins/replay_gain/gain_ui.py +++ b/lisp/plugins/replay_gain/gain_ui.py @@ -17,8 +17,8 @@ from os import cpu_count -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QDialog, QDialogButtonBox, QRadioButton, @@ -38,7 +38,7 @@ class GainUi(QDialog): def __init__(self, parent=None): super().__init__(parent) - self.setWindowModality(Qt.ApplicationModal) + self.setWindowModality(Qt.WindowModality.ApplicationModal) self.setMaximumSize(380, 210) self.setMinimumSize(380, 210) self.resize(380, 210) @@ -72,8 +72,8 @@ def __init__(self, parent=None): self.layout().addWidget(self.selectionMode, 2, 0, 1, 2) self.line = QFrame(self) - self.line.setFrameShape(QFrame.HLine) - self.line.setFrameShadow(QFrame.Sunken) + self.line.setFrameShape(QFrame.Shape.HLine) + self.line.setFrameShadow(QFrame.Shadow.Sunken) self.layout().addWidget(self.line, 3, 0, 1, 2) # Max threads (up to cpu count) @@ -90,7 +90,8 @@ def __init__(self, parent=None): self.dialogButtons = QDialogButtonBox(self) self.dialogButtons.setStandardButtons( - QDialogButtonBox.Ok | QDialogButtonBox.Cancel + QDialogButtonBox.StandardButton.Ok + | QDialogButtonBox.StandardButton.Cancel ) self.layout().addWidget(self.dialogButtons, 5, 0, 1, 2) @@ -141,7 +142,7 @@ class GainProgressDialog(QProgressDialog): def __init__(self, maximum, parent=None): super().__init__(parent) - self.setWindowModality(Qt.ApplicationModal) + self.setWindowModality(Qt.WindowModality.ApplicationModal) self.setWindowTitle(translate("ReplayGain", "Processing files ...")) self.setMaximumSize(320, 110) self.setMinimumSize(320, 110) diff --git a/lisp/plugins/replay_gain/replay_gain.py b/lisp/plugins/replay_gain/replay_gain.py index 33c4bf166..2577be6fa 100644 --- a/lisp/plugins/replay_gain/replay_gain.py +++ b/lisp/plugins/replay_gain/replay_gain.py @@ -23,7 +23,8 @@ gi.require_version("Gst", "1.0") from gi.repository import Gst -from PyQt5.QtWidgets import QMenu, QAction, QDialog +from PyQt6.QtWidgets import QMenu, QDialog +from PyQt6.QtGui import QAction from lisp.command.command import Command from lisp.core.plugin import Plugin @@ -71,7 +72,7 @@ def gain(self): gainUi = GainUi(self.app.window) gainUi.exec() - if gainUi.result() == QDialog.Accepted: + if gainUi.result() == QDialog.DialogCode.Accepted: if gainUi.only_selected(): cues = self.app.layout.selected_cues(MediaCue) else: diff --git a/lisp/plugins/synchronizer/synchronizer.py b/lisp/plugins/synchronizer/synchronizer.py index 8090139bc..041ef347c 100644 --- a/lisp/plugins/synchronizer/synchronizer.py +++ b/lisp/plugins/synchronizer/synchronizer.py @@ -18,7 +18,8 @@ import logging import requests -from PyQt5.QtWidgets import QMenu, QAction, QMessageBox +from PyQt6.QtGui import QAction +from PyQt6.QtWidgets import QMenu, QMessageBox from lisp.core.plugin import Plugin from lisp.core.signal import Connection diff --git a/lisp/plugins/timecode/settings.py b/lisp/plugins/timecode/settings.py index d32ac28bf..7a47bee8b 100644 --- a/lisp/plugins/timecode/settings.py +++ b/lisp/plugins/timecode/settings.py @@ -17,8 +17,8 @@ # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt +from PyQt6.QtWidgets import ( QGridLayout, QVBoxLayout, QGroupBox, @@ -40,7 +40,7 @@ class TimecodeSettings(CueSettingsPage): def __init__(self, cueType, **kwargs): super().__init__(cueType, **kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.groupBox = QGroupBox(self) self.groupBox.setLayout(QGridLayout()) @@ -63,13 +63,13 @@ def __init__(self, cueType, **kwargs): self.groupBox.layout().addWidget(self.trackSpin, 2, 0) self.trackLabel = QLabel(self.groupBox) - self.trackLabel.setAlignment(Qt.AlignCenter) + self.trackLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.groupBox.layout().addWidget(self.trackLabel, 2, 1) self.layout().addSpacing(50) self.warnLabel = QLabel(self) - self.warnLabel.setAlignment(Qt.AlignCenter) + self.warnLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.warnLabel.setStyleSheet("color: #FFA500; font-weight: bold") self.layout().addWidget(self.warnLabel) @@ -116,7 +116,7 @@ class TimecodeAppSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.groupBox = QGroupBox(self) self.groupBox.setLayout(QGridLayout()) diff --git a/lisp/plugins/triggers/triggers_handler.py b/lisp/plugins/triggers/triggers_handler.py index d69398c2c..06352b8f0 100644 --- a/lisp/plugins/triggers/triggers_handler.py +++ b/lisp/plugins/triggers/triggers_handler.py @@ -17,7 +17,7 @@ from enum import Enum -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.core.signal import Connection from lisp.cues.cue import CueAction diff --git a/lisp/plugins/triggers/triggers_settings.py b/lisp/plugins/triggers/triggers_settings.py index d0a4adf12..d203176ce 100644 --- a/lisp/plugins/triggers/triggers_settings.py +++ b/lisp/plugins/triggers/triggers_settings.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt +from PyQt6.QtWidgets import ( QVBoxLayout, QDialogButtonBox, QSizePolicy, @@ -64,19 +64,19 @@ def __init__(self, **kwargs): self.dialogButtons = QDialogButtonBox(self.triggerGroup) self.dialogButtons.setSizePolicy( - QSizePolicy.Minimum, QSizePolicy.Minimum + QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum ) self.triggerGroup.layout().addWidget(self.dialogButtons) self.addButton = QPushButton() self.dialogButtons.addButton( - self.addButton, QDialogButtonBox.ActionRole + self.addButton, QDialogButtonBox.ButtonRole.ActionRole ) self.addButton.clicked.connect(self._addTrigger) self.delButton = QPushButton() self.dialogButtons.addButton( - self.delButton, QDialogButtonBox.ActionRole + self.delButton, QDialogButtonBox.ButtonRole.ActionRole ) self.delButton.clicked.connect(self._removeCurrentTrigger) @@ -140,16 +140,18 @@ class TriggersView(QTableView): def __init__(self, cueModel, cueSelect, **kwargs): super().__init__(**kwargs) - self.setSelectionBehavior(QTableView.SelectRows) - self.setSelectionMode(QTableView.SingleSelection) + self.setSelectionBehavior(QTableView.SelectionBehavior.SelectRows) + self.setSelectionMode(QTableView.SelectionMode.SingleSelection) self.setShowGrid(False) self.setAlternatingRowColors(True) - self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) + self.horizontalHeader().setSectionResizeMode( + QHeaderView.ResizeMode.Stretch + ) self.horizontalHeader().setHighlightSections(False) - self.verticalHeader().sectionResizeMode(QHeaderView.Fixed) + self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Fixed) self.verticalHeader().setDefaultSectionSize(26) self.verticalHeader().setHighlightSections(False) @@ -178,7 +180,7 @@ def __init__(self): self.rows_cc = [] - def setData(self, index, value, role=Qt.DisplayRole): + def setData(self, index, value, role=Qt.ItemDataRole.DisplayRole): result = super().setData(index, value, role) if result and role == CueClassRole: @@ -187,7 +189,7 @@ def setData(self, index, value, role=Qt.DisplayRole): self.dataChanged.emit( self.index(index.row(), 2), self.index(index.row(), 2), - [Qt.DisplayRole, Qt.EditRole], + [Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.EditRole], ) return result diff --git a/lisp/ui/about.py b/lisp/ui/about.py index 3003a059a..98adbec9f 100644 --- a/lisp/ui/about.py +++ b/lisp/ui/about.py @@ -15,11 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see -from collections import OrderedDict - -from PyQt5 import QtCore -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import ( +from PyQt6 import QtCore +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import ( QDialog, QGridLayout, QLabel, @@ -60,7 +58,7 @@ class About(QDialog): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.setWindowModality(QtCore.Qt.ApplicationModal) + self.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) self.setWindowTitle(translate("About", "About Linux Show Player")) self.setMaximumSize(550, 420) self.setMinimumSize(550, 420) @@ -75,7 +73,7 @@ def __init__(self, *args, **kwargs): self.layout().addWidget(self.iconLabel, 0, 0) self.shortInfo = QLabel(self) - self.shortInfo.setAlignment(Qt.AlignCenter) + self.shortInfo.setAlignment(Qt.AlignmentFlag.AlignCenter) self.shortInfo.setText( f"

Linux Show Player {lisp.__version__}

" "Copyright © Francesco Ceruti" @@ -131,7 +129,7 @@ def __init__(self, *args, **kwargs): ) # Ok button - self.buttons = QDialogButtonBox(QDialogButtonBox.Ok) + self.buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok) self.buttons.accepted.connect(self.accept) self.layout().addWidget(self.buttons, 3, 1) diff --git a/lisp/ui/cuelistdialog.py b/lisp/ui/cuelistdialog.py index 5b7edf48e..bed80a53b 100644 --- a/lisp/ui/cuelistdialog.py +++ b/lisp/ui/cuelistdialog.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QDialog, QTreeWidget, QHeaderView, @@ -31,7 +31,7 @@ def __init__( self, cues=None, properties=("index", "name"), - selection_mode=QTreeWidget.SingleSelection, + selection_mode=QTreeWidget.SelectionMode.SingleSelection, **kwargs, ): super().__init__(**kwargs) @@ -43,14 +43,16 @@ def __init__( self.list = QTreeWidget(self) self.list.setSelectionMode(selection_mode) - self.list.setSelectionBehavior(QTreeWidget.SelectRows) + self.list.setSelectionBehavior(QTreeWidget.SelectionBehavior.SelectRows) self.list.setAlternatingRowColors(True) self.list.setIndentation(0) self.list.setHeaderLabels([prop.title() for prop in properties]) - self.list.header().setSectionResizeMode(QHeaderView.Fixed) - self.list.header().setSectionResizeMode(1, QHeaderView.Stretch) + self.list.header().setSectionResizeMode(QHeaderView.ResizeMode.Fixed) + self.list.header().setSectionResizeMode( + 1, QHeaderView.ResizeMode.Stretch + ) self.list.header().setStretchLastSection(False) - self.list.sortByColumn(0, Qt.AscendingOrder) + self.list.sortByColumn(0, Qt.SortOrder.AscendingOrder) self.list.setSortingEnabled(True) if cues is not None: @@ -60,8 +62,8 @@ def __init__( self.layout().addWidget(self.list) self.buttons = QDialogButtonBox(self) - self.buttons.addButton(QDialogButtonBox.Cancel) - self.buttons.addButton(QDialogButtonBox.Ok) + self.buttons.addButton(QDialogButtonBox.StandardButton.Cancel) + self.buttons.addButton(QDialogButtonBox.StandardButton.Ok) self.layout().addWidget(self.buttons) self.buttons.accepted.connect(self.accept) @@ -69,17 +71,17 @@ def __init__( def add_cue(self, cue): item = QTreeWidgetItem() - item.setTextAlignment(0, Qt.AlignCenter) + item.setTextAlignment(0, Qt.AlignmentFlag.AlignCenter) for n, prop in enumerate(self._properties): value = getattr(cue, prop, "Undefined") if prop == "index" and isinstance(value, int): value += 1 - item.setData(n, Qt.DisplayRole, value) + item.setData(n, Qt.ItemDataRole.DisplayRole, value) self._cues[cue] = item - item.setData(0, Qt.UserRole, cue) + item.setData(0, Qt.ItemDataRole.UserRole, cue) self.list.addTopLevelItem(item) def add_cues(self, cues): @@ -99,10 +101,10 @@ def reset(self): def selected_cues(self): cues = [] for item in self.list.selectedItems(): - cues.append(item.data(0, Qt.UserRole)) + cues.append(item.data(0, Qt.ItemDataRole.UserRole)) return cues def selected_cue(self): items = self.list.selectedItems() if items: - return items[0].data(0, Qt.UserRole) + return items[0].data(0, Qt.ItemDataRole.UserRole) diff --git a/lisp/ui/icons/__init__.py b/lisp/ui/icons/__init__.py index 2ce085b8e..7850226db 100644 --- a/lisp/ui/icons/__init__.py +++ b/lisp/ui/icons/__init__.py @@ -19,7 +19,7 @@ import os from typing import Union -from PyQt5.QtGui import QIcon +from PyQt6.QtGui import QIcon from lisp import ICON_THEMES_DIR, ICON_THEME_COMMON diff --git a/lisp/ui/layoutselect.py b/lisp/ui/layoutselect.py index e1e1ed5e3..20f522198 100644 --- a/lisp/ui/layoutselect.py +++ b/lisp/ui/layoutselect.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtWidgets import ( +from PyQt6.QtWidgets import ( QDialog, QComboBox, QPushButton, @@ -59,8 +59,8 @@ def __init__(self, application, **kwargs): self.layout().setColumnStretch(2, 1) line = QFrame(self) - line.setFrameShape(QFrame.HLine) - line.setFrameShadow(QFrame.Sunken) + line.setFrameShape(QFrame.Shape.HLine) + line.setFrameShadow(QFrame.Shadow.Sunken) self.layout().addWidget(line, 1, 0, 1, 3) self.description = QTextBrowser(self) diff --git a/lisp/ui/logging/common.py b/lisp/ui/logging/common.py index eb68f9539..d1adf7b54 100644 --- a/lisp/ui/logging/common.py +++ b/lisp/ui/logging/common.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP LOG_LEVELS = { "DEBUG": QT_TRANSLATE_NOOP("Logging", "Debug"), @@ -51,5 +51,5 @@ "exc_info": QT_TRANSLATE_NOOP("Logging", "Exception info"), } -LogRecordRole = Qt.UserRole -LogAttributeRole = Qt.UserRole + 1 +LogRecordRole = Qt.ItemDataRole.UserRole +LogAttributeRole = Qt.ItemDataRole.UserRole + 1 diff --git a/lisp/ui/logging/details.py b/lisp/ui/logging/details.py index 08dce24ad..59676c338 100644 --- a/lisp/ui/logging/details.py +++ b/lisp/ui/logging/details.py @@ -17,8 +17,8 @@ import traceback -from PyQt5.QtGui import QFontDatabase -from PyQt5.QtWidgets import QTextEdit +from PyQt6.QtGui import QFontDatabase +from PyQt6.QtWidgets import QTextEdit from lisp.ui.logging.common import LOG_ATTRIBUTES @@ -28,10 +28,12 @@ def __init__(self, *args): super().__init__(*args) self._record = None - self.setLineWrapMode(self.NoWrap) + self.setLineWrapMode(self.LineWrapMode.NoWrap) self.setReadOnly(True) - self.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont)) + self.setFont( + QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont) + ) def setLogRecord(self, record): self._record = record diff --git a/lisp/ui/logging/dialog.py b/lisp/ui/logging/dialog.py index 4482d8548..41f55a01e 100644 --- a/lisp/ui/logging/dialog.py +++ b/lisp/ui/logging/dialog.py @@ -17,8 +17,8 @@ import logging -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import ( QDialog, QGridLayout, QLabel, @@ -55,14 +55,16 @@ class MultiMessagesBox(QDialog): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QGridLayout()) - self.setWindowModality(Qt.ApplicationModal) - self.layout().setSizeConstraint(QGridLayout.SetFixedSize) + self.setWindowModality(Qt.WindowModality.ApplicationModal) + self.layout().setSizeConstraint(QGridLayout.SizeConstraint.SetFixedSize) self._formatter = logging.Formatter() self._records = [] self.iconLabel = QLabel(self) - self.iconLabel.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred) + self.iconLabel.setSizePolicy( + QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred + ) self.layout().addWidget(self.iconLabel, 0, 0) self.messageLabel = QLabel(self) @@ -72,25 +74,29 @@ def __init__(self, **kwargs): self.buttonBox = QDialogButtonBox(self) self.layout().addWidget(self.buttonBox, 1, 0, 1, 2) - self.okButton = self.buttonBox.addButton(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.addButton( + QDialogButtonBox.StandardButton.Ok + ) self.okButton.clicked.connect(self.nextRecord) self.dismissButton = QPushButton(self) self.dismissButton.setText(translate("Logging", "Dismiss all")) self.dismissButton.clicked.connect(self.dismissAll) self.dismissButton.hide() - self.buttonBox.addButton(self.dismissButton, QDialogButtonBox.ResetRole) + self.buttonBox.addButton( + self.dismissButton, QDialogButtonBox.ButtonRole.ResetRole + ) self.detailsButton = QPushButton(self) self.detailsButton.setCheckable(True) self.detailsButton.setText(translate("Logging", "Show details")) self.buttonBox.addButton( - self.detailsButton, QDialogButtonBox.ActionRole + self.detailsButton, QDialogButtonBox.ButtonRole.ActionRole ) self.detailsText = QTextEdit(self) self.detailsText.setReadOnly(True) - self.detailsText.setLineWrapMode(QTextEdit.NoWrap) + self.detailsText.setLineWrapMode(QTextEdit.LineWrapMode.NoWrap) self.detailsText.hide() self.layout().addWidget(self.detailsText, 2, 0, 1, 2) diff --git a/lisp/ui/logging/models.py b/lisp/ui/logging/models.py index 9e448c3f9..e07114de2 100644 --- a/lisp/ui/logging/models.py +++ b/lisp/ui/logging/models.py @@ -17,13 +17,13 @@ from collections import deque -from PyQt5.QtCore import ( +from PyQt6.QtCore import ( QModelIndex, Qt, QSortFilterProxyModel, QAbstractTableModel, ) -from PyQt5.QtGui import QFont, QColor +from PyQt6.QtGui import QFont, QColor from lisp.core.util import typename from lisp.ui.logging.common import ( @@ -35,7 +35,7 @@ class LogRecordModel(QAbstractTableModel): Font = QFont("Monospace") - Font.setStyleHint(QFont.Monospace) + Font.setStyleHint(QFont.StyleHint.Monospace) def __init__(self, columns, bg, fg, limit=0, **kwargs): """ @@ -68,29 +68,31 @@ def rowCount(self, parent=QModelIndex()): return len(self._records) - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): if index.isValid(): record = self._records[index.row()] - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: try: return getattr(record, self._columns[index.column()]) except AttributeError: pass - elif role == Qt.BackgroundColorRole: + elif role == Qt.ItemDataRole.BackgroundColorRole: return self._backgrounds.get(record.levelname) - elif role == Qt.ForegroundRole: + elif role == Qt.ItemDataRole.ForegroundRole: return self._foregrounds.get(record.levelname) - elif role == Qt.FontRole: + elif role == Qt.ItemDataRole.FontRole: return LogRecordModel.Font elif role == LogRecordRole: return record - def headerData(self, index, orientation, role=Qt.DisplayRole): - if orientation == Qt.Horizontal and index < len(self._columns_names): + def headerData(self, index, orientation, role=Qt.ItemDataRole.DisplayRole): + if orientation == Qt.Orientation.Horizontal and index < len( + self._columns_names + ): if role == LogAttributeRole: return self._columns[index] - elif role == Qt.DisplayRole: + elif role == Qt.ItemDataRole.DisplayRole: return self._columns_names[index] def append(self, record): diff --git a/lisp/ui/logging/status.py b/lisp/ui/logging/status.py index 8852cfb92..e17b76937 100644 --- a/lisp/ui/logging/status.py +++ b/lisp/ui/logging/status.py @@ -17,8 +17,8 @@ import logging -from PyQt5.QtCore import pyqtSignal -from PyQt5.QtWidgets import QLabel, QWidget, QHBoxLayout, QSizePolicy +from PyQt6.QtCore import pyqtSignal +from PyQt6.QtWidgets import QLabel, QWidget, QHBoxLayout, QSizePolicy from lisp.ui.icons import IconTheme from lisp.ui.ui_utils import translate @@ -44,11 +44,15 @@ def __init__(self, log_model, icons_size=16, **kwargs): self._errors = 0 self.errorsCount = QLabel("0", self) - self.errorsCount.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) + self.errorsCount.setSizePolicy( + QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed + ) self.layout().addWidget(self.errorsCount) self.errorIcon = QLabel(self) - self.errorIcon.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) + self.errorIcon.setSizePolicy( + QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed + ) self.errorIcon.setPixmap( IconTheme.get("dialog-error").pixmap(icons_size) ) diff --git a/lisp/ui/logging/viewer.py b/lisp/ui/logging/viewer.py index d6b6ad417..430d6cf03 100644 --- a/lisp/ui/logging/viewer.py +++ b/lisp/ui/logging/viewer.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import ( - QAction, +from PyQt6.QtCore import Qt +from PyQt6.QtGui import QAction +from PyQt6.QtWidgets import ( QToolBar, QMainWindow, QStatusBar, @@ -55,7 +55,7 @@ def __init__(self, log_model, config, **kwargs): ) self.resize(800, 600) self.setCentralWidget(QSplitter()) - self.centralWidget().setOrientation(Qt.Vertical) + self.centralWidget().setOrientation(Qt.Orientation.Vertical) self.setStatusBar(QStatusBar(self)) # Add a permanent label to the toolbar to display shown/filter records @@ -64,7 +64,9 @@ def __init__(self, log_model, config, **kwargs): # ToolBar self.optionsToolBar = QToolBar(self) - self.optionsToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) + self.optionsToolBar.setToolButtonStyle( + Qt.ToolButtonStyle.ToolButtonTextBesideIcon + ) self.addToolBar(self.optionsToolBar) # Create level-toggle actions self.levelsActions = self._createActions( @@ -84,8 +86,10 @@ def __init__(self, log_model, config, **kwargs): # View to display the messages stored in the model self.logView = QTableView(self) self.logView.setModel(self.filterModel) - self.logView.setSelectionMode(QTableView.SingleSelection) - self.logView.setSelectionBehavior(QTableView.SelectRows) + self.logView.setSelectionMode(QTableView.SelectionMode.SingleSelection) + self.logView.setSelectionBehavior( + QTableView.SelectionBehavior.SelectRows + ) self.logView.horizontalHeader().setStretchLastSection(True) self.centralWidget().addWidget(self.logView) @@ -99,7 +103,7 @@ def __init__(self, log_model, config, **kwargs): # Setup visible columns for n in range(self.filterModel.columnCount()): column = self.filterModel.headerData( - n, Qt.Horizontal, LogAttributeRole + n, Qt.Orientation.Horizontal, LogAttributeRole ) self.logView.setColumnHidden(n, column not in visible_columns) diff --git a/lisp/ui/mainwindow.py b/lisp/ui/mainwindow.py index 2c1797e0d..677a505df 100644 --- a/lisp/ui/mainwindow.py +++ b/lisp/ui/mainwindow.py @@ -19,16 +19,15 @@ import os from functools import partial -from PyQt5 import QtCore -from PyQt5.QtCore import pyqtSignal, QT_TRANSLATE_NOOP -from PyQt5.QtGui import QKeySequence -from PyQt5.QtWidgets import ( +from PyQt6 import QtCore +from PyQt6.QtCore import pyqtSignal, QT_TRANSLATE_NOOP +from PyQt6.QtGui import QKeySequence, QAction +from PyQt6.QtWidgets import ( QMainWindow, QStatusBar, QMenuBar, QMenu, - QAction, - qApp, + QApplication, QFileDialog, QMessageBox, QVBoxLayout, @@ -63,7 +62,7 @@ def __init__(self, app, title="Linux Show Player", **kwargs): """:type app: lisp.application.Application""" super().__init__(**kwargs) self.setMinimumSize(500, 400) - self.setGeometry(qApp.desktop().availableGeometry(self)) + self.setGeometry(QApplication.primaryScreen().availableGeometry()) self.setCentralWidget(QWidget()) self.centralWidget().setLayout(QVBoxLayout()) self.centralWidget().layout().setContentsMargins(5, 5, 5, 5) @@ -87,7 +86,9 @@ def __init__(self, app, title="Linux Show Player", **kwargs): # Menubar self.menubar = QMenuBar(self) self.menubar.setGeometry(QtCore.QRect(0, 0, 0, 25)) - self.menubar.setContextMenuPolicy(QtCore.Qt.PreventContextMenu) + self.menubar.setContextMenuPolicy( + QtCore.Qt.ContextMenuPolicy.PreventContextMenu + ) self.menuFile = QMenu(self.menubar) self.menuEdit = QMenu(self.menubar) @@ -164,7 +165,7 @@ def __init__(self, app, title="Linux Show Player", **kwargs): self.actionAbout.triggered.connect(self.__about) self.actionAbout_Qt = QAction(self) - self.actionAbout_Qt.triggered.connect(qApp.aboutQt) + self.actionAbout_Qt.triggered.connect(QApplication.aboutQt) self.menuAbout.addAction(self.actionAbout) self.menuAbout.addSeparator() @@ -190,30 +191,30 @@ def retranslateUi(self): # menuFile self.menuFile.setTitle(translate("MainWindow", "&File")) self.newSessionAction.setText(translate("MainWindow", "New session")) - self.newSessionAction.setShortcut(QKeySequence.New) + self.newSessionAction.setShortcut(QKeySequence.StandardKey.New) self.openSessionAction.setText(translate("MainWindow", "Open")) - self.openSessionAction.setShortcut(QKeySequence.Open) + self.openSessionAction.setShortcut(QKeySequence.StandardKey.Open) self.saveSessionAction.setText(translate("MainWindow", "Save session")) - self.saveSessionAction.setShortcut(QKeySequence.Save) + self.saveSessionAction.setShortcut(QKeySequence.StandardKey.Save) self.editPreferences.setText(translate("MainWindow", "Preferences")) - self.editPreferences.setShortcut(QKeySequence.Preferences) + self.editPreferences.setShortcut(QKeySequence.StandardKey.Preferences) self.saveSessionWithName.setText(translate("MainWindow", "Save as")) - self.saveSessionWithName.setShortcut(QKeySequence.SaveAs) + self.saveSessionWithName.setShortcut(QKeySequence.StandardKey.SaveAs) self.fullScreenAction.setText(translate("MainWindow", "Full Screen")) - self.fullScreenAction.setShortcut(QKeySequence.FullScreen) + self.fullScreenAction.setShortcut(QKeySequence.StandardKey.FullScreen) self.exitAction.setText(translate("MainWindow", "Exit")) - self.exitAction.setShortcut(QKeySequence.Quit) + self.exitAction.setShortcut(QKeySequence.StandardKey.Quit) # menuEdit self.menuEdit.setTitle(translate("MainWindow", "&Edit")) self.actionUndo.setText(translate("MainWindow", "Undo")) - self.actionUndo.setShortcut(QKeySequence.Undo) + self.actionUndo.setShortcut(QKeySequence.StandardKey.Undo) self.actionRedo.setText(translate("MainWindow", "Redo")) - self.actionRedo.setShortcut(QKeySequence.Redo) + self.actionRedo.setShortcut(QKeySequence.StandardKey.Redo) self.selectAll.setText(translate("MainWindow", "Select all")) self.selectAllMedia.setText( translate("MainWindow", "Select all media cues") ) - self.selectAll.setShortcut(QKeySequence.SelectAll) + self.selectAll.setShortcut(QKeySequence.StandardKey.SelectAll) self.deselectAll.setText(translate("MainWindow", "Deselect all")) self.deselectAll.setShortcut(translate("MainWindow", "CTRL+SHIFT+A")) self.invertSelection.setText( @@ -316,7 +317,7 @@ def setFullScreen(self, enable): def closeEvent(self, event): if self.__checkSessionSaved(): - qApp.quit() + QApplication.instance().quit() event.accept() else: event.ignore() @@ -398,24 +399,26 @@ def __newSession(self): def __checkSessionSaved(self): if not self._app.commands_stack.is_saved(): saveMessageBox = QMessageBox( - QMessageBox.Warning, + QMessageBox.Icon.Warning, translate("MainWindow", "Close session"), translate( "MainWindow", "The current session contains changes that have not been saved.", ), - QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel, + QMessageBox.StandardButton.Save + | QMessageBox.StandardButton.Discard + | QMessageBox.StandardButton.Cancel, self, ) saveMessageBox.setInformativeText( translate("MainWindow", "Do you want to save them now?") ) - saveMessageBox.setDefaultButton(QMessageBox.Save) + saveMessageBox.setDefaultButton(QMessageBox.StandardButton.Save) choice = saveMessageBox.exec() - if choice == QMessageBox.Save: + if choice == QMessageBox.StandardButton.Save: return self.__saveSession() - elif choice == QMessageBox.Cancel: + elif choice == QMessageBox.StandardButton.Cancel: return False return True @@ -433,7 +436,9 @@ def __init__(self, mainWindow): # Clock self.clock = DigitalLabelClock(parent=self) - self.clock.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) + self.clock.setSizePolicy( + QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed + ) self.addWidget(self.clock) # --------- self.addDivider() @@ -444,7 +449,9 @@ def __init__(self, mainWindow): self.addDivider() # Logging StatusIcon self.logStatus = LogStatusIcon(mainWindow.logModel, parent=self) - self.logStatus.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) + self.logStatus.setSizePolicy( + QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed + ) self.logStatus.double_clicked.connect( mainWindow.logViewer.showMaximized ) @@ -455,7 +462,9 @@ def addWidget(self, widget): def addDivider(self): divider = QFrame(self) - divider.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum) - divider.setFrameShape(QFrame.VLine) - divider.setFrameShadow(QFrame.Sunken) + divider.setSizePolicy( + QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Minimum + ) + divider.setFrameShape(QFrame.Shape.VLine) + divider.setFrameShadow(QFrame.Shadow.Sunken) self.addWidget(divider) diff --git a/lisp/ui/qdelegates.py b/lisp/ui/qdelegates.py index 5f05a2681..eb2ae3da9 100644 --- a/lisp/ui/qdelegates.py +++ b/lisp/ui/qdelegates.py @@ -17,9 +17,9 @@ from enum import Enum -from PyQt5.QtCore import Qt, QEvent, QSize -from PyQt5.QtGui import QKeySequence, QFontMetrics -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QEvent, QSize +from PyQt6.QtGui import QKeySequence, QFontMetrics +from PyQt6.QtWidgets import ( QStyledItemDelegate, QComboBox, QSpinBox, @@ -28,7 +28,7 @@ QDialog, QCheckBox, QStyleOptionButton, - qApp, + QApplication, ) from lisp.cues.cue import CueAction @@ -61,12 +61,12 @@ def paint(self, painter, option, index): text = self._text(option, index) text = option.fontMetrics.elidedText( - text, Qt.ElideRight, option.rect.width() + text, Qt.TextElideMode.ElideRight, option.rect.width() ) painter.save() - if option.state & QStyle.State_Selected: + if option.state & QStyle.StateFlag.State_Selected: painter.setBrush(option.palette.highlight()) pen = painter.pen() @@ -79,7 +79,7 @@ def paint(self, painter, option, index): def sizeHint(self, option, index): return QFontMetrics(option.font).size( - Qt.TextSingleLine, self._text(option, index) + Qt.TextFlag.TextSingleLine, self._text(option, index) ) + QSize(8, 0) @@ -93,7 +93,7 @@ def _text(self, option, index): return translate(self.tr_context, index.data()) def paint(self, painter, option, index): - option.displayAlignment = Qt.AlignCenter + option.displayAlignment = Qt.AlignmentFlag.AlignCenter super().paint(painter, option, index) def createEditor(self, parent, option, index): @@ -105,11 +105,11 @@ def createEditor(self, parent, option, index): return editor def setEditorData(self, comboBox, index): - value = index.model().data(index, Qt.EditRole) + value = index.model().data(index, Qt.ItemDataRole.EditRole) comboBox.setCurrentText(translate(self.tr_context, value)) def setModelData(self, comboBox, model, index): - model.setData(index, comboBox.currentData(), Qt.EditRole) + model.setData(index, comboBox.currentData(), Qt.ItemDataRole.EditRole) def updateEditorGeometry(self, editor, option, index): editor.setGeometry(option.rect) @@ -131,13 +131,13 @@ def createEditor(self, parent, option, index): return editor def setEditorData(self, spinBox, index): - value = index.model().data(index, Qt.EditRole) + value = index.model().data(index, Qt.ItemDataRole.EditRole) if isinstance(value, int): spinBox.setValue(value) def setModelData(self, spinBox, model, index): spinBox.interpretText() - model.setData(index, spinBox.value(), Qt.EditRole) + model.setData(index, spinBox.value(), Qt.ItemDataRole.EditRole) def updateEditorGeometry(self, editor, option, index): editor.setGeometry(option.rect) @@ -152,8 +152,14 @@ def createEditor(self, parent, option, index): def _checkBoxRect(self, option): cbRect = option.rect - cbSize = qApp.style().subElementRect( - QStyle.SE_ViewItemCheckIndicator, QStyleOptionButton(), QCheckBox() + cbSize = ( + QApplication.instance() + .style() + .subElementRect( + QStyle.SubElement.SE_ItemViewItemCheckIndicator, + QStyleOptionButton(), + QCheckBox(), + ) ) # Center the checkbox (horizontally) @@ -164,26 +170,32 @@ def _checkBoxRect(self, option): def editorEvent(self, event, model, option, index): # If the "checkbox" is left-clicked change the current state - if event.type() == QEvent.MouseButtonRelease: + if event.type() == QEvent.Type.MouseButtonRelease: cbRect = self._checkBoxRect(option) - if event.button() == Qt.LeftButton and cbRect.contains(event.pos()): - value = bool(index.model().data(index, Qt.EditRole)) - model.setData(index, not value, Qt.EditRole) + if event.button() == Qt.MouseButton.LeftButton and cbRect.contains( + event.pos() + ): + value = bool( + index.model().data(index, Qt.ItemDataRole.EditRole) + ) + model.setData(index, not value, Qt.ItemDataRole.EditRole) return True return super().editorEvent(event, model, option, index) def paint(self, painter, option, index): - value = index.model().data(index, Qt.EditRole) + value = index.model().data(index, Qt.ItemDataRole.EditRole) cbOpt = QStyleOptionButton() - cbOpt.state = QStyle.State_Enabled - cbOpt.state |= QStyle.State_On if value else QStyle.State_Off + cbOpt.state = QStyle.StateFlag.State_Enabled + cbOpt.state |= ( + QStyle.StateFlag.State_On if value else QStyle.StateFlag.State_Off + ) cbOpt.rect = self._checkBoxRect(option) - qApp.style().drawControl( - QStyle.CE_CheckBox, cbOpt, painter, QCheckBox() + QApplication.instance().style().drawControl( + QStyle.ControlElement.CE_CheckBox, cbOpt, painter, QCheckBox() ) @@ -205,11 +217,11 @@ def createEditor(self, parent, option, index): return editor def setEditorData(self, lineEdit, index): - value = index.model().data(index, Qt.EditRole) + value = index.model().data(index, Qt.ItemDataRole.EditRole) lineEdit.setText(str(value)) def setModelData(self, lineEdit, model, index): - model.setData(index, lineEdit.text(), Qt.EditRole) + model.setData(index, lineEdit.text(), Qt.ItemDataRole.EditRole) def updateEditorGeometry(self, editor, option, index): editor.setGeometry(option.rect) @@ -226,7 +238,9 @@ def __init__(self, mode=Mode.PortableText, **kwargs): self.mode = mode def paint(self, painter, option, index): - option.displayAlignment = Qt.AlignHCenter | Qt.AlignVCenter + option.displayAlignment = ( + Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter + ) super().paint(painter, option, index) def createEditor(self, parent, option, index): @@ -238,26 +252,28 @@ def setEditorData(self, editor: HotKeyEdit, index): def setModelData(self, editor: HotKeyEdit, model, index): sequence = editor.keySequence() if self.mode == HotKeyEditDelegate.Mode.NativeText: - data = sequence.toString(QKeySequence.NativeText) + data = sequence.toString(QKeySequence.SequenceFormat.NativeText) elif self.mode == HotKeyEditDelegate.Mode.PortableText: - data = sequence.toString(QKeySequence.PortableText) + data = sequence.toString(QKeySequence.SequenceFormat.PortableText) else: data = sequence - model.setData(index, data, Qt.EditRole) + model.setData(index, data, Qt.ItemDataRole.EditRole) def updateEditorGeometry(self, editor, option, index): editor.setGeometry(option.rect) def _text(self, option, index): - return self._sequence(index).toString(QKeySequence.NativeText) + return self._sequence(index).toString( + QKeySequence.SequenceFormat.NativeText + ) def _sequence(self, index): - data = index.data(Qt.EditRole) + data = index.data(Qt.ItemDataRole.EditRole) if self.mode == HotKeyEditDelegate.Mode.NativeText: - return QKeySequence(data, QKeySequence.NativeText) + return QKeySequence(data, QKeySequence.SequenceFormat.NativeText) elif self.mode == HotKeyEditDelegate.Mode.PortableText: - return QKeySequence(data, QKeySequence.PortableText) + return QKeySequence(data, QKeySequence.SequenceFormat.PortableText) return data @@ -272,10 +288,14 @@ def __init__(self, enum, mode=Mode.Enum, trItem=str, **kwargs): self.trItem = trItem def _text(self, option, index): - return self.trItem(self.itemFromData(index.data(Qt.EditRole))) + return self.trItem( + self.itemFromData(index.data(Qt.ItemDataRole.EditRole)) + ) def paint(self, painter, option, index): - option.displayAlignment = Qt.AlignHCenter | Qt.AlignVCenter + option.displayAlignment = ( + Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter + ) super().paint(painter, option, index) def createEditor(self, parent, option, index): @@ -287,10 +307,10 @@ def createEditor(self, parent, option, index): return editor def setEditorData(self, editor, index): - editor.setCurrentItem(index.data(Qt.EditRole)) + editor.setCurrentItem(index.data(Qt.ItemDataRole.EditRole)) def setModelData(self, editor, model, index): - model.setData(index, editor.currentData(), Qt.EditRole) + model.setData(index, editor.currentData(), Qt.ItemDataRole.EditRole) def updateEditorGeometry(self, editor, option, index): editor.setGeometry(option.rect) @@ -337,11 +357,11 @@ def _text(self, option, index): return "UNDEF" def editorEvent(self, event, model, option, index): - if event.type() == QEvent.MouseButtonDblClick: - if self.cue_select.exec() == QDialog.Accepted: + if event.type() == QEvent.Type.MouseButtonDblClick: + if self.cue_select.exec() == QDialog.DialogCode.Accepted: cue = self.cue_select.selected_cue() if cue is not None: - model.setData(index, cue.id, Qt.EditRole) + model.setData(index, cue.id, Qt.ItemDataRole.EditRole) model.setData(index, cue.__class__, CueClassRole) return True diff --git a/lisp/ui/qmodels.py b/lisp/ui/qmodels.py index ca1cf703e..ed0ca3a41 100644 --- a/lisp/ui/qmodels.py +++ b/lisp/ui/qmodels.py @@ -15,13 +15,13 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QAbstractTableModel, QModelIndex, Qt +from PyQt6.QtCore import QAbstractTableModel, QModelIndex, Qt from lisp.cues.cue import Cue from lisp.ui.ui_utils import translate # Application defined data-roles -CueClassRole = Qt.UserRole + 1 +CueClassRole = Qt.ItemDataRole.UserRole + 1 class SimpleTableModel(QAbstractTableModel): @@ -52,7 +52,7 @@ def updateRow(self, row, *values): self.dataChanged.emit( self.index(row, 0), self.index(row, len(self.columns)), - [Qt.DisplayRole, Qt.EditRole], + [Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.EditRole], ) def removeRow(self, row, parent=QModelIndex()): @@ -69,30 +69,41 @@ def rowCount(self, parent=QModelIndex()): def columnCount(self, parent=QModelIndex()): return len(self.columns) - def headerData(self, section, orientation, role=Qt.DisplayRole): - if role == Qt.DisplayRole and orientation == Qt.Horizontal: + def headerData( + self, section, orientation, role=Qt.ItemDataRole.DisplayRole + ): + if ( + role == Qt.ItemDataRole.DisplayRole + and orientation == Qt.Orientation.Horizontal + ): if section < len(self.columns): return self.columns[section] else: return section + 1 - if role == Qt.SizeHintRole and orientation == Qt.Vertical: + if ( + role == Qt.ItemDataRole.SizeHintRole + and orientation == Qt.Orientation.Vertical + ): return 0 - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): if index.isValid(): - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: value = self.rows[index.row()][index.column()] if isinstance(value, bool): return translate("QComboBox", str(value).title()) else: return value - elif role == Qt.EditRole: + elif role == Qt.ItemDataRole.EditRole: return self.rows[index.row()][index.column()] - elif role == Qt.TextAlignmentRole: - return Qt.AlignCenter - - def setData(self, index, value, role=Qt.DisplayRole): - if index.isValid() and (role == Qt.DisplayRole or role == Qt.EditRole): + elif role == Qt.ItemDataRole.TextAlignmentRole: + return Qt.AlignmentFlag.AlignCenter + + def setData(self, index, value, role=Qt.ItemDataRole.DisplayRole): + if index.isValid() and ( + role == Qt.ItemDataRole.DisplayRole + or role == Qt.ItemDataRole.EditRole + ): row = index.row() col = index.column() # Update only if value is different @@ -101,7 +112,7 @@ def setData(self, index, value, role=Qt.DisplayRole): self.dataChanged.emit( self.index(row, 0), self.index(row, col), - [Qt.DisplayRole, Qt.EditRole], + [Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.EditRole], ) return True @@ -109,7 +120,11 @@ def setData(self, index, value, role=Qt.DisplayRole): return False def flags(self, index): - return Qt.ItemIsEditable | Qt.ItemIsEnabled | Qt.ItemIsSelectable + return ( + Qt.ItemFlag.ItemIsEditable + | Qt.ItemFlag.ItemIsEnabled + | Qt.ItemFlag.ItemIsSelectable + ) class SimpleCueListModel(SimpleTableModel): @@ -128,13 +143,13 @@ def removeRow(self, row, parent=None): if super().removeRow(row): self.rows_cc.pop(row) - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): if role == CueClassRole and index.isValid: return self.rows_cc[index.row()] return super().data(index, role) - def setData(self, index, value, role=Qt.DisplayRole): + def setData(self, index, value, role=Qt.ItemDataRole.DisplayRole): if role == CueClassRole and index.isValid(): if issubclass(value, Cue): self.rows_cc[index.row()] = value diff --git a/lisp/ui/settings/app_configuration.py b/lisp/ui/settings/app_configuration.py index 551cfa944..d4248b392 100644 --- a/lisp/ui/settings/app_configuration.py +++ b/lisp/ui/settings/app_configuration.py @@ -18,9 +18,9 @@ import logging from collections import namedtuple -from PyQt5 import QtCore -from PyQt5.QtCore import QModelIndex -from PyQt5.QtWidgets import QVBoxLayout, QDialogButtonBox, QDialog +from PyQt6 import QtCore +from PyQt6.QtCore import QModelIndex +from PyQt6.QtWidgets import QVBoxLayout, QDialogButtonBox, QDialog from lisp.core.dicttree import DictNode from lisp.ui.ui_utils import translate @@ -37,7 +37,7 @@ class AppConfigurationDialog(QDialog): def __init__(self, **kwargs): super().__init__(**kwargs) self.setWindowTitle(translate("AppConfiguration", "LiSP preferences")) - self.setWindowModality(QtCore.Qt.WindowModal) + self.setWindowModality(QtCore.Qt.WindowModality.WindowModal) self.setMinimumSize(800, 510) self.resize(800, 510) self.setLayout(QVBoxLayout()) @@ -54,21 +54,21 @@ def __init__(self, **kwargs): self.dialogButtons = QDialogButtonBox(self) self.dialogButtons.setStandardButtons( - QDialogButtonBox.Cancel - | QDialogButtonBox.Apply - | QDialogButtonBox.Ok + QDialogButtonBox.StandardButton.Cancel + | QDialogButtonBox.StandardButton.Apply + | QDialogButtonBox.StandardButton.Ok ) self.layout().addWidget(self.dialogButtons) - self.dialogButtons.button(QDialogButtonBox.Cancel).clicked.connect( - self.reject - ) - self.dialogButtons.button(QDialogButtonBox.Apply).clicked.connect( - self.applySettings - ) - self.dialogButtons.button(QDialogButtonBox.Ok).clicked.connect( - self.__onOk - ) + self.dialogButtons.button( + QDialogButtonBox.StandardButton.Cancel + ).clicked.connect(self.reject) + self.dialogButtons.button( + QDialogButtonBox.StandardButton.Apply + ).clicked.connect(self.applySettings) + self.dialogButtons.button( + QDialogButtonBox.StandardButton.Ok + ).clicked.connect(self.__onOk) def applySettings(self): for conf, pages in self.configurations.items(): diff --git a/lisp/ui/settings/app_pages/cue.py b/lisp/ui/settings/app_pages/cue.py index 1f6a19c99..3456cb3c4 100644 --- a/lisp/ui/settings/app_pages/cue.py +++ b/lisp/ui/settings/app_pages/cue.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt -from PyQt5.QtWidgets import QVBoxLayout, QGroupBox, QLabel +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt +from PyQt6.QtWidgets import QVBoxLayout, QGroupBox, QLabel from lisp.ui.settings.pages import SettingsPage from lisp.ui.ui_utils import translate @@ -29,7 +29,7 @@ class CueAppSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) # Interrupt fade settings self.interruptGroup = QGroupBox(self) diff --git a/lisp/ui/settings/app_pages/general.py b/lisp/ui/settings/app_pages/general.py index a4101a648..3b3dbc40a 100644 --- a/lisp/ui/settings/app_pages/general.py +++ b/lisp/ui/settings/app_pages/general.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import ( QGroupBox, QVBoxLayout, QCheckBox, @@ -40,7 +40,7 @@ class AppGeneral(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) # Startup "layout" self.layoutGroup = QGroupBox(self) diff --git a/lisp/ui/settings/app_pages/layouts.py b/lisp/ui/settings/app_pages/layouts.py index 27c0d0328..484499987 100644 --- a/lisp/ui/settings/app_pages/layouts.py +++ b/lisp/ui/settings/app_pages/layouts.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import QVBoxLayout, QGroupBox, QCheckBox +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import QVBoxLayout, QGroupBox, QCheckBox from lisp.ui.settings.pages import SettingsPage from lisp.ui.ui_utils import translate @@ -28,7 +28,7 @@ class LayoutsSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.useFadeGroup = QGroupBox(self) self.useFadeGroup.setLayout(QVBoxLayout()) diff --git a/lisp/ui/settings/app_pages/plugins.py b/lisp/ui/settings/app_pages/plugins.py index ed9226ebd..5ff927afc 100644 --- a/lisp/ui/settings/app_pages/plugins.py +++ b/lisp/ui/settings/app_pages/plugins.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt, QAbstractTableModel, QModelIndex -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt, QAbstractTableModel, QModelIndex +from PyQt6.QtWidgets import ( QTextBrowser, QVBoxLayout, QTableView, @@ -38,14 +38,14 @@ class PluginsSettings(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) - self.layout().setAlignment(Qt.AlignTop) + self.layout().setAlignment(Qt.AlignmentFlag.AlignTop) self.pluginsModel = PluginModel() self.pluginsList = PluginsView(parent=self) # QListWidget(self) self.pluginsList.setModel(self.pluginsModel) self.pluginsList.horizontalHeader().setSectionResizeMode( - 0, QHeaderView.Stretch + 0, QHeaderView.ResizeMode.Stretch ) self.pluginsList.setAlternatingRowColors(True) self.pluginsList.selectionModel().selectionChanged.connect( @@ -67,7 +67,7 @@ def __init__(self, **kwargs): self.pluginsList.setCurrentIndex(self.pluginsModel.index(0, 0)) def __selection_changed(self): - plugin = self.pluginsList.currentIndex().data(Qt.UserRole) + plugin = self.pluginsList.currentIndex().data(Qt.ItemDataRole.UserRole) if plugin is not None: html = ( @@ -105,39 +105,49 @@ def rowCount(self, parent=QModelIndex()): def columnCount(self, parent=QModelIndex()): return len(self.columns) - def headerData(self, section, orientation, role=Qt.DisplayRole): - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + def headerData( + self, section, orientation, role=Qt.ItemDataRole.DisplayRole + ): + if ( + orientation == Qt.Orientation.Horizontal + and role == Qt.ItemDataRole.DisplayRole + ): if section < len(self.columns): return self.columns[section] else: return section + 1 - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): if index.isValid(): column = index.column() plugin = self.plugins[index.row()] # Column-independent values - if role == Qt.TextAlignmentRole: - return Qt.AlignLeft | Qt.AlignVCenter - elif role == Qt.ToolTipRole: + if role == Qt.ItemDataRole.TextAlignmentRole: + return ( + Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter + ) + elif role == Qt.ItemDataRole.ToolTipRole: return plugin.status_text() - elif role == Qt.UserRole: + elif role == Qt.ItemDataRole.UserRole: return plugin # Column-dependent values if column == 0: - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: return plugin.Name - elif role == Qt.DecorationRole: + elif role == Qt.ItemDataRole.DecorationRole: return IconTheme.get(plugin_status_icon(plugin)) elif column == 1: enabled = plugin.is_enabled() - if role in (Qt.DisplayRole, Qt.EditRole): + if role in ( + Qt.ItemDataRole.DisplayRole, + Qt.ItemDataRole.EditRole, + ): return enabled - def setData(self, index, value, role=Qt.EditRole): - if index.isValid() and role == Qt.EditRole: + def setData(self, index, value, role=Qt.ItemDataRole.EditRole): + if index.isValid() and role == Qt.ItemDataRole.EditRole: row = index.row() column = index.column() plugin = self.plugins[row] @@ -147,7 +157,7 @@ def setData(self, index, value, role=Qt.EditRole): self.dataChanged.emit( self.index(row, 0), self.index(row, column), - [Qt.DisplayRole, Qt.EditRole], + [Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.EditRole], ) return True @@ -156,9 +166,9 @@ def setData(self, index, value, role=Qt.EditRole): def flags(self, index): column = index.column() - flags = Qt.ItemIsEnabled | Qt.ItemIsSelectable + flags = Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable if column == 1 and not self.plugins[column].CorePlugin: - flags |= Qt.ItemIsEditable + flags |= Qt.ItemFlag.ItemIsEditable return flags @@ -172,18 +182,18 @@ def __init__(self, **kwargs): BoolCheckBoxDelegate(), ] - self.setSelectionBehavior(QTableView.SelectRows) - self.setSelectionMode(QTableView.SingleSelection) + self.setSelectionBehavior(QTableView.SelectionBehavior.SelectRows) + self.setSelectionMode(QTableView.SelectionMode.SingleSelection) self.setShowGrid(False) self.setAlternatingRowColors(True) self.horizontalHeader().setSectionResizeMode( - QHeaderView.ResizeToContents + QHeaderView.ResizeMode.ResizeToContents ) self.verticalHeader().setVisible(False) - self.verticalHeader().sectionResizeMode(QHeaderView.Fixed) + self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Fixed) self.verticalHeader().setDefaultSectionSize(24) self.verticalHeader().setHighlightSections(False) diff --git a/lisp/ui/settings/cue_pages/cue_appearance.py b/lisp/ui/settings/cue_pages/cue_appearance.py index 57e9e7af6..7a3a02077 100644 --- a/lisp/ui/settings/cue_pages/cue_appearance.py +++ b/lisp/ui/settings/cue_pages/cue_appearance.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP -from PyQt5.QtGui import QFontDatabase -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QT_TRANSLATE_NOOP +from PyQt6.QtGui import QFontDatabase +from PyQt6.QtWidgets import ( QVBoxLayout, QGroupBox, QHBoxLayout, @@ -55,7 +55,7 @@ def __init__(self, **kwargs): self.cueDescriptionEdit = QTextEdit(self.cueDescriptionGroup) self.cueDescriptionEdit.setAcceptRichText(False) self.cueDescriptionEdit.setFont( - QFontDatabase.systemFont(QFontDatabase.FixedFont) + QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont) ) self.cueDescriptionGroup.layout().addWidget(self.cueDescriptionEdit) @@ -86,7 +86,7 @@ def __init__(self, **kwargs): "CueAppearanceSettings", "The appearance depends on the layout" ) ) - self.warning.setAlignment(Qt.AlignCenter) + self.warning.setAlignment(Qt.AlignmentFlag.AlignCenter) self.warning.setStyleSheet("color: #FFA500; font-weight: bold") self.layout().addWidget(self.warning) diff --git a/lisp/ui/settings/cue_pages/cue_general.py b/lisp/ui/settings/cue_pages/cue_general.py index 0e99dc29e..23a14b468 100644 --- a/lisp/ui/settings/cue_pages/cue_general.py +++ b/lisp/ui/settings/cue_pages/cue_general.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt, QTime -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt, QTime +from PyQt6.QtWidgets import ( QDateTimeEdit, QGroupBox, QHBoxLayout, @@ -73,7 +73,7 @@ def __init__(self, cueType, **kwargs): self.startActionGroup.layout().addWidget(self.startActionCombo) self.startActionLabel = QLabel(self.startActionGroup) - self.startActionLabel.setAlignment(Qt.AlignCenter) + self.startActionLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.startActionGroup.layout().addWidget(self.startActionLabel) # Stop-Action @@ -98,7 +98,7 @@ def __init__(self, cueType, **kwargs): self.stopActionGroup.layout().addWidget(self.stopActionCombo) self.stopActionLabel = QLabel(self.stopActionGroup) - self.stopActionLabel.setAlignment(Qt.AlignCenter) + self.stopActionLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.stopActionGroup.layout().addWidget(self.stopActionLabel) self.layout().addSpacing(150) @@ -167,11 +167,11 @@ def __init__(self, cueType, **kwargs): self.preWaitEdit = QTimeEdit(self.preWaitGroup) self.preWaitEdit.setDisplayFormat("HH:mm:ss.zzz") - self.preWaitEdit.setCurrentSection(QDateTimeEdit.SecondSection) + self.preWaitEdit.setCurrentSection(QDateTimeEdit.Section.SecondSection) self.preWaitGroup.layout().addWidget(self.preWaitEdit) self.preWaitLabel = QLabel(self.preWaitGroup) - self.preWaitLabel.setAlignment(Qt.AlignCenter) + self.preWaitLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.preWaitGroup.layout().addWidget(self.preWaitLabel) # Post wait @@ -181,11 +181,11 @@ def __init__(self, cueType, **kwargs): self.postWaitEdit = QTimeEdit(self.postWaitGroup) self.postWaitEdit.setDisplayFormat("HH:mm:ss.zzz") - self.postWaitEdit.setCurrentSection(QDateTimeEdit.SecondSection) + self.postWaitEdit.setCurrentSection(QDateTimeEdit.Section.SecondSection) self.postWaitGroup.layout().addWidget(self.postWaitEdit) self.postWaitLabel = QLabel(self.postWaitGroup) - self.postWaitLabel.setAlignment(Qt.AlignCenter) + self.postWaitLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.postWaitGroup.layout().addWidget(self.postWaitLabel) # Next action diff --git a/lisp/ui/settings/cue_pages/media_cue.py b/lisp/ui/settings/cue_pages/media_cue.py index 35b0f56f3..2ed32c153 100644 --- a/lisp/ui/settings/cue_pages/media_cue.py +++ b/lisp/ui/settings/cue_pages/media_cue.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt, QTime -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP, Qt, QTime +from PyQt6.QtWidgets import ( QDateTimeEdit, QGroupBox, QHBoxLayout, @@ -44,11 +44,11 @@ def __init__(self, **kwargs): self.startEdit = QTimeEdit(self.startGroup) self.startEdit.setDisplayFormat("HH:mm:ss.zzz") - self.startEdit.setCurrentSection(QDateTimeEdit.SecondSection) + self.startEdit.setCurrentSection(QDateTimeEdit.Section.SecondSection) self.startGroup.layout().addWidget(self.startEdit) self.startLabel = QLabel(self.startGroup) - self.startLabel.setAlignment(Qt.AlignCenter) + self.startLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.startGroup.layout().addWidget(self.startLabel) # Stop time @@ -58,11 +58,11 @@ def __init__(self, **kwargs): self.stopEdit = QTimeEdit(self.stopGroup) self.stopEdit.setDisplayFormat("HH:mm:ss.zzz") - self.stopEdit.setCurrentSection(QDateTimeEdit.SecondSection) + self.stopEdit.setCurrentSection(QDateTimeEdit.Section.SecondSection) self.stopGroup.layout().addWidget(self.stopEdit) self.stopLabel = QLabel(self.stopGroup) - self.stopLabel.setAlignment(Qt.AlignCenter) + self.stopLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.stopGroup.layout().addWidget(self.stopLabel) # Loop @@ -75,7 +75,7 @@ def __init__(self, **kwargs): self.loopGroup.layout().addWidget(self.spinLoop) self.loopLabel = QLabel(self.loopGroup) - self.loopLabel.setAlignment(Qt.AlignCenter) + self.loopLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.loopGroup.layout().addWidget(self.loopLabel) self.retranslateUi() diff --git a/lisp/ui/settings/cue_settings.py b/lisp/ui/settings/cue_settings.py index 80686449b..8e8a8171f 100644 --- a/lisp/ui/settings/cue_settings.py +++ b/lisp/ui/settings/cue_settings.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5 import QtCore -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout +from PyQt6 import QtCore +from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout from lisp.core.class_based_registry import ClassBasedRegistry from lisp.core.singleton import Singleton @@ -45,7 +45,7 @@ def __init__(self, cue, **kwargs): :param cue: Target cue, or a cue-type for multi-editing """ super().__init__(**kwargs) - self.setWindowModality(QtCore.Qt.ApplicationModal) + self.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) self.setMinimumSize(800, 510) self.resize(800, 510) self.setLayout(QVBoxLayout()) @@ -89,21 +89,21 @@ def sk(widget): self.dialogButtons = QDialogButtonBox(self) self.dialogButtons.setStandardButtons( - QDialogButtonBox.Cancel - | QDialogButtonBox.Apply - | QDialogButtonBox.Ok + QDialogButtonBox.StandardButton.Cancel + | QDialogButtonBox.StandardButton.Apply + | QDialogButtonBox.StandardButton.Ok ) self.layout().addWidget(self.dialogButtons) - self.dialogButtons.button(QDialogButtonBox.Cancel).clicked.connect( - self.reject - ) - self.dialogButtons.button(QDialogButtonBox.Apply).clicked.connect( - self.__onApply - ) - self.dialogButtons.button(QDialogButtonBox.Ok).clicked.connect( - self.__onOk - ) + self.dialogButtons.button( + QDialogButtonBox.StandardButton.Cancel + ).clicked.connect(self.reject) + self.dialogButtons.button( + QDialogButtonBox.StandardButton.Apply + ).clicked.connect(self.__onApply) + self.dialogButtons.button( + QDialogButtonBox.StandardButton.Ok + ).clicked.connect(self.__onOk) def loadSettings(self, settings): self.mainPage.loadSettings(settings) diff --git a/lisp/ui/settings/pages.py b/lisp/ui/settings/pages.py index 16af0e465..5b3947107 100644 --- a/lisp/ui/settings/pages.py +++ b/lisp/ui/settings/pages.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QModelIndex, Qt -from PyQt5.QtWidgets import QWidget, QTabWidget, QVBoxLayout, QGroupBox +from PyQt6.QtCore import QModelIndex, Qt +from PyQt6.QtWidgets import QWidget, QTabWidget, QVBoxLayout, QGroupBox from lisp.core.util import dict_merge from lisp.ui.ui_utils import translate @@ -81,7 +81,7 @@ def __init__(self, **kwargs): self.setLayout(QVBoxLayout()) self.tabWidget = QTabWidget(parent=self) - self.tabWidget.setFocusPolicy(Qt.StrongFocus) + self.tabWidget.setFocusPolicy(Qt.FocusPolicy.StrongFocus) self.layout().addWidget(self.tabWidget) self._pages = [] diff --git a/lisp/ui/themes/dark/assets.py b/lisp/ui/themes/dark/assets.py index 3fcf23e29..07a54269c 100644 --- a/lisp/ui/themes/dark/assets.py +++ b/lisp/ui/themes/dark/assets.py @@ -4,7 +4,7 @@ # # WARNING! All changes made in this file will be lost! -from PyQt5 import QtCore +from PyQt6 import QtCore qt_resource_data = b"\ \x00\x00\x03\x25\ diff --git a/lisp/ui/themes/dark/dark.py b/lisp/ui/themes/dark/dark.py index 86f55d2ac..2efcebfba 100644 --- a/lisp/ui/themes/dark/dark.py +++ b/lisp/ui/themes/dark/dark.py @@ -17,7 +17,7 @@ import os -from PyQt5.QtGui import QColor, QPalette +from PyQt6.QtGui import QColor, QPalette # Import resources # noinspection PyUnresolvedReferences @@ -34,25 +34,27 @@ def apply(self, qt_app): highlight = QColor(65, 155, 230) palette = qt_app.palette() - palette.setColor(QPalette.Window, foreground) - palette.setColor(QPalette.WindowText, text) - palette.setColor(QPalette.Base, background) - palette.setColor(QPalette.AlternateBase, foreground.darker(125)) - palette.setColor(QPalette.ToolTipBase, foreground) - palette.setColor(QPalette.ToolTipText, text) - palette.setColor(QPalette.Text, text) - palette.setColor(QPalette.Button, foreground) - palette.setColor(QPalette.ButtonText, text) - palette.setColor(QPalette.BrightText, QColor(255, 0, 0)) - palette.setColor(QPalette.Link, highlight) - - palette.setColor(QPalette.Light, foreground.lighter(160)) - palette.setColor(QPalette.Midlight, foreground.lighter(125)) - palette.setColor(QPalette.Dark, foreground.darker(150)) - palette.setColor(QPalette.Mid, foreground.darker(125)) - - palette.setColor(QPalette.Highlight, highlight) - palette.setColor(QPalette.HighlightedText, QColor(0, 0, 0)) + palette.setColor(QPalette.ColorRole.Window, foreground) + palette.setColor(QPalette.ColorRole.WindowText, text) + palette.setColor(QPalette.ColorRole.Base, background) + palette.setColor( + QPalette.ColorRole.AlternateBase, foreground.darker(125) + ) + palette.setColor(QPalette.ColorRole.ToolTipBase, foreground) + palette.setColor(QPalette.ColorRole.ToolTipText, text) + palette.setColor(QPalette.ColorRole.Text, text) + palette.setColor(QPalette.ColorRole.Button, foreground) + palette.setColor(QPalette.ColorRole.ButtonText, text) + palette.setColor(QPalette.ColorRole.BrightText, QColor(255, 0, 0)) + palette.setColor(QPalette.ColorRole.Link, highlight) + + palette.setColor(QPalette.ColorRole.Light, foreground.lighter(160)) + palette.setColor(QPalette.ColorRole.Midlight, foreground.lighter(125)) + palette.setColor(QPalette.ColorRole.Dark, foreground.darker(150)) + palette.setColor(QPalette.ColorRole.Mid, foreground.darker(125)) + + palette.setColor(QPalette.ColorRole.Highlight, highlight) + palette.setColor(QPalette.ColorRole.HighlightedText, QColor(0, 0, 0)) qt_app.setPalette(palette) diff --git a/lisp/ui/ui_utils.py b/lisp/ui/ui_utils.py index 5f92d0903..19b4ec1a5 100644 --- a/lisp/ui/ui_utils.py +++ b/lisp/ui/ui_utils.py @@ -21,14 +21,27 @@ import signal from itertools import chain -from PyQt5.QtCore import QTranslator, QLocale, QSocketNotifier -from PyQt5.QtWidgets import QApplication, qApp +from PyQt6.QtCore import QTranslator, QLocale, QSocketNotifier, Qt +from PyQt6.QtGui import QKeyEvent, QKeySequence +from PyQt6.QtWidgets import QApplication from lisp import I18N_DIR logger = logging.getLogger(__name__) +MODIFIERS_KEYS = frozenset( + { + Qt.Key.Key_Control, + Qt.Key.Key_Shift, + Qt.Key.Key_Meta, + Qt.Key.Key_Alt, + Qt.Key.Key_AltGr, + Qt.Key.Key_unknown, + } +) + + def adjust_widget_position(widget): """Adjust the widget position to ensure it's in the desktop. @@ -43,7 +56,7 @@ def adjust_position(rect): :type rect: PyQt5.QtCore.QRect.QRect :return: PyQt5.QtCore.QRect.QRect """ - desktop = qApp.desktop().availableGeometry() + desktop = QApplication.primaryScreen().availableGeometry() if rect.bottom() > desktop.bottom(): rect.moveTo(rect.x(), rect.y() - rect.height()) @@ -53,6 +66,15 @@ def adjust_position(rect): return rect +def key_sequence_from_event( + key_event: QKeyEvent, ignore_keys=MODIFIERS_KEYS +) -> QKeySequence: + if key_event.key() not in ignore_keys: + return QKeySequence(key_event.keyCombination()) + + return QKeySequence() + + def css_to_dict(css): css_dict = {} @@ -139,7 +161,6 @@ def translate(context, text, disambiguation=None, n=-1): def translate_many(context, texts): - """Return a translate iterator.""" for item in texts: yield translate(context, item) @@ -181,7 +202,7 @@ def __init__(self): # QSocketNotifier will look if something is written in the pipe # and call the `_handle` method - self._notifier = QSocketNotifier(self._rfd, QSocketNotifier.Read) + self._notifier = QSocketNotifier(self._rfd, QSocketNotifier.Type.Read) self._notifier.activated.connect(self._handle) # Tell Python to write to the pipe when there is a signal to handle self._orig_wfd = signal.set_wakeup_fd(self._wfd) diff --git a/lisp/ui/widgets/colorbutton.py b/lisp/ui/widgets/colorbutton.py index 9cbf37ef0..4117693a3 100644 --- a/lisp/ui/widgets/colorbutton.py +++ b/lisp/ui/widgets/colorbutton.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import pyqtSignal, Qt -from PyQt5.QtGui import QColor -from PyQt5.QtWidgets import QPushButton, QColorDialog +from PyQt6.QtCore import pyqtSignal, Qt +from PyQt6.QtGui import QColor +from PyQt6.QtWidgets import QPushButton, QColorDialog from lisp.ui.ui_utils import translate @@ -58,11 +58,11 @@ def onColorPicker(self): if self._color is not None: dlg.setCurrentColor(QColor(self._color)) - if dlg.exec() == dlg.Accepted: + if dlg.exec() == dlg.DialogCode.Accepted: self.setColor(dlg.currentColor().name()) def mousePressEvent(self, e): - if e.button() == Qt.RightButton: + if e.button() == Qt.MouseButton.RightButton: self.setColor(None) return super(ColorButton, self).mousePressEvent(e) diff --git a/lisp/ui/widgets/cue_actions.py b/lisp/ui/widgets/cue_actions.py index 29d1523ec..63011585d 100644 --- a/lisp/ui/widgets/cue_actions.py +++ b/lisp/ui/widgets/cue_actions.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtCore import QT_TRANSLATE_NOOP from lisp.cues.cue import CueAction from lisp.ui.ui_utils import translate diff --git a/lisp/ui/widgets/cue_next_actions.py b/lisp/ui/widgets/cue_next_actions.py index 2f56faaa3..8d8dba026 100644 --- a/lisp/ui/widgets/cue_next_actions.py +++ b/lisp/ui/widgets/cue_next_actions.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import QComboBox +from PyQt6.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import QComboBox from lisp.cues.cue import CueNextAction from lisp.ui.ui_utils import translate diff --git a/lisp/ui/widgets/digitalclock.py b/lisp/ui/widgets/digitalclock.py index a40c77056..44a871838 100644 --- a/lisp/ui/widgets/digitalclock.py +++ b/lisp/ui/widgets/digitalclock.py @@ -16,15 +16,17 @@ # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QTime, QTimer -from PyQt5.QtGui import QFontDatabase -from PyQt5.QtWidgets import QLabel +from PyQt6.QtCore import QTime, QTimer +from PyQt6.QtGui import QFontDatabase +from PyQt6.QtWidgets import QLabel class DigitalLabelClock(QLabel): def __init__(self, resolution=1000, time_format="hh:mm", parent=None): super().__init__(parent) - self.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont)) + self.setFont( + QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont) + ) self.time_format = time_format self.timer = QTimer(self) diff --git a/lisp/ui/widgets/dynamicfontsize.py b/lisp/ui/widgets/dynamicfontsize.py index c58390226..bcb038a68 100644 --- a/lisp/ui/widgets/dynamicfontsize.py +++ b/lisp/ui/widgets/dynamicfontsize.py @@ -17,9 +17,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QRectF -from PyQt5.QtGui import QFontMetricsF -from PyQt5.QtWidgets import QLabel, QPushButton +from PyQt6.QtCore import Qt, QRectF +from PyQt6.QtGui import QFontMetricsF +from PyQt6.QtWidgets import QLabel, QPushButton class DynamicFontSizeMixin: @@ -50,7 +50,7 @@ def getWidgetMaximumFontSize(self, text: str): flags = 0 if isinstance(self, QLabel): flags |= self.alignment() - flags |= Qt.TextWordWrap if self.wordWrap() else 0 + flags |= Qt.TextFlag.TextWordWrap if self.wordWrap() else 0 # Only stop when step is small enough and new size is smaller than QWidget while ( diff --git a/lisp/ui/widgets/elidedlabel.py b/lisp/ui/widgets/elidedlabel.py index f09aa0fda..b9d74af9f 100644 --- a/lisp/ui/widgets/elidedlabel.py +++ b/lisp/ui/widgets/elidedlabel.py @@ -15,17 +15,19 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QPainter -from PyQt5.QtWidgets import QLabel, QSizePolicy +from PyQt6.QtCore import Qt +from PyQt6.QtGui import QPainter +from PyQt6.QtWidgets import QLabel, QSizePolicy class ElidedLabel(QLabel): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) + self.setSizePolicy( + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Ignored + ) - self.__elideMode = Qt.ElideRight + self.__elideMode = Qt.TextElideMode.ElideRight self.__prevWidth = 0 self.__prevText = "" self.__elided = "" diff --git a/lisp/ui/widgets/fades.py b/lisp/ui/widgets/fades.py index 36401b0f6..4ee239433 100644 --- a/lisp/ui/widgets/fades.py +++ b/lisp/ui/widgets/fades.py @@ -17,8 +17,8 @@ from enum import Enum -from PyQt5.QtCore import QT_TRANSLATE_NOOP -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import QT_TRANSLATE_NOOP +from PyQt6.QtWidgets import ( QComboBox, QStyledItemDelegate, QWidget, diff --git a/lisp/ui/widgets/hotkeyedit.py b/lisp/ui/widgets/hotkeyedit.py index 265ebd7ef..9ddbde2c0 100644 --- a/lisp/ui/widgets/hotkeyedit.py +++ b/lisp/ui/widgets/hotkeyedit.py @@ -17,56 +17,38 @@ from functools import partial -from PyQt5.QtCore import Qt, QEvent -from PyQt5.QtGui import QKeySequence -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import Qt, QEvent, QKeyCombination +from PyQt6.QtGui import QKeySequence, QAction +from PyQt6.QtWidgets import ( QWidget, QLineEdit, QSizePolicy, QHBoxLayout, QMenu, - QAction, ) from lisp.ui.icons import IconTheme -from lisp.ui.ui_utils import translate - -KEYS_FILTER = { - Qt.Key_Control, - Qt.Key_Shift, - Qt.Key_Meta, - Qt.Key_Alt, - Qt.Key_AltGr, - Qt.Key_unknown, -} - - -def keyEventKeySequence(keyEvent) -> QKeySequence: - key = keyEvent.key() - if key not in KEYS_FILTER: - modifiers = keyEvent.modifiers() - if modifiers & Qt.ShiftModifier: - key += Qt.SHIFT - if modifiers & Qt.ControlModifier: - key += Qt.CTRL - if modifiers & Qt.AltModifier: - key += Qt.ALT - if modifiers & Qt.MetaModifier: - key += Qt.META - - return QKeySequence(key) - - return QKeySequence() +from lisp.ui.ui_utils import translate, key_sequence_from_event class HotKeyEdit(QWidget): SPECIAL_KEYS = [ - QKeySequence(Qt.Key_Escape), - QKeySequence(Qt.Key_Return), - QKeySequence(Qt.Key_Tab), - QKeySequence(Qt.Key_Tab + Qt.SHIFT), - QKeySequence(Qt.Key_Tab + Qt.CTRL), - QKeySequence(Qt.Key_Tab + Qt.SHIFT + Qt.CTRL), + QKeySequence(Qt.Key.Key_Escape), + QKeySequence(Qt.Key.Key_Return), + QKeySequence(Qt.Key.Key_Tab), + QKeySequence( + QKeyCombination(Qt.KeyboardModifier.ShiftModifier, Qt.Key.Key_Tab) + ), + QKeySequence( + QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_Tab) + ), + QKeySequence( + QKeyCombination( + Qt.KeyboardModifier.ShiftModifier + | Qt.KeyboardModifier.ControlModifier, + Qt.Key.Key_Tab, + ) + ), ] def __init__( @@ -78,10 +60,12 @@ def __init__( **kwargs, ): super().__init__(parent, **kwargs) - self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) - self.setFocusPolicy(Qt.StrongFocus) - self.setAttribute(Qt.WA_MacShowFocusRect, True) - self.setAttribute(Qt.WA_InputMethodEnabled, False) + self.setSizePolicy( + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed + ) + self.setFocusPolicy(Qt.FocusPolicy.StrongFocus) + self.setAttribute(Qt.WidgetAttribute.WA_MacShowFocusRect, True) + self.setAttribute(Qt.WidgetAttribute.WA_InputMethodEnabled, False) self.setLayout(QHBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) @@ -91,7 +75,9 @@ def __init__( self.previewEdit.setReadOnly(True) self.previewEdit.setFocusProxy(self) self.previewEdit.installEventFilter(self) - self.previewEdit.setContextMenuPolicy(Qt.NoContextMenu) + self.previewEdit.setContextMenuPolicy( + Qt.ContextMenuPolicy.NoContextMenu + ) self.previewEdit.selectionChanged.connect(self.previewEdit.deselect) self.layout().addWidget(self.previewEdit) @@ -99,7 +85,7 @@ def __init__( for special in HotKeyEdit.SPECIAL_KEYS: action = QAction( IconTheme.get("list-add-symbolic"), - special.toString(QKeySequence.NativeText), + special.toString(QKeySequence.SequenceFormat.NativeText), self.specialMenu, ) action.triggered.connect(partial(self.setKeySequence, special)) @@ -108,13 +94,14 @@ def __init__( if keysButton: action = self.previewEdit.addAction( IconTheme.get("input-keyboard-symbolic"), - QLineEdit.TrailingPosition, + QLineEdit.ActionPosition.TrailingPosition, ) action.triggered.connect(self.onToolsAction) if clearButton: action = self.previewEdit.addAction( - IconTheme.get("edit-clear-symbolic"), QLineEdit.TrailingPosition + IconTheme.get("edit-clear-symbolic"), + QLineEdit.ActionPosition.TrailingPosition, ) action.triggered.connect(self.clear) @@ -130,7 +117,9 @@ def keySequence(self) -> QKeySequence: def setKeySequence(self, keySequence: QKeySequence): self._keySequence = keySequence - self.previewEdit.setText(keySequence.toString(QKeySequence.NativeText)) + self.previewEdit.setText( + keySequence.toString(QKeySequence.SequenceFormat.NativeText) + ) def clear(self): self.setKeySequence(QKeySequence()) @@ -138,9 +127,9 @@ def clear(self): def event(self, event: QEvent): event_type = event.type() - if event_type == QEvent.Shortcut: + if event_type == QEvent.Type.Shortcut: return True - elif event_type == QEvent.ShortcutOverride: + elif event_type == QEvent.Type.ShortcutOverride: event.accept() return True @@ -151,7 +140,7 @@ def contextMenuEvent(self, event): self.specialMenu.popup(event.globalPos()) def keyPressEvent(self, event): - sequence = keyEventKeySequence(event) + sequence = key_sequence_from_event(event) if sequence: self.setKeySequence(sequence) diff --git a/lisp/ui/widgets/locales.py b/lisp/ui/widgets/locales.py index 0b34abb26..281a2beb8 100644 --- a/lisp/ui/widgets/locales.py +++ b/lisp/ui/widgets/locales.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QLocale -from PyQt5.QtWidgets import QComboBox +from PyQt6.QtCore import QLocale +from PyQt6.QtWidgets import QComboBox from lisp.ui.ui_utils import search_translations diff --git a/lisp/ui/widgets/pagestreewidget.py b/lisp/ui/widgets/pagestreewidget.py index c6adc32a4..830b46a33 100644 --- a/lisp/ui/widgets/pagestreewidget.py +++ b/lisp/ui/widgets/pagestreewidget.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QModelIndex, QAbstractItemModel, Qt -from PyQt5.QtWidgets import QWidget, QGridLayout, QTreeView, QSizePolicy +from PyQt6.QtCore import QModelIndex, QAbstractItemModel, Qt +from PyQt6.QtWidgets import QWidget, QGridLayout, QTreeView, QSizePolicy from lisp.ui.qdelegates import PaddedDelegate from lisp.ui.ui_utils import translate @@ -68,7 +68,7 @@ def _changePage(self, selected): self._currentWidget.hide() self._currentWidget = selected.indexes()[0].internalPointer().page self._currentWidget.setSizePolicy( - QSizePolicy.Ignored, QSizePolicy.Ignored + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Ignored ) self.layout().addWidget(self._currentWidget, 0, 1) self._currentWidget.show() @@ -119,7 +119,7 @@ def walk(self): class PagesTreeModel(QAbstractItemModel): - PageRole = Qt.UserRole + 1 + PageRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, tr_context="", **kwargs): super().__init__(**kwargs) @@ -135,10 +135,10 @@ def rowCount(self, parent=QModelIndex()): def columnCount(self, parent=QModelIndex()): return 1 - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): if index.isValid(): node = index.internalPointer() - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: if self._tr_context: return translate(self._tr_context, node.page.Name) @@ -146,11 +146,13 @@ def data(self, index, role=Qt.DisplayRole): elif role == PagesTreeModel.PageRole: return node.page - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData( + self, section, orientation, role=Qt.ItemDataRole.DisplayRole + ): return None def flags(self, index): - return Qt.ItemIsEnabled | Qt.ItemIsSelectable + return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable def node(self, index): if index.isValid(): diff --git a/lisp/ui/widgets/qclicklabel.py b/lisp/ui/widgets/qclicklabel.py index 069209bbe..bd033f402 100644 --- a/lisp/ui/widgets/qclicklabel.py +++ b/lisp/ui/widgets/qclicklabel.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import pyqtSignal, QEvent -from PyQt5.QtWidgets import QLabel +from PyQt6.QtCore import pyqtSignal, QEvent +from PyQt6.QtWidgets import QLabel class QClickLabel(QLabel): diff --git a/lisp/ui/widgets/qclickslider.py b/lisp/ui/widgets/qclickslider.py index 2e0fc2564..16994ac61 100644 --- a/lisp/ui/widgets/qclickslider.py +++ b/lisp/ui/widgets/qclickslider.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, pyqtSignal -from PyQt5.QtWidgets import QSlider, QStyle, QStyleOptionSlider +from PyQt6.QtCore import Qt, pyqtSignal +from PyQt6.QtWidgets import QSlider, QStyle, QStyleOptionSlider class QClickSlider(QSlider): @@ -25,13 +25,13 @@ class QClickSlider(QSlider): def mousePressEvent(self, e): cr = self._control_rect() - if e.button() == Qt.LeftButton and not cr.contains(e.pos()): + if e.button() == Qt.MouseButton.LeftButton and not cr.contains(e.pos()): # Set the value to the minimum value = self.minimum() # zmax is the maximum value starting from zero zmax = self.maximum() - self.minimum() - if self.orientation() == Qt.Vertical: + if self.orientation() == Qt.Orientation.Vertical: # Add the current position multiplied for value/size ratio value += (self.height() - e.y()) * (zmax / self.height()) else: @@ -51,5 +51,7 @@ def _control_rect(self): self.initStyleOption(opt) return self.style().subControlRect( - QStyle.CC_Slider, opt, QStyle.SC_SliderHandle + QStyle.ComplexControl.CC_Slider, + opt, + QStyle.SubControl.SC_SliderHandle, ) diff --git a/lisp/ui/widgets/qeditabletabbar.py b/lisp/ui/widgets/qeditabletabbar.py index 1ff9b67f6..a8b8b29ed 100644 --- a/lisp/ui/widgets/qeditabletabbar.py +++ b/lisp/ui/widgets/qeditabletabbar.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt, QEvent, pyqtSignal -from PyQt5.QtWidgets import QTabBar, QLineEdit +from PyQt6.QtCore import Qt, QEvent, pyqtSignal +from PyQt6.QtWidgets import QTabBar, QLineEdit class QEditableTabBar(QTabBar): @@ -26,7 +26,7 @@ def __init__(self, *args): super().__init__(*args) self._editor = QLineEdit(self) - self._editor.setWindowFlags(Qt.Popup) + self._editor.setWindowFlags(Qt.WindowType.Popup) self._editor.setFocusProxy(self) self._editor.editingFinished.connect(self.handleEditingFinished) @@ -34,11 +34,12 @@ def __init__(self, *args): def eventFilter(self, widget, event): clickOutside = ( - event.type() == QEvent.MouseButtonPress + event.type() == QEvent.Type.MouseButtonPress and not self._editor.geometry().contains(event.globalPos()) ) escKey = ( - event.type() == QEvent.KeyPress and event.key() == Qt.Key_Escape + event.type() == QEvent.Type.KeyPress + and event.key() == Qt.Key.Key_Escape ) if clickOutside or escKey: @@ -48,7 +49,7 @@ def eventFilter(self, widget, event): return super().eventFilter(widget, event) def keyPressEvent(self, event): - if event.key() == Qt.Key_F2: + if event.key() == Qt.Key.Key_F2: self.editTab(self.currentIndex()) else: super().keyPressEvent(event) diff --git a/lisp/ui/widgets/qenumcombobox.py b/lisp/ui/widgets/qenumcombobox.py index 9e00c2de8..686494b69 100644 --- a/lisp/ui/widgets/qenumcombobox.py +++ b/lisp/ui/widgets/qenumcombobox.py @@ -1,6 +1,6 @@ from enum import Enum -from PyQt5.QtWidgets import QComboBox +from PyQt6.QtWidgets import QComboBox class QEnumComboBox(QComboBox): diff --git a/lisp/ui/widgets/qiconpushbutton.py b/lisp/ui/widgets/qiconpushbutton.py index d61a8cef8..9b3ee4444 100644 --- a/lisp/ui/widgets/qiconpushbutton.py +++ b/lisp/ui/widgets/qiconpushbutton.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import QSize -from PyQt5.QtWidgets import QPushButton +from PyQt6.QtCore import QSize +from PyQt6.QtWidgets import QPushButton class QIconPushButton(QPushButton): diff --git a/lisp/ui/widgets/qmutebutton.py b/lisp/ui/widgets/qmutebutton.py index 69670021a..a44ae0aa1 100644 --- a/lisp/ui/widgets/qmutebutton.py +++ b/lisp/ui/widgets/qmutebutton.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtWidgets import QPushButton +from PyQt6.QtWidgets import QPushButton from lisp.ui.icons import IconTheme diff --git a/lisp/ui/widgets/qsteptimeedit.py b/lisp/ui/widgets/qsteptimeedit.py index 63619067c..8b742a02d 100644 --- a/lisp/ui/widgets/qsteptimeedit.py +++ b/lisp/ui/widgets/qsteptimeedit.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtWidgets import QTimeEdit +from PyQt6.QtWidgets import QTimeEdit class QStepTimeEdit(QTimeEdit): diff --git a/lisp/ui/widgets/qstyledslider.py b/lisp/ui/widgets/qstyledslider.py index 585f27852..bddcf1570 100644 --- a/lisp/ui/widgets/qstyledslider.py +++ b/lisp/ui/widgets/qstyledslider.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QColor -from PyQt5.QtWidgets import QSlider, QStylePainter, QStyleOptionSlider, QStyle +from PyQt6.QtCore import Qt +from PyQt6.QtGui import QColor +from PyQt6.QtWidgets import QSlider, QStylePainter, QStyleOptionSlider, QStyle class QStyledSlider(QSlider): @@ -34,7 +34,9 @@ def paintEvent(self, event): tick = 5 handle = self.style().subControlRect( - QStyle.CC_Slider, option, QStyle.SC_SliderHandle + QStyle.ComplexControl.CC_Slider, + option, + QStyle.SubControl.SC_SliderHandle, ) # Draw tick marks @@ -45,14 +47,14 @@ def paintEvent(self, event): slide_range = self.maximum() - self.minimum() - if self.orientation() == Qt.Horizontal: + if self.orientation() == Qt.Orientation.Horizontal: no_handle_size = self.width() - handle.width() handle_half_size = handle.width() / 2 else: no_handle_size = self.height() - handle.height() handle_half_size = handle.height() / 2 - if self.tickPosition() != QSlider.NoTicks: + if self.tickPosition() != QSlider.TickPosition.NoTicks: for i in range(self.minimum(), self.maximum() + 1, interval): y = 0 x = ( @@ -63,27 +65,27 @@ def paintEvent(self, event): - 1 ) - if self.orientation() == Qt.Vertical: + if self.orientation() == Qt.Orientation.Vertical: x, y = y, x - # QSlider.TicksAbove == QSlider.TicksLeft + # QSlider.TickPosition.TicksAbove == QSlider.TickPosition.TicksLeft if ( - self.tickPosition() == QSlider.TicksBothSides - or self.tickPosition() == QSlider.TicksAbove + self.tickPosition() == QSlider.TickPosition.TicksBothSides + or self.tickPosition() == QSlider.TickPosition.TicksAbove ): - if self.orientation() == Qt.Horizontal: + if self.orientation() == Qt.Orientation.Horizontal: y = self.rect().top() painter.drawLine(x, y, x, y + tick) else: x = self.rect().left() painter.drawLine(x, y, x + tick, y) - # QSlider.TicksBelow == QSlider.TicksRight + # QSlider.TickPosition.TicksBelow == QSlider.TickPosition.TicksRight if ( - self.tickPosition() == QSlider.TicksBothSides - or self.tickPosition() == QSlider.TicksBelow + self.tickPosition() == QSlider.TickPosition.TicksBothSides + or self.tickPosition() == QSlider.TickPosition.TicksBelow ): - if self.orientation() == Qt.Horizontal: + if self.orientation() == Qt.Orientation.Horizontal: y = self.rect().bottom() painter.drawLine(x, y, x, y - tick) else: diff --git a/lisp/ui/widgets/qvertiacallabel.py b/lisp/ui/widgets/qvertiacallabel.py index bbf84914c..4d834af1c 100644 --- a/lisp/ui/widgets/qvertiacallabel.py +++ b/lisp/ui/widgets/qvertiacallabel.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Linux Show Player. If not, see . -from PyQt5 import QtCore -from PyQt5.QtGui import QPainter -from PyQt5.QtWidgets import QLabel +from PyQt6 import QtCore +from PyQt6.QtGui import QPainter +from PyQt6.QtWidgets import QLabel class QVerticalLabel(QLabel): diff --git a/lisp/ui/widgets/qwaitingspinner.py b/lisp/ui/widgets/qwaitingspinner.py index db11f439f..ac8ec4175 100644 --- a/lisp/ui/widgets/qwaitingspinner.py +++ b/lisp/ui/widgets/qwaitingspinner.py @@ -28,27 +28,27 @@ import math -from PyQt5.QtCore import Qt, QTimer, QRectF -from PyQt5.QtGui import QPainter, QColor -from PyQt5.QtWidgets import QWidget +from PyQt6.QtCore import Qt, QTimer, QRectF +from PyQt6.QtGui import QPainter, QColor +from PyQt6.QtWidgets import QWidget class QWaitingSpinner(QWidget): def __init__( self, parent=None, - centerOnParent=Qt.AlignCenter, + centerOnParent=Qt.AlignmentFlag.AlignCenter, disableParentWhenSpinning=False, - modality=Qt.NonModal, + modality=Qt.WindowModality.NonModal, ): super().__init__(parent) self.setWindowModality(modality) - self.setAttribute(Qt.WA_TranslucentBackground) + self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) self._centerOnParent = centerOnParent self._disableParentWhenSpinning = disableParentWhenSpinning - self._color = Qt.gray + self._color = Qt.GlobalColor.gray self._roundness = 100.0 self._minimumTrailOpacity = math.pi self._trailFadePercentage = 80.0 @@ -73,9 +73,9 @@ def paintEvent(self, QPaintEvent): ) painter = QPainter(self) - painter.fillRect(self.rect(), Qt.transparent) - painter.setRenderHint(QPainter.Antialiasing, True) - painter.setPen(Qt.NoPen) + painter.fillRect(self.rect(), Qt.GlobalColor.transparent) + painter.setRenderHint(QPainter.RenderHint.Antialiasing, True) + painter.setPen(Qt.PenStyle.NoPen) painter.translate( self._innerRadius + self._lineLength, self._innerRadius + self._lineLength, @@ -102,7 +102,7 @@ def paintEvent(self, QPaintEvent): linesRect, self._roundness, self._roundness, - Qt.RelativeSize, + Qt.SizeMode.RelativeSize, ) painter.restore() @@ -177,7 +177,7 @@ def isSpinning(self): def setRoundness(self, roundness): self._roundness = max(0.0, min(100.0, roundness)) - def setColor(self, color=Qt.gray): + def setColor(self, color=Qt.GlobalColor.gray): self._color = QColor(color) def setRevolutionsPerSecond(self, revolutionsPerSecond): @@ -211,9 +211,9 @@ def updatePosition(self): x = self.x() y = self.y() - if self._centerOnParent & Qt.AlignHCenter: + if self._centerOnParent & Qt.AlignmentFlag.AlignHCenter: x = int(self.parentWidget().width() / 2 - self.width() / 2) - if self._centerOnParent & Qt.AlignVCenter: + if self._centerOnParent & Qt.AlignmentFlag.AlignVCenter: y = int(self.parentWidget().height() / 2 - self.height() / 2) self.move(x, y) diff --git a/lisp/ui/widgets/waveform.py b/lisp/ui/widgets/waveform.py index 092e352ca..4b23adb5a 100644 --- a/lisp/ui/widgets/waveform.py +++ b/lisp/ui/widgets/waveform.py @@ -1,8 +1,8 @@ from math import floor, ceil -from PyQt5.QtCore import QLineF, pyqtSignal, Qt, QRectF -from PyQt5.QtGui import QPainter, QPen, QColor, QBrush -from PyQt5.QtWidgets import QWidget +from PyQt6.QtCore import QLineF, pyqtSignal, Qt, QRectF +from PyQt6.QtGui import QPainter, QPen, QColor, QBrush +from PyQt6.QtWidgets import QWidget from lisp.backend.waveform import Waveform from lisp.core.signal import Connection @@ -58,7 +58,7 @@ def setValue(self, value): (self._value - self._lastDrawnValue) / self._valueToPx ) # Repaint only the changed area - self.update(x - 1, 0, width + 1, self.height()) + self.update(x - 1, 0, width + 2, self.height()) elif self._value <= ceil(self._lastDrawnValue - self._valueToPx): x = int(self._value / self._valueToPx) width = int( @@ -79,9 +79,9 @@ def paintEvent(self, event): pen = QPen(QColor(0, 0, 0, 0)) painter.setPen(pen) painter.setBrush(QBrush(self.backgroundColor)) - painter.setRenderHint(QPainter.Antialiasing) + painter.setRenderHint(QPainter.RenderHint.Antialiasing) painter.drawRoundedRect(self.rect(), 6, 6) - painter.setRenderHint(QPainter.Antialiasing, False) + painter.setRenderHint(QPainter.RenderHint.Antialiasing, False) # Draw the weveform pen.setWidth(1) @@ -169,9 +169,9 @@ def __init__(self, waveform, **kwargs): self._labelRight = True self._maxFontSize = self.font().pointSizeF() - self.seekIndicatorColor = QColor(Qt.red) + self.seekIndicatorColor = QColor(Qt.GlobalColor.red) self.seekTimestampBG = QColor(32, 32, 32) - self.seekTimestampFG = QColor(Qt.white) + self.seekTimestampFG = QColor(Qt.GlobalColor.white) def _xToValue(self, x): return round(x * self._valueToPx) @@ -225,7 +225,7 @@ def paintEvent(self, event): # Get the timestamp of the indicator position text = strtime(self._xToValue(self._lastPosition))[:-3] - textSize = self.fontMetrics().size(Qt.TextSingleLine, text) + textSize = self.fontMetrics().size(Qt.TextFlag.TextSingleLine, text) # Vertical offset to center the label vOffset = (self.height() - textSize.height()) / 2 @@ -253,6 +253,6 @@ def paintEvent(self, event): # Draw the timestamp pen.setColor(self.seekTimestampFG) painter.setPen(pen) - painter.drawText(rect, Qt.AlignCenter, text) + painter.drawText(rect, Qt.AlignmentFlag.AlignCenter, text) painter.end() diff --git a/poetry.lock b/poetry.lock index 1131761c6..3a9ede6b1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -806,67 +806,73 @@ files = [ dev = ["PyGObject", "black (>=25.1.0)", "codespell (>=2.4.1)", "isort (>=6.0.1)", "pre-commit", "ruff (>=0.9.10)"] [[package]] -name = "pyqt5" -version = "5.15.11" +name = "pyqt6" +version = "6.9.0" description = "Python bindings for the Qt cross platform application toolkit" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" groups = ["main"] files = [ - {file = "PyQt5-5.15.11-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:c8b03dd9380bb13c804f0bdb0f4956067f281785b5e12303d529f0462f9afdc2"}, - {file = "PyQt5-5.15.11-cp38-abi3-macosx_11_0_x86_64.whl", hash = "sha256:6cd75628f6e732b1ffcfe709ab833a0716c0445d7aec8046a48d5843352becb6"}, - {file = "PyQt5-5.15.11-cp38-abi3-manylinux_2_17_x86_64.whl", hash = "sha256:cd672a6738d1ae33ef7d9efa8e6cb0a1525ecf53ec86da80a9e1b6ec38c8d0f1"}, - {file = "PyQt5-5.15.11-cp38-abi3-win32.whl", hash = "sha256:76be0322ceda5deecd1708a8d628e698089a1cea80d1a49d242a6d579a40babd"}, - {file = "PyQt5-5.15.11-cp38-abi3-win_amd64.whl", hash = "sha256:bdde598a3bb95022131a5c9ea62e0a96bd6fb28932cc1619fd7ba211531b7517"}, - {file = "PyQt5-5.15.11.tar.gz", hash = "sha256:fda45743ebb4a27b4b1a51c6d8ef455c4c1b5d610c90d2934c7802b5c1557c52"}, + {file = "PyQt6-6.9.0-cp39-abi3-macosx_10_14_universal2.whl", hash = "sha256:5344240747e81bde1a4e0e98d4e6e2d96ad56a985d8f36b69cd529c1ca9ff760"}, + {file = "PyQt6-6.9.0-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:e344868228c71fc89a0edeb325497df4ff731a89cfa5fe57a9a4e9baecc9512b"}, + {file = "PyQt6-6.9.0-cp39-abi3-manylinux_2_39_aarch64.whl", hash = "sha256:1cbc5a282454cf19691be09eadbde019783f1ae0523e269b211b0173b67373f6"}, + {file = "PyQt6-6.9.0-cp39-abi3-win_amd64.whl", hash = "sha256:d36482000f0cd7ce84a35863766f88a5e671233d5f1024656b600cd8915b3752"}, + {file = "PyQt6-6.9.0-cp39-abi3-win_arm64.whl", hash = "sha256:0c8b7251608e05b479cfe731f95857e853067459f7cbbcfe90f89de1bcf04280"}, + {file = "pyqt6-6.9.0.tar.gz", hash = "sha256:6a8ff8e3cd18311bb7d937f7d741e787040ae7ff47ce751c28a94c5cddc1b4e6"}, ] [package.dependencies] -PyQt5-Qt5 = ">=5.15.2,<5.16.0" -PyQt5-sip = ">=12.15,<13" +PyQt6-Qt6 = ">=6.9.0,<6.10.0" +PyQt6-sip = ">=13.8,<14" [[package]] -name = "pyqt5-qt5" -version = "5.15.17" -description = "The subset of a Qt installation needed by PyQt5." +name = "pyqt6-qt6" +version = "6.9.0" +description = "The subset of a Qt installation needed by PyQt6." optional = false python-versions = "*" groups = ["main"] files = [ - {file = "PyQt5_Qt5-5.15.17-py3-none-macosx_10_13_x86_64.whl", hash = "sha256:d8b8094108e748b4bbd315737cfed81291d2d228de43278f0b8bd7d2b808d2b9"}, - {file = "PyQt5_Qt5-5.15.17-py3-none-macosx_11_0_arm64.whl", hash = "sha256:b68628f9b8261156f91d2f72ebc8dfb28697c4b83549245d9a68195bd2d74f0c"}, - {file = "PyQt5_Qt5-5.15.17-py3-none-manylinux2014_x86_64.whl", hash = "sha256:b018f75d1cc61146396fa5af14da1db77c5d6318030e5e366f09ffdf7bd358d8"}, + {file = "PyQt6_Qt6-6.9.0-py3-none-macosx_10_14_x86_64.whl", hash = "sha256:b1c4e4a78f0f22fbf88556e3d07c99e5ce93032feae5c1e575958d914612e0f9"}, + {file = "PyQt6_Qt6-6.9.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:6d3875119dec6bf5f799facea362aa0ad39bb23aa9654112faa92477abccb5ff"}, + {file = "PyQt6_Qt6-6.9.0-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:9c0e603c934e4f130c110190fbf2c482ff1221a58317266570678bc02db6b152"}, + {file = "PyQt6_Qt6-6.9.0-py3-none-manylinux_2_39_aarch64.whl", hash = "sha256:cf840e8ae20a0704e0343810cf0e485552db28bf09ea976e58ec0e9b7bb27fcd"}, + {file = "PyQt6_Qt6-6.9.0-py3-none-win_amd64.whl", hash = "sha256:c825a6f5a9875ef04ef6681eda16aa3a9e9ad71847aa78dfafcf388c8007aa0a"}, + {file = "PyQt6_Qt6-6.9.0-py3-none-win_arm64.whl", hash = "sha256:1188f118d1c570d27fba39707e3d8a48525f979816e73de0da55b9e6fa9ad0a1"}, ] [[package]] -name = "pyqt5-sip" -version = "12.17.0" -description = "The sip module support for PyQt5" +name = "pyqt6-sip" +version = "13.10.2" +description = "The sip module support for PyQt6" optional = false python-versions = ">=3.9" groups = ["main"] files = [ - {file = "PyQt5_sip-12.17.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ec47914cc751608e587c1c2fdabeaf4af7fdc28b9f62796c583bea01c1a1aa3e"}, - {file = "PyQt5_sip-12.17.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:2f2a8dcc7626fe0da73a0918e05ce2460c7a14ddc946049310e6e35052105434"}, - {file = "PyQt5_sip-12.17.0-cp310-cp310-win32.whl", hash = "sha256:0c75d28b8282be3c1d7dbc76950d6e6eba1e334783224e9b9835ce1a9c64f482"}, - {file = "PyQt5_sip-12.17.0-cp310-cp310-win_amd64.whl", hash = "sha256:8c4bc535bae0dfa764e8534e893619fe843ce5a2e25f901c439bcb960114f686"}, - {file = "PyQt5_sip-12.17.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:2c912807dd638644168ea8c7a447bfd9d85a19471b98c2c588c4d2e911c09b0a"}, - {file = "PyQt5_sip-12.17.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:71514a7d43b44faa1d65a74ad2c5da92c03a251bdc749f009c313f06cceacc9a"}, - {file = "PyQt5_sip-12.17.0-cp311-cp311-win32.whl", hash = "sha256:023466ae96f72fbb8419b44c3f97475de6642fa5632520d0f50fc1a52a3e8200"}, - {file = "PyQt5_sip-12.17.0-cp311-cp311-win_amd64.whl", hash = "sha256:fb565469d08dcb0a427def0c45e722323beb62db79454260482b6948bfd52d47"}, - {file = "PyQt5_sip-12.17.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:ea08341c8a5da00c81df0d689ecd4ee47a95e1ecad9e362581c92513f2068005"}, - {file = "PyQt5_sip-12.17.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:4a92478d6808040fbe614bb61500fbb3f19f72714b99369ec28d26a7e3494115"}, - {file = "PyQt5_sip-12.17.0-cp312-cp312-win32.whl", hash = "sha256:b0ff280b28813e9bfd3a4de99490739fc29b776dc48f1c849caca7239a10fc8b"}, - {file = "PyQt5_sip-12.17.0-cp312-cp312-win_amd64.whl", hash = "sha256:54c31de7706d8a9a8c0fc3ea2c70468aba54b027d4974803f8eace9c22aad41c"}, - {file = "PyQt5_sip-12.17.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:c7a7ff355e369616b6bcb41d45b742327c104b2bf1674ec79b8d67f8f2fa9543"}, - {file = "PyQt5_sip-12.17.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:419b9027e92b0b707632c370cfc6dc1f3b43c6313242fc4db57a537029bd179c"}, - {file = "PyQt5_sip-12.17.0-cp313-cp313-win32.whl", hash = "sha256:351beab964a19f5671b2a3e816ecf4d3543a99a7e0650f88a947fea251a7589f"}, - {file = "PyQt5_sip-12.17.0-cp313-cp313-win_amd64.whl", hash = "sha256:672c209d05661fab8e17607c193bf43991d268a1eefbc2c4551fbf30fd8bb2ca"}, - {file = "PyQt5_sip-12.17.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:d65a9c1b4cbbd8e856254609f56e897d2cb5c903f77b75fb720cb3a32c76b92b"}, - {file = "PyQt5_sip-12.17.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:32b03e7e77ecd7b4119eba486b0706fa59b490bcceb585f9b6ddec8a582082db"}, - {file = "PyQt5_sip-12.17.0-cp39-cp39-win32.whl", hash = "sha256:5b6c734f4ad28f3defac4890ed747d391d246af279200935d49953bc7d915b8c"}, - {file = "PyQt5_sip-12.17.0-cp39-cp39-win_amd64.whl", hash = "sha256:855e8f5787d57e26a48d8c3de1220a8e92ab83be8d73966deac62fdae03ea2f9"}, - {file = "pyqt5_sip-12.17.0.tar.gz", hash = "sha256:682dadcdbd2239af9fdc0c0628e2776b820e128bec88b49b8d692fe682f90b4f"}, + {file = "pyqt6_sip-13.10.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:8132ec1cbbecc69d23dcff23916ec07218f1a9bbbc243bf6f1df967117ce303e"}, + {file = "pyqt6_sip-13.10.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:07f77e89d93747dda71b60c3490b00d754451729fbcbcec840e42084bf061655"}, + {file = "pyqt6_sip-13.10.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:4ffa71ddff6ef031d52cd4f88b8bba08b3516313c023c7e5825cf4a0ba598712"}, + {file = "pyqt6_sip-13.10.2-cp310-cp310-win_amd64.whl", hash = "sha256:e907394795e61f1174134465c889177f584336a98d7a10beade2437bf5942244"}, + {file = "pyqt6_sip-13.10.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:1a6c2f168773af9e6c7ef5e52907f16297d4efd346e4c958eda54ea9135be18e"}, + {file = "pyqt6_sip-13.10.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b1d3cc9015a1bd8c8d3e86a009591e897d4d46b0c514aede7d2970a2208749cd"}, + {file = "pyqt6_sip-13.10.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:ddd578a8d975bfb5fef83751829bf09a97a1355fa1de098e4fb4d1b74ee872fc"}, + {file = "pyqt6_sip-13.10.2-cp311-cp311-win_amd64.whl", hash = "sha256:061d4a2eb60a603d8be7db6c7f27eb29d9cea97a09aa4533edc1662091ce4f03"}, + {file = "pyqt6_sip-13.10.2-cp311-cp311-win_arm64.whl", hash = "sha256:45ac06f0380b7aa4fcffd89f9e8c00d1b575dc700c603446a9774fda2dcfc0de"}, + {file = "pyqt6_sip-13.10.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:83e6a56d3e715f748557460600ec342cbd77af89ec89c4f2a68b185fa14ea46c"}, + {file = "pyqt6_sip-13.10.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ccf197f8fa410e076936bee28ad9abadb450931d5be5625446fd20e0d8b27a6"}, + {file = "pyqt6_sip-13.10.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:37af463dcce39285e686d49523d376994d8a2508b9acccb7616c4b117c9c4ed7"}, + {file = "pyqt6_sip-13.10.2-cp312-cp312-win_amd64.whl", hash = "sha256:c7b34a495b92790c70eae690d9e816b53d3b625b45eeed6ae2c0fe24075a237e"}, + {file = "pyqt6_sip-13.10.2-cp312-cp312-win_arm64.whl", hash = "sha256:c80cc059d772c632f5319632f183e7578cd0976b9498682833035b18a3483e92"}, + {file = "pyqt6_sip-13.10.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:8b5d06a0eac36038fa8734657d99b5fe92263ae7a0cd0a67be6acfe220a063e1"}, + {file = "pyqt6_sip-13.10.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ad376a6078da37b049fdf9d6637d71b52727e65c4496a80b753ddc8d27526aca"}, + {file = "pyqt6_sip-13.10.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:3dde8024d055f496eba7d44061c5a1ba4eb72fc95e5a9d7a0dbc908317e0888b"}, + {file = "pyqt6_sip-13.10.2-cp313-cp313-win_amd64.whl", hash = "sha256:0b097eb58b4df936c4a2a88a2f367c8bb5c20ff049a45a7917ad75d698e3b277"}, + {file = "pyqt6_sip-13.10.2-cp313-cp313-win_arm64.whl", hash = "sha256:cc6a1dfdf324efaac6e7b890a608385205e652845c62130de919fd73a6326244"}, + {file = "pyqt6_sip-13.10.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:38b5823dca93377f8a4efac3cbfaa1d20229aa5b640c31cf6ebbe5c586333808"}, + {file = "pyqt6_sip-13.10.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5506b9a795098df3b023cc7d0a37f93d3224a9c040c43804d4bc06e0b2b742b0"}, + {file = "pyqt6_sip-13.10.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:e455a181d45a28ee8d18d42243d4f470d269e6ccdee60f2546e6e71218e05bb4"}, + {file = "pyqt6_sip-13.10.2-cp39-cp39-win_amd64.whl", hash = "sha256:9c67ed66e21b11e04ffabe0d93bc21df22e0a5d7e2e10ebc8c1d77d2f5042991"}, + {file = "pyqt6_sip-13.10.2.tar.gz", hash = "sha256:464ad156bf526500ce6bd05cac7a82280af6309974d816739b4a9a627156fafe"}, ] [[package]] @@ -1402,4 +1408,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.1" python-versions = ">= 3.10, < 4.0" -content-hash = "bc3714dc52ad9654be21b90a200f11f438e698a661cfe9b7625d293a6608cdf0" +content-hash = "b5a3a7316594aad0df824b3764ff98e1b3518fd165d52bd2e7368281c04ed1e5" diff --git a/pyproject.toml b/pyproject.toml index 9cb8bfefd..4838a5e82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,8 +28,7 @@ falcon = "^4.0.1" jack-client = "^0.5" mido = "^1.3.3" pygobject = "^3.30" -pyqt5 = "^5.15.2" -pyqt5-qt5 = "^5.15.2" +pyqt6 = "^6.7.1" python-osc = "^1.8.3" python-rtmidi = "^1.1" requests = "^2.20" diff --git a/scripts/flatpak/config.sh b/scripts/flatpak/config.sh index ab13cfa33..a8a04081f 100755 --- a/scripts/flatpak/config.sh +++ b/scripts/flatpak/config.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash export FLATPAK_RUNTIME="org.kde.Platform" -export FLATPAK_RUNTIME_VERSION="5.15-24.08" +export FLATPAK_RUNTIME_VERSION="6.9" export FLATPAK_SDK="org.kde.Sdk" export FLATPAK_INSTALL="$FLATPAK_RUNTIME//$FLATPAK_RUNTIME_VERSION $FLATPAK_SDK//$FLATPAK_RUNTIME_VERSION" @@ -10,7 +10,7 @@ export FLATPAK_PY_LOCKFILE="../../poetry.lock" # Python packages included in the runtime sdk (some are not included in the runtime) export FLATPAK_PY_INCLUDED="cython mako markdown meson pip pygments setuptools six wheel" # Python packages to ignore -export FLATPAK_PY_IGNORE="$FLATPAK_PY_INCLUDED packaging pyalsa pyliblo3 python-rtmidi pygobject pycairo pyqt5 pyqt5-sip pyqt5-qt pyqt5-qt5 numpy" +export FLATPAK_PY_IGNORE="$FLATPAK_PY_INCLUDED packaging pyalsa pyliblo3 python-rtmidi pygobject pycairo pyqt6 pyqt6-sip pyqt6-qt pyqt6-qt6 numpy" export FLATPAK_APP_ID="org.linuxshowplayer.LinuxShowPlayer" export FLATPAK_APP_MODULE="linux-show-player" \ No newline at end of file diff --git a/scripts/flatpak/org.linuxshowplayer.LinuxShowPlayer.json b/scripts/flatpak/org.linuxshowplayer.LinuxShowPlayer.json index 909762b71..784c35a17 100644 --- a/scripts/flatpak/org.linuxshowplayer.LinuxShowPlayer.json +++ b/scripts/flatpak/org.linuxshowplayer.LinuxShowPlayer.json @@ -1,10 +1,10 @@ { "app-id": "org.linuxshowplayer.LinuxShowPlayer", "runtime": "org.kde.Platform", - "runtime-version": "5.15-24.08", + "runtime-version": "6.9", "sdk": "org.kde.Sdk", "base": "com.riverbankcomputing.PyQt.BaseApp", - "base-version": "5.15-24.08", + "base-version": "6.9", "command": "linux-show-player", "rename-icon": "linuxshowplayer", "finish-args": [ @@ -108,9 +108,11 @@ { "type": "git", "url": "https://github.com/FrancescoCeruti/linux-show-player.git", - "branch": "develop" + "branch": "pyqt6" } ] } - ] + ], + "branch": "pyqt6", + "desktop-file-name-suffix": " (pyqt6)" } \ No newline at end of file diff --git a/scripts/flatpak/python-modules.json b/scripts/flatpak/python-modules.json index 6f7ecebe6..43187cb60 100644 --- a/scripts/flatpak/python-modules.json +++ b/scripts/flatpak/python-modules.json @@ -7,28 +7,23 @@ "sources": [ { "type": "file", - "url": "https://files.pythonhosted.org/packages/13/a3/a812df4e2dd5696d1f351d58b8fe16a405b234ad2886a0dab9183fb78109/pycparser-2.22-py3-none-any.whl", - "sha256": "c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc" - }, - { - "type": "file", - "url": "https://files.pythonhosted.org/packages/1d/82/95c5fff8c902eb7cb7e823a43987166b428cdbf94533c66078581f7461a1/JACK_Client-0.5.5-py3-none-any.whl", - "sha256": "f6adb6c9f1473ce3c37505cacc93a99d215b90bf1b81cb4de7ba10767d2618b8" + "url": "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", + "sha256": "946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3" }, { "type": "file", - "url": "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", - "sha256": "946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3" + "url": "https://files.pythonhosted.org/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl", + "sha256": "a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128" }, { "type": "file", - "url": "https://files.pythonhosted.org/packages/4a/7e/3db2bd1b1f9e95f7cddca6d6e75e2f2bd9f51b1246e546d88addca0106bd/certifi-2025.4.26-py3-none-any.whl", - "sha256": "30350364dfe371162649852c63336a15c70c6510c2ad5015b21c2345311805f3" + "url": "https://files.pythonhosted.org/packages/13/a3/a812df4e2dd5696d1f351d58b8fe16a405b234ad2886a0dab9183fb78109/pycparser-2.22-py3-none-any.whl", + "sha256": "c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc" }, { "type": "file", - "url": "https://files.pythonhosted.org/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl", - "sha256": "a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128" + "url": "https://files.pythonhosted.org/packages/1d/82/95c5fff8c902eb7cb7e823a43987166b428cdbf94533c66078581f7461a1/JACK_Client-0.5.5-py3-none-any.whl", + "sha256": "f6adb6c9f1473ce3c37505cacc93a99d215b90bf1b81cb4de7ba10767d2618b8" }, { "type": "file", @@ -40,6 +35,11 @@ "url": "https://files.pythonhosted.org/packages/a0/1e/62a2ec3104394a2975a2629eec89276ede9dbe717092f6966fcf963e1bf0/humanize-4.12.3-py3-none-any.whl", "sha256": "2cbf6370af06568fa6d2da77c86edb7886f3160ecd19ee1ffef07979efc597f6" }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/4a/7e/3db2bd1b1f9e95f7cddca6d6e75e2f2bd9f51b1246e546d88addca0106bd/certifi-2025.4.26-py3-none-any.whl", + "sha256": "30350364dfe371162649852c63336a15c70c6510c2ad5015b21c2345311805f3" + }, { "type": "file", "url": "https://files.pythonhosted.org/packages/57/04/01b3de6a7565cfc20f3bf4fce959b099ad30a08157865436d48cc02f6c08/python_osc-1.9.3-py3-none-any.whl", @@ -50,6 +50,11 @@ "url": "https://files.pythonhosted.org/packages/ea/ef/114a8720ee05915a611bed317fe5c3fdb4c6f5aa0f9f522a288491c6f850/qdigitalmeter-0.1.0-py3-none-any.whl", "sha256": "abcaa253813d484746967c25c72a19ab460d5b7a5bd92e9b99cd9b1559933012" }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/20/e2/ef821224a9ca9d4bb81d6e7ba60c6fbf3eae2e0dc10d806e6ff21b6dfdc5/falcon-4.0.2-py3-none-any.whl", + "sha256": "077b2abf001940c6128c9b5872ae8147fe13f6ca333f928d8045d7601a5e847e" + }, { "type": "file", "url": "https://files.pythonhosted.org/packages/69/76/37c0ccd5ab968a6a438f9c623aeecc84c202ab2fabc6a8fd927580c15b5a/QtPy-2.4.3-py3-none-any.whl", @@ -60,11 +65,6 @@ "url": "https://files.pythonhosted.org/packages/32/46/9cb0e58b2deb7f82b84065f37f3bffeb12413f947f9388e4cac22c4621ce/sortedcontainers-2.4.0-py2.py3-none-any.whl", "sha256": "a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0" }, - { - "type": "file", - "url": "https://files.pythonhosted.org/packages/6b/11/cc635220681e93a0183390e26485430ca2c7b5f9d33b15c74c2861cb8091/urllib3-2.4.0-py3-none-any.whl", - "sha256": "4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813" - }, { "type": "file", "url": "https://files.pythonhosted.org/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl", @@ -72,18 +72,18 @@ }, { "type": "file", - "url": "https://files.pythonhosted.org/packages/20/e2/ef821224a9ca9d4bb81d6e7ba60c6fbf3eae2e0dc10d806e6ff21b6dfdc5/falcon-4.0.2-py3-none-any.whl", - "sha256": "077b2abf001940c6128c9b5872ae8147fe13f6ca333f928d8045d7601a5e847e" + "url": "https://files.pythonhosted.org/packages/6b/11/cc635220681e93a0183390e26485430ca2c7b5f9d33b15c74c2861cb8091/urllib3-2.4.0-py3-none-any.whl", + "sha256": "4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813" }, { "type": "file", - "url": "https://files.pythonhosted.org/packages/20/94/c5790835a017658cbfabd07f3bfb549140c3ac458cfc196323996b10095a/charset_normalizer-3.4.2-py3-none-any.whl", - "sha256": "7f56930ab0abd1c45cd15be65cc741c28b1c9a34876ce8c17a2fa107810c0af0" + "url": "https://files.pythonhosted.org/packages/fc/97/c783634659c2920c3fc70419e3af40972dbaf758daa229a7d6ea6135c90d/cffi-1.17.1.tar.gz", + "sha256": "1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824" }, { "type": "file", - "url": "https://files.pythonhosted.org/packages/fc/97/c783634659c2920c3fc70419e3af40972dbaf758daa229a7d6ea6135c90d/cffi-1.17.1.tar.gz", - "sha256": "1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824" + "url": "https://files.pythonhosted.org/packages/20/94/c5790835a017658cbfabd07f3bfb549140c3ac458cfc196323996b10095a/charset_normalizer-3.4.2-py3-none-any.whl", + "sha256": "7f56930ab0abd1c45cd15be65cc741c28b1c9a34876ce8c17a2fa107810c0af0" } ] } \ No newline at end of file