diff --git a/.gitignore b/.gitignore index 0196d6b386..f1c9768401 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,7 @@ qrc_resources.cpp *.pyc # Qt files +qt_config.py *_ui.hpp *_ui.py *_rc.cpp diff --git a/Makefile b/Makefile index 484242a1e0..3d2359ed82 100644 --- a/Makefile +++ b/Makefile @@ -707,6 +707,8 @@ endif $(LINK) ../carla_utils.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../carla_widgets.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../externalui.py $(DESTDIR)$(DATADIR)/carla/resources + $(LINK) ../qt_compat.py $(DESTDIR)$(DATADIR)/carla/resources + $(LINK) ../qt_config.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../resources_rc.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../ui_carla_about.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../ui_carla_edit.py $(DESTDIR)$(DATADIR)/carla/resources diff --git a/source/Makefile.deps.mk b/source/Makefile.deps.mk index 9d6bc37338..f1f4de7c82 100644 --- a/source/Makefile.deps.mk +++ b/source/Makefile.deps.mk @@ -363,7 +363,7 @@ PYRCC ?= $(PYRCC5) PYUIC ?= $(PYUIC5) else ifneq ($(PYUIC6),) PYRCC ?= $(RCC_QT6) -g python -PYUIC ?= $(PYRCC6) +PYUIC ?= $(PYUIC6) endif # --------------------------------------------------------------------------------------------------------------------- diff --git a/source/frontend/Makefile b/source/frontend/Makefile index 0242d1ca28..2a6193f9f4 100644 --- a/source/frontend/Makefile +++ b/source/frontend/Makefile @@ -71,6 +71,7 @@ OBJS = $(CPP_FILES:%=$(OBJDIR)/%.o) # Resources RES = \ + qt_config.py \ resources_rc.py \ $(BINDIR)/resources/modgui \ $(BINDIR)/resources/patchcanvas \ @@ -165,6 +166,10 @@ pluginlist/ui_%.h: pluginlist/%.ui ui_%.py: $(RESDIR)/ui/%.ui $(PYUIC) $< -o $@ +qt_config.py: + echo "#!/usr/bin/env python3" > $@ + echo "qt = $(FRONTEND_TYPE)" >> $@ + resources_rc.py: $(RESDIR)/resources.qrc $(RESDIR)/*/*.png $(RESDIR)/*/*.svg $(RESDIR)/*/*.svgz $(PYRCC) $< -o $@ diff --git a/source/frontend/bigmeter-ui b/source/frontend/bigmeter-ui index e3113f6255..de2a3a9ede 100755 --- a/source/frontend/bigmeter-ui +++ b/source/frontend/bigmeter-ui @@ -1,25 +1,16 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla Native Plugins -# Copyright (C) 2012-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import Qt +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import Qt +elif qt_config == 6: + from PyQt6.QtCore import Qt # ----------------------------------------------------------------------- # Imports (Custom) diff --git a/source/frontend/carla-plugin b/source/frontend/carla-plugin index e80c336095..0148896f68 100755 --- a/source/frontend/carla-plugin +++ b/source/frontend/carla-plugin @@ -1,26 +1,18 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla plugin host (plugin UI) -# Copyright (C) 2013-2020 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the GPL.txt file +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtGui import QKeySequence, QMouseEvent -from PyQt5.QtWidgets import QFrame, QSplitter +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtGui import QKeySequence, QMouseEvent + from PyQt5.QtWidgets import QFrame, QSplitter +elif qt_config == 6: + from PyQt6.QtGui import QKeySequence, QMouseEvent + from PyQt6.QtWidgets import QFrame, QSplitter # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/source/frontend/carla_app.py b/source/frontend/carla_app.py index 4b6285a751..d14d1cbb83 100644 --- a/source/frontend/carla_app.py +++ b/source/frontend/carla_app.py @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla application -# Copyright (C) 2013-2020 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) @@ -28,11 +14,18 @@ from ctypes import CDLL, RTLD_GLOBAL # ------------------------------------------------------------------------------------------------------------ -# Imports (PyQt5) +# Imports (PyQt) -from PyQt5.QtCore import QT_VERSION, Qt, QCoreApplication, QLibraryInfo, QLocale, QTranslator -from PyQt5.QtGui import QColor, QIcon, QPalette -from PyQt5.QtWidgets import QApplication +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import QT_VERSION, Qt, QCoreApplication, QLibraryInfo, QLocale, QTranslator + from PyQt5.QtGui import QColor, QIcon, QPalette + from PyQt5.QtWidgets import QApplication +elif qt_config == 6: + from PyQt6.QtCore import QT_VERSION, Qt, QCoreApplication, QLibraryInfo, QLocale, QTranslator + from PyQt6.QtGui import QColor, QIcon, QPalette + from PyQt6.QtWidgets import QApplication # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) @@ -137,7 +130,7 @@ def __init__(self, appName = "Carla2", libPrefix = None): self.createPaletteBlue() def createApp(self, appName): - if LINUX: + if qt_config == 5 and LINUX: # AA_X11InitThreads is not available on old PyQt versions try: attr = Qt.AA_X11InitThreads @@ -145,13 +138,13 @@ def createApp(self, appName): attr = 10 QApplication.setAttribute(attr) + if QT_VERSION >= 0x50600: + QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) + QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) + if MACOS: QApplication.setAttribute(Qt.AA_DontShowIconsInMenus) - if QT_VERSION >= 0x50600: - QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) - QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) - args = sys.argv[:] if WINDOWS: diff --git a/source/frontend/carla_backend_qt.py b/source/frontend/carla_backend_qt.py index 0b985e89ce..55709e7b37 100644 --- a/source/frontend/carla_backend_qt.py +++ b/source/frontend/carla_backend_qt.py @@ -1,25 +1,16 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla Backend code (Qt stuff) -# Copyright (C) 2011-2020 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSignal, QObject +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSignal, QObject +elif qt_config == 6: + from PyQt6.QtCore import pyqtSignal, QObject # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/carla_frontend.py b/source/frontend/carla_frontend.py index 0081c0e385..f741a1a6ae 100644 --- a/source/frontend/carla_frontend.py +++ b/source/frontend/carla_frontend.py @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla Backend utils -# Copyright (C) 2011-2024 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) @@ -28,7 +14,11 @@ POINTER ) -from sip import unwrapinstance +try: + from sip import unwrapinstance +except ImportError: + def unwrapinstance(_): + return None # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/carla_host.py b/source/frontend/carla_host.py index 853c1e08f8..07e637c476 100644 --- a/source/frontend/carla_host.py +++ b/source/frontend/carla_host.py @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla host code -# Copyright (C) 2011-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) @@ -29,23 +15,78 @@ ) # ------------------------------------------------------------------------------------------------------------ -# Imports (PyQt5) +# Imports (PyQt) -# This fails in some configurations, assume >= 5.6.0 in that case -try: - from PyQt5.Qt import PYQT_VERSION -except ImportError: - PYQT_VERSION = 0x50600 +from qt_compat import qt_config -from PyQt5.QtCore import ( - QT_VERSION, qCritical, QBuffer, QEventLoop, QFileInfo, QIODevice, QMimeData, QModelIndex, QPointF, QTimer, QEvent -) -from PyQt5.QtGui import ( - QImage, QImageWriter, QPainter, QPalette, QBrush -) -from PyQt5.QtWidgets import ( - QAction, QApplication, QInputDialog, QFileSystemModel, QListWidgetItem, QGraphicsView, QMainWindow -) +if qt_config == 5: + # This fails in some configurations, assume >= 5.6.0 in that case + try: + from PyQt5.Qt import PYQT_VERSION + except ImportError: + PYQT_VERSION = 0x50600 + + from PyQt5.QtCore import ( + QT_VERSION, + qCritical, + QBuffer, + QEvent, + QEventLoop, + QFileInfo, + QIODevice, + QMimeData, + QModelIndex, + QPointF, + QTimer, + ) + from PyQt5.QtGui import ( + QBrush, + QImage, + QImageWriter, + QPainter, + QPalette, + ) + from PyQt5.QtWidgets import ( + QAction, + QApplication, + QInputDialog, + QFileSystemModel, + QListWidgetItem, + QGraphicsView, + QMainWindow, + ) + +elif qt_config == 6: + from PyQt6.QtCore import ( + PYQT_VERSION, + QT_VERSION, + qCritical, + QBuffer, + QEvent, + QEventLoop, + QFileInfo, + QIODevice, + QMimeData, + QModelIndex, + QPointF, + QTimer, + ) + from PyQt6.QtGui import ( + QAction, + QBrush, + QFileSystemModel, + QImage, + QImageWriter, + QPainter, + QPalette, + ) + from PyQt6.QtWidgets import ( + QApplication, + QInputDialog, + QListWidgetItem, + QGraphicsView, + QMainWindow, + ) # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) @@ -1595,7 +1636,7 @@ def setupCanvas(self): self.ui.graphicsView.setRenderHint(QPainter.SmoothPixmapTransform, fullAA) self.ui.graphicsView.setRenderHint(QPainter.TextAntialiasing, fullAA) - if self.fSavedSettings[CARLA_KEY_CANVAS_USE_OPENGL] and hasGL: + if self.fSavedSettings[CARLA_KEY_CANVAS_USE_OPENGL] and hasGL and QPainter.HighQualityAntialiasing is not None: self.ui.graphicsView.setRenderHint(QPainter.HighQualityAntialiasing, self.fSavedSettings[CARLA_KEY_CANVAS_HQ_ANTIALIASING]) else: diff --git a/source/frontend/carla_host_control.py b/source/frontend/carla_host_control.py index 00c6958273..7defa84351 100755 --- a/source/frontend/carla_host_control.py +++ b/source/frontend/carla_host_control.py @@ -1,25 +1,16 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla Backend code (OSC stuff) -# Copyright (C) 2011-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ---------------------------------------------------------------------------------------------------------------------- # Imports (Global) -from PyQt5.QtCore import QEventLoop +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import QEventLoop +elif qt_config == 6: + from PyQt6.QtCore import QEventLoop # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/carla_settings.py b/source/frontend/carla_settings.py index bd849a38f3..b35c2ddc04 100755 --- a/source/frontend/carla_settings.py +++ b/source/frontend/carla_settings.py @@ -1,26 +1,18 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla settings code -# Copyright (C) 2011-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # --------------------------------------------------------------------------------------------------------------------- -# Imports (PyQt5) +# Imports (PyQt) -from PyQt5.QtCore import pyqtSlot, QT_VERSION, Qt -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFileDialog +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSlot, QT_VERSION, Qt + from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFileDialog +elif qt_config == 6: + from PyQt6.QtCore import pyqtSlot, QT_VERSION, Qt + from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QFileDialog # --------------------------------------------------------------------------------------------------------------------- # Imports (Custom) @@ -601,6 +593,10 @@ def __init__(self, parent, host, hasCanvas, hasCanvasGL): # FIXME broken in some Qt5 versions self.ui.cb_canvas_eyecandy.setEnabled(QT_VERSION >= 0x50c00) + # removed in Qt6 + if QT_VERSION >= 0x60000: + self.ui.cb_canvas_render_hq_aa.hide() + self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) if MACOS: @@ -749,7 +745,7 @@ def loadSettings(self): CARLA_DEFAULT_CANVAS_USE_OPENGL, bool)) self.ui.cb_canvas_render_aa.setCheckState( - settings.value(CARLA_KEY_CANVAS_ANTIALIASING, CARLA_DEFAULT_CANVAS_ANTIALIASING, int)) + Qt.CheckState(settings.value(CARLA_KEY_CANVAS_ANTIALIASING, CARLA_DEFAULT_CANVAS_ANTIALIASING, int))) self.ui.cb_canvas_render_hq_aa.setChecked(self.ui.cb_canvas_render_hq_aa.isEnabled() and settings.value(CARLA_KEY_CANVAS_HQ_ANTIALIASING, diff --git a/source/frontend/carla_shared.py b/source/frontend/carla_shared.py index 9f742b849b..0765686df8 100644 --- a/source/frontend/carla_shared.py +++ b/source/frontend/carla_shared.py @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Common Carla code -# Copyright (C) 2011-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) @@ -36,17 +22,25 @@ haveSIGUSR1 = False # ------------------------------------------------------------------------------------------------------------ -# Imports (PyQt5) +# Imports (PyQt) -# import changed in PyQt 5.15.8, so try both -try: - from PyQt5.Qt import PYQT_VERSION_STR -except ImportError: - from PyQt5.QtCore import PYQT_VERSION_STR +from qt_compat import qt_config -from PyQt5.QtCore import qFatal, QT_VERSION, QT_VERSION_STR, qWarning, QDir, QSettings -from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QFileDialog, QMessageBox +if qt_config == 5: + # import changed in PyQt 5.15.8, so try both + try: + from PyQt5.Qt import PYQT_VERSION_STR + except ImportError: + from PyQt5.QtCore import PYQT_VERSION_STR + + from PyQt5.QtCore import qFatal, QT_VERSION, QT_VERSION_STR, qWarning, QDir, QSettings + from PyQt5.QtGui import QIcon + from PyQt5.QtWidgets import QFileDialog, QMessageBox + +elif qt_config == 6: + from PyQt6.QtCore import qFatal, PYQT_VERSION_STR, QT_VERSION, QT_VERSION_STR, qWarning, QDir, QSettings + from PyQt6.QtGui import QIcon + from PyQt6.QtWidgets import QFileDialog, QMessageBox # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/carla_skin.py b/source/frontend/carla_skin.py index 62e2bd0e59..2eaba1ccd5 100644 --- a/source/frontend/carla_skin.py +++ b/source/frontend/carla_skin.py @@ -1,27 +1,20 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla plugin/slot skin code -# Copyright (C) 2013-2020 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import Qt, QRectF, QLineF, QTimer -from PyQt5.QtGui import QColor, QFont, QFontDatabase, QPainter, QPainterPath, QPen -from PyQt5.QtWidgets import QColorDialog, QFrame, QLineEdit, QPushButton +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import Qt, QRectF, QLineF, QTimer + from PyQt5.QtGui import QColor, QFont, QFontDatabase, QPainter, QPainterPath, QPen + from PyQt5.QtWidgets import QColorDialog, QFrame, QLineEdit, QPushButton +elif qt_config == 6: + from PyQt6.QtCore import Qt, QRectF, QLineF, QTimer + from PyQt6.QtGui import QColor, QFont, QFontDatabase, QPainter, QPainterPath, QPen + from PyQt6.QtWidgets import QColorDialog, QFrame, QLineEdit, QPushButton # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/carla_widgets.py b/source/frontend/carla_widgets.py index 246e64d606..136268467e 100755 --- a/source/frontend/carla_widgets.py +++ b/source/frontend/carla_widgets.py @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla widgets code -# Copyright (C) 2011-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) @@ -22,11 +8,36 @@ from abc import abstractmethod # ------------------------------------------------------------------------------------------------------------ -# Imports (PyQt5) - -from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QByteArray -from PyQt5.QtGui import QCursor, QIcon, QPalette, QPixmap -from PyQt5.QtWidgets import QDialog, QFileDialog, QInputDialog, QMenu, QMessageBox, QScrollArea, QVBoxLayout, QWidget +# Imports (PyQt) + +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QByteArray + from PyQt5.QtGui import QCursor, QIcon, QPalette, QPixmap + from PyQt5.QtWidgets import ( + QDialog, + QFileDialog, + QInputDialog, + QMenu, + QMessageBox, + QScrollArea, + QVBoxLayout, + QWidget, + ) +elif qt_config == 6: + from PyQt6.QtCore import pyqtSignal, pyqtSlot, Qt, QByteArray + from PyQt6.QtGui import QCursor, QIcon, QPalette, QPixmap + from PyQt6.QtWidgets import ( + QDialog, + QFileDialog, + QInputDialog, + QMenu, + QMessageBox, + QScrollArea, + QVBoxLayout, + QWidget, + ) # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/midipattern-ui b/source/frontend/midipattern-ui index 162eb2e928..11a1535fa0 100755 --- a/source/frontend/midipattern-ui +++ b/source/frontend/midipattern-ui @@ -1,28 +1,21 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# A piano roll viewer/editor -# Copyright (C) 2012-2020 Filipe Coelho -# Copyright (C) 2014-2015 Perry Nguyen -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-FileCopyrightText: 2014-2015 Perry Nguyen +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, Qt, QEvent -from PyQt5.QtGui import QKeyEvent -from PyQt5.QtWidgets import QMainWindow +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSlot, Qt, QEvent + from PyQt5.QtGui import QKeyEvent + from PyQt5.QtWidgets import QMainWindow +elif qt_config == 6: + from PyQt6.QtCore import pyqtSlot, Qt, QEvent + from PyQt6.QtGui import QKeyEvent + from PyQt6.QtWidgets import QMainWindow # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/notes-ui b/source/frontend/notes-ui index b92e792f7b..aca166730e 100755 --- a/source/frontend/notes-ui +++ b/source/frontend/notes-ui @@ -1,26 +1,18 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla Native Plugins -# Copyright (C) 2012-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, Qt -from PyQt5.QtWidgets import QGridLayout, QLabel, QPushButton, QTextEdit, QWidget +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSlot, Qt + from PyQt5.QtWidgets import QGridLayout, QLabel, QPushButton, QTextEdit, QWidget +elif qt_config == 6: + from PyQt6.QtCore import pyqtSlot, Qt + from PyQt6.QtWidgets import QGridLayout, QLabel, QPushButton, QTextEdit, QWidget # ----------------------------------------------------------------------- # Imports (Custom) diff --git a/source/frontend/patchcanvas/__init__.py b/source/frontend/patchcanvas/__init__.py index cada20c539..4c651cb326 100644 --- a/source/frontend/patchcanvas/__init__.py +++ b/source/frontend/patchcanvas/__init__.py @@ -1,26 +1,18 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import QPointF, QRectF -from PyQt5.QtWidgets import QGraphicsItem +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import QPointF, QRectF + from PyQt5.QtWidgets import QGraphicsItem +elif qt_config == 6: + from PyQt6.QtCore import QPointF, QRectF + from PyQt6.QtWidgets import QGraphicsItem # ------------------------------------------------------------------------------------------------------------ # Imports (Theme) diff --git a/source/frontend/patchcanvas/canvasbezierline.py b/source/frontend/patchcanvas/canvasbezierline.py index ddb5f892ec..4ab5a927a0 100644 --- a/source/frontend/patchcanvas/canvasbezierline.py +++ b/source/frontend/patchcanvas/canvasbezierline.py @@ -1,27 +1,20 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import Qt, QPointF -from PyQt5.QtGui import QColor, QLinearGradient, QPainter, QPainterPath, QPen -from PyQt5.QtWidgets import QGraphicsPathItem +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import Qt, QPointF + from PyQt5.QtGui import QColor, QLinearGradient, QPainter, QPainterPath, QPen + from PyQt5.QtWidgets import QGraphicsPathItem +elif qt_config == 6: + from PyQt6.QtCore import Qt, QPointF + from PyQt6.QtGui import QColor, QLinearGradient, QPainter, QPainterPath, QPen + from PyQt6.QtWidgets import QGraphicsPathItem # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/patchcanvas/canvasbezierlinemov.py b/source/frontend/patchcanvas/canvasbezierlinemov.py index e365a725ee..8a5bcaf678 100644 --- a/source/frontend/patchcanvas/canvasbezierlinemov.py +++ b/source/frontend/patchcanvas/canvasbezierlinemov.py @@ -1,27 +1,20 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import qWarning, Qt, QPointF -from PyQt5.QtGui import QPainter, QPainterPath, QPen -from PyQt5.QtWidgets import QGraphicsPathItem +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import qWarning, Qt, QPointF + from PyQt5.QtGui import QPainter, QPainterPath, QPen + from PyQt5.QtWidgets import QGraphicsPathItem +elif qt_config == 6: + from PyQt6.QtCore import qWarning, Qt, QPointF + from PyQt6.QtGui import QPainter, QPainterPath, QPen + from PyQt6.QtWidgets import QGraphicsPathItem # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/patchcanvas/canvasbox.py b/source/frontend/patchcanvas/canvasbox.py index 3d8ac6ff6b..11abc7d803 100644 --- a/source/frontend/patchcanvas/canvasbox.py +++ b/source/frontend/patchcanvas/canvasbox.py @@ -1,27 +1,22 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2021 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSignal, pyqtSlot, qCritical, QT_VERSION, Qt, QPointF, QRectF, QTimer -from PyQt5.QtGui import QCursor, QFont, QFontMetrics, QImage, QLinearGradient, QPainter, QPen -from PyQt5.QtWidgets import QGraphicsItem, QGraphicsObject, QMenu +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSignal, pyqtSlot, qCritical, QT_VERSION, Qt, QPointF, QRectF, QTimer + from PyQt5.QtGui import QCursor, QFont, QFontMetrics, QImage, QLinearGradient, QPainter, QPen + from PyQt5.QtSvg import QGraphicsSvgItem + from PyQt5.QtWidgets import QGraphicsItem, QGraphicsObject, QMenu +elif qt_config == 6: + from PyQt6.QtCore import pyqtSignal, pyqtSlot, qCritical, QT_VERSION, Qt, QPointF, QRectF, QTimer + from PyQt6.QtGui import QCursor, QFont, QFontMetrics, QImage, QLinearGradient, QPainter, QPen + from PyQt6.QtSvg import QGraphicsSvgItem + from PyQt6.QtWidgets import QGraphicsItem, QGraphicsObject, QMenu # ------------------------------------------------------------------------------------------------------------ # Backwards-compatible horizontalAdvance/width call, depending on Qt version diff --git a/source/frontend/patchcanvas/canvasboxshadow.py b/source/frontend/patchcanvas/canvasboxshadow.py index 13ea0fd4ea..d46a1e1a4a 100644 --- a/source/frontend/patchcanvas/canvasboxshadow.py +++ b/source/frontend/patchcanvas/canvasboxshadow.py @@ -1,26 +1,18 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtGui import QColor -from PyQt5.QtWidgets import QGraphicsDropShadowEffect +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtGui import QColor + from PyQt5.QtWidgets import QGraphicsDropShadowEffect +elif qt_config == 6: + from PyQt6.QtGui import QColor + from PyQt6.QtWidgets import QGraphicsDropShadowEffect # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/patchcanvas/canvasfadeanimation.py b/source/frontend/patchcanvas/canvasfadeanimation.py index b715a69af0..ed5425dad9 100644 --- a/source/frontend/patchcanvas/canvasfadeanimation.py +++ b/source/frontend/patchcanvas/canvasfadeanimation.py @@ -1,26 +1,18 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import QAbstractAnimation -from PyQt5.QtWidgets import QGraphicsObject +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import QAbstractAnimation + from PyQt5.QtWidgets import QGraphicsObject +elif qt_config == 6: + from PyQt6.QtCore import QAbstractAnimation + from PyQt6.QtWidgets import QGraphicsObject # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/patchcanvas/canvasicon.py b/source/frontend/patchcanvas/canvasicon.py index 2a55aed40d..565a1cae3b 100644 --- a/source/frontend/patchcanvas/canvasicon.py +++ b/source/frontend/patchcanvas/canvasicon.py @@ -1,28 +1,22 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import qCritical, QRectF -from PyQt5.QtGui import QPainter -from PyQt5.QtSvg import QGraphicsSvgItem, QSvgRenderer -from PyQt5.QtWidgets import QGraphicsColorizeEffect +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import qCritical, QRectF + from PyQt5.QtGui import QPainter + from PyQt5.QtSvg import QGraphicsSvgItem, QSvgRenderer + from PyQt5.QtWidgets import QGraphicsColorizeEffect +elif qt_config == 6: + from PyQt6.QtCore import qCritical, QRectF + from PyQt6.QtGui import QPainter + from PyQt6.QtSvg import QGraphicsSvgItem, QSvgRenderer + from PyQt6.QtWidgets import QGraphicsColorizeEffect # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/patchcanvas/canvasline.py b/source/frontend/patchcanvas/canvasline.py index 81410f2150..9a1b3bec6a 100644 --- a/source/frontend/patchcanvas/canvasline.py +++ b/source/frontend/patchcanvas/canvasline.py @@ -1,27 +1,20 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import Qt, QLineF -from PyQt5.QtGui import QLinearGradient, QPainter, QPen -from PyQt5.QtWidgets import QGraphicsLineItem +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import Qt, QLineF + from PyQt5.QtGui import QLinearGradient, QPainter, QPen + from PyQt5.QtWidgets import QGraphicsLineItem +elif qt_config == 6: + from PyQt6.QtCore import Qt, QLineF + from PyQt6.QtGui import QLinearGradient, QPainter, QPen + from PyQt6.QtWidgets import QGraphicsLineItem # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/patchcanvas/canvaslinemov.py b/source/frontend/patchcanvas/canvaslinemov.py index 9c78f87bf3..bd1b39e95f 100644 --- a/source/frontend/patchcanvas/canvaslinemov.py +++ b/source/frontend/patchcanvas/canvaslinemov.py @@ -1,27 +1,20 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import qWarning, Qt, QLineF -from PyQt5.QtGui import QPainter, QPen -from PyQt5.QtWidgets import QGraphicsLineItem +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import qWarning, Qt, QLineF + from PyQt5.QtGui import QPainter, QPen + from PyQt5.QtWidgets import QGraphicsLineItem +elif qt_config == 6: + from PyQt6.QtCore import qWarning, Qt, QLineF + from PyQt6.QtGui import QPainter, QPen + from PyQt6.QtWidgets import QGraphicsLineItem # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/patchcanvas/canvasport.py b/source/frontend/patchcanvas/canvasport.py index fcf72a7ead..045b7d06bd 100644 --- a/source/frontend/patchcanvas/canvasport.py +++ b/source/frontend/patchcanvas/canvasport.py @@ -1,29 +1,22 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) from math import floor -from PyQt5.QtCore import qCritical, Qt, QLineF, QPointF, QRectF, QTimer -from PyQt5.QtGui import QCursor, QFont, QFontMetrics, QPainter, QPainterPath, QPen, QPolygonF -from PyQt5.QtWidgets import QGraphicsItem, QMenu +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import qCritical, Qt, QLineF, QPointF, QRectF, QTimer + from PyQt5.QtGui import QCursor, QFont, QFontMetrics, QPainter, QPainterPath, QPen, QPolygonF + from PyQt5.QtWidgets import QGraphicsItem, QMenu +elif qt_config == 6: + from PyQt6.QtCore import qCritical, Qt, QLineF, QPointF, QRectF, QTimer + from PyQt6.QtGui import QCursor, QFont, QFontMetrics, QPainter, QPainterPath, QPen, QPolygonF + from PyQt6.QtWidgets import QGraphicsItem, QMenu # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) @@ -120,7 +113,16 @@ def setPortType(self, port_type): self.update() def setPortName(self, port_name): - if QFontMetrics(self.m_port_font).width(port_name) < QFontMetrics(self.m_port_font).width(self.m_port_name): + metrics = QFontMetrics(self.m_port_font) + + if QT_VERSION >= 0x50b00: + width1 = metrics.horizontalAdvance(port_name) + width2 = metrics.horizontalAdvance(self.m_port_name) + else: + width1 = metrics.width(port_name) + width2 = metrics.width(self.m_port_name) + + if width1 < width2: QTimer.singleShot(0, canvas.scene.update) self.m_port_name = port_name diff --git a/source/frontend/patchcanvas/canvasportglow.py b/source/frontend/patchcanvas/canvasportglow.py index 6e75b67469..44db2bba4d 100644 --- a/source/frontend/patchcanvas/canvasportglow.py +++ b/source/frontend/patchcanvas/canvasportglow.py @@ -1,25 +1,16 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtWidgets import QGraphicsDropShadowEffect +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtWidgets import QGraphicsDropShadowEffect +elif qt_config == 6: + from PyQt6.QtWidgets import QGraphicsDropShadowEffect # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/patchcanvas/patchcanvas.py b/source/frontend/patchcanvas/patchcanvas.py index 4fa16220a4..695b1d5e85 100644 --- a/source/frontend/patchcanvas/patchcanvas.py +++ b/source/frontend/patchcanvas/patchcanvas.py @@ -1,27 +1,20 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, qCritical, qFatal, qWarning, QObject -from PyQt5.QtCore import QPointF, QRectF, QTimer -from PyQt5.QtWidgets import QGraphicsObject +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSlot, qCritical, qFatal, qWarning, QObject + from PyQt5.QtCore import QPointF, QRectF, QTimer + from PyQt5.QtWidgets import QGraphicsObject +elif qt_config == 6: + from PyQt6.QtCore import pyqtSlot, qCritical, qFatal, qWarning, QObject + from PyQt6.QtCore import QPointF, QRectF, QTimer + from PyQt6.QtWidgets import QGraphicsObject # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/patchcanvas/scene.py b/source/frontend/patchcanvas/scene.py index 4716e1f0ca..7ed1a9330b 100644 --- a/source/frontend/patchcanvas/scene.py +++ b/source/frontend/patchcanvas/scene.py @@ -1,29 +1,22 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) from math import floor -from PyQt5.QtCore import QT_VERSION, pyqtSignal, pyqtSlot, qFatal, Qt, QPointF, QRectF -from PyQt5.QtGui import QCursor, QPixmap, QPolygonF -from PyQt5.QtWidgets import QGraphicsRectItem, QGraphicsScene +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import QT_VERSION, pyqtSignal, pyqtSlot, qFatal, Qt, QPointF, QRectF + from PyQt5.QtGui import QCursor, QPixmap, QPolygonF + from PyQt5.QtWidgets import QGraphicsRectItem, QGraphicsScene +elif qt_config == 6: + from PyQt6.QtCore import QT_VERSION, pyqtSignal, pyqtSlot, qFatal, Qt, QPointF, QRectF + from PyQt6.QtGui import QCursor, QPixmap, QPolygonF + from PyQt6.QtWidgets import QGraphicsRectItem, QGraphicsScene # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) @@ -314,7 +307,7 @@ def mousePressEvent(self, event): ) self.m_mouse_rubberband = False - if event.button() == Qt.MidButton and ctrlDown: + if event.button() == Qt.MiddleButton and ctrlDown: self.startConnectionCut() items = self.items(event.scenePos()) for item in items: diff --git a/source/frontend/patchcanvas/theme.py b/source/frontend/patchcanvas/theme.py index 3fa696a311..fe9b2c4cb2 100644 --- a/source/frontend/patchcanvas/theme.py +++ b/source/frontend/patchcanvas/theme.py @@ -1,26 +1,18 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas Themes -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QColor, QFont, QPen, QPixmap +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import Qt + from PyQt5.QtGui import QColor, QFont, QPen, QPixmap +elif qt_config == 6: + from PyQt6.QtCore import Qt + from PyQt6.QtGui import QColor, QFont, QPen, QPixmap # ------------------------------------------------------------------------------------------------------------ diff --git a/source/frontend/patchcanvas/utils.py b/source/frontend/patchcanvas/utils.py index 336b9b0ec0..a246765db5 100644 --- a/source/frontend/patchcanvas/utils.py +++ b/source/frontend/patchcanvas/utils.py @@ -1,25 +1,16 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import qCritical, QPointF, QTimer +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import qCritical, QPointF, QTimer +elif qt_config == 6: + from PyQt6.QtCore import qCritical, QPointF, QTimer # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/qt_compat.py b/source/frontend/qt_compat.py new file mode 100644 index 0000000000..970e8025f1 --- /dev/null +++ b/source/frontend/qt_compat.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later + +from qt_config import qt as qt_config + +if qt_config == 5: + from PyQt5.QtCore import Qt + + Qt.CheckState = int + Qt.MiddleButton = Qt.MidButton + +elif qt_config == 6: + from PyQt6.QtCore import Qt + from PyQt6.QtWidgets import QMessageBox + + # TODO fill up everything else + + QMessageBox.No = QMessageBox.StandardButton.No + QMessageBox.Yes = QMessageBox.StandardButton.Yes diff --git a/source/frontend/utils/qsafesettings.py b/source/frontend/utils/qsafesettings.py index 5893f9ad37..7fa56038fc 100644 --- a/source/frontend/utils/qsafesettings.py +++ b/source/frontend/utils/qsafesettings.py @@ -1,25 +1,16 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla plugin host -# Copyright (C) 2011-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # --------------------------------------------------------------------------------------------------------------------- # Imports (Global) -from PyQt5.QtCore import QSettings +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import QSettings +elif qt_config == 6: + from PyQt6.QtCore import QSettings # --------------------------------------------------------------------------------------------------------------------- # Safer QSettings class, which does not throw if type mismatches diff --git a/source/frontend/widgets/canvaspreviewframe.py b/source/frontend/widgets/canvaspreviewframe.py index 36c33aceae..064009a23d 100644 --- a/source/frontend/widgets/canvaspreviewframe.py +++ b/source/frontend/widgets/canvaspreviewframe.py @@ -1,29 +1,22 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Custom Mini Canvas Preview, a custom Qt widget -# Copyright (C) 2011-2020 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # --------------------------------------------------------------------------------------------------------------------- # Imports (Global) from math import floor, ceil -from PyQt5.QtCore import pyqtSignal, Qt, QRectF, QTimer, QEvent, QPoint -from PyQt5.QtGui import QBrush, QColor, QCursor, QPainter, QPainterPath, QPen, QPixmap -from PyQt5.QtWidgets import QFrame, QGraphicsScene +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSignal, QT_VERSION, Qt, QRectF, QTimer, QEvent, QPoint + from PyQt5.QtGui import QBrush, QColor, QCursor, QPainter, QPainterPath, QPen, QPixmap + from PyQt5.QtWidgets import QFrame, QGraphicsScene +elif qt_config == 6: + from PyQt6.QtCore import pyqtSignal, QT_VERSION, Qt, QRectF, QTimer, QEvent, QPoint + from PyQt6.QtGui import QBrush, QColor, QCursor, QPainter, QPainterPath, QPen, QPixmap + from PyQt6.QtWidgets import QFrame, QGraphicsScene # --------------------------------------------------------------------------------------------------------------------- # Antialiasing settings @@ -184,7 +177,7 @@ def mousePressEvent(self, event): self.fMouseRightDown = True self._updateMouseMode(event) return - if event.button() == Qt.MidButton: + if event.button() == Qt.MiddleButton: event.accept() self.fMouseLeftDown = True self.fMouseRightDown = True @@ -195,7 +188,14 @@ def mousePressEvent(self, event): def mouseMoveEvent(self, event): if self.fMouseMode == self._MOUSE_MODE_MOVE: event.accept() - self._moveViewRect(event.x(), event.y()) + if QT_VERSION >= 0x60000: + pos = event.position() + x = pos.x() + y = pos.y() + else: + x = event.x() + y = event.y() + self._moveViewRect(x, y) return if self.fMouseMode == self._MOUSE_MODE_SCALE: event.accept() @@ -207,14 +207,14 @@ def mouseReleaseEvent(self, event): if event.button() == Qt.LeftButton: event.accept() self.fMouseLeftDown = False - self._updateMouseMode() + self._updateMouseMode(event) return if event.button() == Qt.RightButton: event.accept() self.fMouseRightDown = False self._updateMouseMode(event) return - if event.button() == Qt.MidButton: + if event.button() == Qt.MiddleButton: event.accept() self.fMouseLeftDown = event.buttons() & Qt.LeftButton self.fMouseRightDown = event.buttons() & Qt.RightButton @@ -386,7 +386,7 @@ def _scaleViewRect(self, globalY: int): self.cursor().setPos(self.fMouseInitialZoomPos) - def _updateMouseMode(self, event = None): + def _updateMouseMode(self, event): if self.fMouseLeftDown and self.fMouseRightDown: self.fMouseInitialZoomPos = event.globalPos() self.setCursor(self.fZoomCursors[self._kCursorZoom]) @@ -395,7 +395,14 @@ def _updateMouseMode(self, event = None): elif self.fMouseLeftDown: self.setCursor(QCursor(Qt.SizeAllCursor)) if self.fMouseMode == self._MOUSE_MODE_NONE: - self._moveViewRect(event.x(), event.y()) + if QT_VERSION >= 0x60000: + pos = event.position() + x = pos.x() + y = pos.y() + else: + x = event.x() + y = event.y() + self._moveViewRect(x, y) self.fMouseMode = self._MOUSE_MODE_MOVE else: diff --git a/source/frontend/widgets/collapsablewidget.py b/source/frontend/widgets/collapsablewidget.py index e3e0a01a61..75e86b25ae 100644 --- a/source/frontend/widgets/collapsablewidget.py +++ b/source/frontend/widgets/collapsablewidget.py @@ -1,26 +1,18 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Collapsible Box, a custom Qt widget -# Copyright (C) 2019-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, Qt -from PyQt5.QtWidgets import QFrame, QSizePolicy, QToolButton, QVBoxLayout, QWidget +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSlot, Qt + from PyQt5.QtWidgets import QFrame, QSizePolicy, QToolButton, QVBoxLayout, QWidget +elif qt_config == 6: + from PyQt6.QtCore import pyqtSlot, Qt + from PyQt6.QtWidgets import QFrame, QSizePolicy, QToolButton, QVBoxLayout, QWidget # ------------------------------------------------------------------------------------------------------------ # Widget Class diff --git a/source/frontend/widgets/commondial.py b/source/frontend/widgets/commondial.py index 68d4ac18ac..a615cdeae8 100644 --- a/source/frontend/widgets/commondial.py +++ b/source/frontend/widgets/commondial.py @@ -1,29 +1,22 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Common Dial, a custom Qt widget -# Copyright (C) 2011-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # --------------------------------------------------------------------------------------------------------------------- # Imports (Global) from math import isnan -from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QPointF, QRectF -from PyQt5.QtGui import QColor, QFont, QLinearGradient, QPainter -from PyQt5.QtWidgets import QDial +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QPointF, QRectF + from PyQt5.QtGui import QColor, QFont, QLinearGradient, QPainter + from PyQt5.QtWidgets import QDial +elif qt_config == 6: + from PyQt6.QtCore import pyqtSignal, pyqtSlot, Qt, QPointF, QRectF + from PyQt6.QtGui import QColor, QFont, QLinearGradient, QPainter + from PyQt6.QtWidgets import QDial # --------------------------------------------------------------------------------------------------------------------- # Widget Class diff --git a/source/frontend/widgets/digitalpeakmeter.py b/source/frontend/widgets/digitalpeakmeter.py index 533429cc66..3707b296c9 100644 --- a/source/frontend/widgets/digitalpeakmeter.py +++ b/source/frontend/widgets/digitalpeakmeter.py @@ -1,29 +1,22 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Digital Peak Meter, a custom Qt widget -# Copyright (C) 2011-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # --------------------------------------------------------------------------------------------------------------------- # Imports (Global) from math import sqrt -from PyQt5.QtCore import qCritical, Qt, QSize, QLineF, QRectF -from PyQt5.QtGui import QColor, QLinearGradient, QPainter, QPen, QPixmap -from PyQt5.QtWidgets import QWidget +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import qCritical, Qt, QSize, QLineF, QRectF + from PyQt5.QtGui import QColor, QLinearGradient, QPainter, QPen, QPixmap + from PyQt5.QtWidgets import QWidget +elif qt_config == 6: + from PyQt6.QtCore import qCritical, Qt, QSize, QLineF, QRectF + from PyQt6.QtGui import QColor, QLinearGradient, QPainter, QPen, QPixmap + from PyQt6.QtWidgets import QWidget # --------------------------------------------------------------------------------------------------------------------- # Widget Class diff --git a/source/frontend/widgets/draggablegraphicsview.py b/source/frontend/widgets/draggablegraphicsview.py index b4ba14df55..36293f4040 100644 --- a/source/frontend/widgets/draggablegraphicsview.py +++ b/source/frontend/widgets/draggablegraphicsview.py @@ -1,28 +1,22 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Middle-click draggable QGraphicsView -# Copyright (C) 2016-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # --------------------------------------------------------------------------------------------------------------------- # Imports (Global) import os -from PyQt5.QtCore import Qt, QEvent -from PyQt5.QtGui import QCursor, QMouseEvent -from PyQt5.QtWidgets import QGraphicsView, QMessageBox + +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import Qt, QT_VERSION, QEvent + from PyQt5.QtGui import QCursor, QMouseEvent + from PyQt5.QtWidgets import QGraphicsView, QMessageBox +elif qt_config == 6: + from PyQt6.QtCore import Qt, QT_VERSION, QEvent + from PyQt6.QtGui import QCursor, QMouseEvent + from PyQt6.QtWidgets import QGraphicsView, QMessageBox # --------------------------------------------------------------------------------------------------------------------- # Imports (Custom Stuff) @@ -38,11 +32,6 @@ def __init__(self, parent): self.fPanning = False - try: - self.fMiddleButton = Qt.MiddleButton - except: - self.fMiddleButton = Qt.MidButton - exts = gCarla.utils.get_supported_file_extensions() self.fSupportedExtensions = tuple(("." + i) for i in exts) @@ -115,9 +104,9 @@ def dropEvent(self, event): # ----------------------------------------------------------------------------------------------------------------- def mousePressEvent(self, event): - if event.button() == self.fMiddleButton and not (event.modifiers() & Qt.ControlModifier): + if event.button() == Qt.MiddleButton and not (event.modifiers() & Qt.ControlModifier): buttons = event.buttons() - buttons &= ~self.fMiddleButton + buttons &= ~Qt.MiddleButton buttons |= Qt.LeftButton timestamp = event.timestamp() self.fPanning = True @@ -130,24 +119,31 @@ def mousePressEvent(self, event): if timestamp is None: return - event = QMouseEvent(QEvent.MouseButtonPress, - event.localPos(), event.windowPos(), event.screenPos(), - Qt.LeftButton, Qt.LeftButton, - Qt.NoModifier, - Qt.MouseEventSynthesizedByApplication) - event.setTimestamp(timestamp) + if QT_VERSION >= 0x60000: + event = QMouseEvent(QEvent.MouseButtonPress, + event.position(), event.scenePosition(), event.globalPosition(), + Qt.LeftButton, Qt.LeftButton, + Qt.NoModifier) + else: + event = QMouseEvent(QEvent.MouseButtonPress, + event.localPos(), event.windowPos(), event.screenPos(), + Qt.LeftButton, Qt.LeftButton, + Qt.NoModifier, + Qt.MouseEventSynthesizedByApplication) + event.setTimestamp(timestamp) + QGraphicsView.mousePressEvent(self, event) def mouseReleaseEvent(self, event): QGraphicsView.mouseReleaseEvent(self, event) - if event.button() == self.fMiddleButton and self.fPanning: + if event.button() == Qt.MiddleButton and self.fPanning: self.fPanning = False self.setDragMode(QGraphicsView.NoDrag) self.setCursor(QCursor(Qt.ArrowCursor)) def wheelEvent(self, event): - if event.buttons() & self.fMiddleButton: + if event.buttons() & Qt.MiddleButton: event.ignore() return QGraphicsView.wheelEvent(self, event) diff --git a/source/frontend/widgets/ledbutton.py b/source/frontend/widgets/ledbutton.py index 766074e2fd..6f1aa90dd5 100644 --- a/source/frontend/widgets/ledbutton.py +++ b/source/frontend/widgets/ledbutton.py @@ -1,28 +1,22 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# LED Button, a custom Qt widget -# Copyright (C) 2011-2020 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # --------------------------------------------------------------------------------------------------------------------- # Imports (Global) -from PyQt5.QtCore import QRectF -from PyQt5.QtGui import QPainter, QPixmap -from PyQt5.QtSvg import QSvgWidget -from PyQt5.QtWidgets import QPushButton +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import QRectF + from PyQt5.QtGui import QPainter, QPixmap + from PyQt5.QtSvg import QSvgWidget + from PyQt5.QtWidgets import QPushButton +elif qt_config == 6: + from PyQt6.QtCore import QRectF + from PyQt6.QtGui import QPainter, QPixmap + from PyQt6.QtSvg import QSvgWidget + from PyQt6.QtWidgets import QPushButton # --------------------------------------------------------------------------------------------------------------------- # Widget Class diff --git a/source/frontend/widgets/paramspinbox.py b/source/frontend/widgets/paramspinbox.py index 3cfaa193d5..8d6c2dfe01 100644 --- a/source/frontend/widgets/paramspinbox.py +++ b/source/frontend/widgets/paramspinbox.py @@ -1,20 +1,6 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# Parameter SpinBox, a custom Qt widget -# Copyright (C) 2011-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) @@ -22,9 +8,16 @@ from math import isnan, modf from random import random -from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QTimer -from PyQt5.QtGui import QCursor, QPalette -from PyQt5.QtWidgets import QAbstractSpinBox, QApplication, QComboBox, QDialog, QMenu, QProgressBar +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSignal, pyqtSlot, QT_VERSION, Qt, QTimer + from PyQt5.QtGui import QCursor, QPalette + from PyQt5.QtWidgets import QAbstractSpinBox, QApplication, QComboBox, QDialog, QMenu, QProgressBar +elif qt_config == 6: + from PyQt6.QtCore import pyqtSignal, pyqtSlot, QT_VERSION, Qt, QTimer + from PyQt6.QtGui import QCursor, QPalette + from PyQt6.QtWidgets import QAbstractSpinBox, QApplication, QComboBox, QDialog, QMenu, QProgressBar # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) @@ -452,7 +445,10 @@ def setScalePoints(self, scalePoints, useScalePoints): if self.fValue is not None: self._setScalePointValue(self.fValue) - self.fBox.currentIndexChanged['QString'].connect(self.slot_comboBoxIndexChanged) + if QT_VERSION >= 0x60000: + self.fBox.currentTextChanged.connect(self.slot_comboBoxIndexChanged) + else: + self.fBox.currentIndexChanged['QString'].connect(self.slot_comboBoxIndexChanged) def setToolTip(self, text): self.fBar.setToolTip(text) diff --git a/source/frontend/widgets/pianoroll.py b/source/frontend/widgets/pianoroll.py index 3c09426e2c..d009468a13 100755 --- a/source/frontend/widgets/pianoroll.py +++ b/source/frontend/widgets/pianoroll.py @@ -1,30 +1,41 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# A piano roll viewer/editor -# Copyright (C) 2012-2022 Filipe Coelho -# Copyright (C) 2014-2015 Perry Nguyen -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-FileCopyrightText: 2014-2015 Perry Nguyen +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import Qt, QRectF, QPointF, pyqtSignal -from PyQt5.QtGui import QColor, QCursor, QFont, QPen, QPainter -from PyQt5.QtWidgets import QGraphicsItem, QGraphicsLineItem, QGraphicsRectItem, QGraphicsSimpleTextItem -from PyQt5.QtWidgets import QGraphicsScene, QGraphicsView -from PyQt5.QtWidgets import QApplication, QStyle, QWidget +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import Qt, QRectF, QPointF, pyqtSignal + from PyQt5.QtGui import QColor, QCursor, QFont, QPen, QPainter + from PyQt5.QtWidgets import ( + QApplication, + QGraphicsItem, + QGraphicsLineItem, + QGraphicsRectItem, + QGraphicsSimpleTextItem, + QGraphicsScene, + QGraphicsView, + QStyle, + QWidget, + ) +elif qt_config == 6: + from PyQt6.QtCore import Qt, QRectF, QPointF, pyqtSignal + from PyQt6.QtGui import QColor, QCursor, QFont, QPen, QPainter + from PyQt6.QtWidgets import ( + QApplication, + QGraphicsItem, + QGraphicsLineItem, + QGraphicsRectItem, + QGraphicsSimpleTextItem, + QGraphicsScene, + QGraphicsView, + QStyle, + QWidget, + ) # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) diff --git a/source/frontend/widgets/pixmapdial.py b/source/frontend/widgets/pixmapdial.py index 9ee80b159f..42e1b3c861 100644 --- a/source/frontend/widgets/pixmapdial.py +++ b/source/frontend/widgets/pixmapdial.py @@ -1,31 +1,25 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Pixmap Dial, a custom Qt widget -# Copyright (C) 2011-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # --------------------------------------------------------------------------------------------------------------------- # Imports (Global) from math import cos, floor, pi, sin -from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QPointF, QRectF, QTimer, QSize -from PyQt5.QtGui import QColor, QConicalGradient, QFontMetrics, QPainterPath, QPen, QPixmap -from PyQt5.QtWidgets import QDial +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QPointF, QRectF, QTimer, QSize + from PyQt5.QtGui import QColor, QConicalGradient, QFontMetrics, QPainterPath, QPen, QPixmap + from PyQt5.QtWidgets import QDial +elif qt_config == 6: + from PyQt6.QtCore import pyqtSlot, Qt, QEvent, QPointF, QRectF, QTimer, QSize + from PyQt6.QtGui import QColor, QConicalGradient, QFontMetrics, QPainterPath, QPen, QPixmap + from PyQt6.QtWidgets import QDial from .commondial import CommonDial +from carla_shared import fontMetricsHorizontalAdvance # --------------------------------------------------------------------------------------------------------------------- # Widget Class @@ -72,8 +66,9 @@ def updateSizes(self): self.fLabelWidth = 0 return - self.fLabelWidth = QFontMetrics(self.fLabelFont).width(self.fLabel) - self.fLabelHeight = QFontMetrics(self.fLabelFont).height() + metrics = QFontMetrics(self.fLabelFont) + self.fLabelWidth = fontMetricsHorizontalAdvance(metrics, self.fLabel) + self.fLabelHeight = metrics.height() self.fLabelPos.setX(float(self.fPixmapBaseSize)/2.0 - float(self.fLabelWidth)/2.0) diff --git a/source/frontend/widgets/pixmapkeyboard.py b/source/frontend/widgets/pixmapkeyboard.py index 3317d880b3..a81e687f84 100755 --- a/source/frontend/widgets/pixmapkeyboard.py +++ b/source/frontend/widgets/pixmapkeyboard.py @@ -1,27 +1,20 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Pixmap Keyboard, a custom Qt widget -# Copyright (C) 2011-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # --------------------------------------------------------------------------------------------------------------------- # Imports (Global) -from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QPointF, QRectF, QTimer, QSize -from PyQt5.QtGui import QColor, QPainter, QPixmap -from PyQt5.QtWidgets import QActionGroup, QMenu, QScrollArea, QWidget +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QPointF, QRectF, QTimer, QSize + from PyQt5.QtGui import QColor, QPainter, QPixmap + from PyQt5.QtWidgets import QActionGroup, QMenu, QScrollArea, QWidget +elif qt_config == 6: + from PyQt6.QtCore import pyqtSignal, pyqtSlot, Qt, QPointF, QRectF, QTimer, QSize + from PyQt6.QtGui import QActionGroup, QColor, QPainter, QPixmap + from PyQt6.QtWidgets import QMenu, QScrollArea, QWidget # --------------------------------------------------------------------------------------------------------------------- # Imports (Carla) diff --git a/source/frontend/widgets/racklistwidget.py b/source/frontend/widgets/racklistwidget.py index 5e33d9d56e..f9513d17b1 100644 --- a/source/frontend/widgets/racklistwidget.py +++ b/source/frontend/widgets/racklistwidget.py @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Rack List Widget, a custom Qt widget -# Copyright (C) 2011-2019 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) @@ -22,11 +8,18 @@ import os # ------------------------------------------------------------------------------------------------------------ -# Imports (PyQt5) - -from PyQt5.QtCore import Qt, QSize, QRect, QEvent -from PyQt5.QtGui import QColor, QPainter, QPixmap -from PyQt5.QtWidgets import QAbstractItemView, QListWidget, QListWidgetItem, QMessageBox +# Imports (PyQt) + +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import Qt, QSize, QRect, QEvent + from PyQt5.QtGui import QColor, QPainter, QPixmap + from PyQt5.QtWidgets import QAbstractItemView, QListWidget, QListWidgetItem, QMessageBox +elif qt_config == 6: + from PyQt6.QtCore import Qt, QSize, QRect, QEvent + from PyQt6.QtGui import QColor, QPainter, QPixmap + from PyQt6.QtWidgets import QAbstractItemView, QListWidget, QListWidgetItem, QMessageBox # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/source/frontend/widgets/scalablebutton.py b/source/frontend/widgets/scalablebutton.py index d835ff880c..6cbe5ddd69 100644 --- a/source/frontend/widgets/scalablebutton.py +++ b/source/frontend/widgets/scalablebutton.py @@ -1,28 +1,22 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Scalable Button, a custom Qt widget -# Copyright (C) 2013-2020 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # --------------------------------------------------------------------------------------------------------------------- # Imports (Global) -from PyQt5.QtCore import QPointF, QRectF -from PyQt5.QtGui import QColor, QFont, QPainter, QPixmap -from PyQt5.QtSvg import QSvgWidget -from PyQt5.QtWidgets import QPushButton +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import QPointF, QRectF + from PyQt5.QtGui import QColor, QFont, QPainter, QPixmap + from PyQt5.QtSvg import QSvgWidget + from PyQt5.QtWidgets import QPushButton +elif qt_config == 6: + from PyQt6.QtCore import QPointF, QRectF + from PyQt6.QtGui import QColor, QFont, QPainter, QPixmap + from PyQt6.QtSvg import QSvgWidget + from PyQt6.QtWidgets import QPushButton # --------------------------------------------------------------------------------------------------------------------- # Widget Class diff --git a/source/frontend/widgets/scalabledial.py b/source/frontend/widgets/scalabledial.py index 1aebcd4e42..a1c760d8ae 100644 --- a/source/frontend/widgets/scalabledial.py +++ b/source/frontend/widgets/scalabledial.py @@ -1,31 +1,25 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Scalable Dial, a custom Qt widget -# Copyright (C) 2011-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # --------------------------------------------------------------------------------------------------------------------- # Imports (Global) from math import cos, floor, pi, sin -from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QPointF, QRectF, QTimer, QSize -from PyQt5.QtGui import QColor, QConicalGradient, QFontMetrics, QPainterPath, QPen, QPixmap -from PyQt5.QtSvg import QSvgWidget +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QPointF, QRectF, QTimer, QSize + from PyQt5.QtGui import QColor, QConicalGradient, QFontMetrics, QPainterPath, QPen, QPixmap + from PyQt5.QtSvg import QSvgWidget +elif qt_config == 6: + from PyQt6.QtCore import pyqtSlot, Qt, QEvent, QPointF, QRectF, QTimer, QSize + from PyQt6.QtGui import QColor, QConicalGradient, QFontMetrics, QPainterPath, QPen, QPixmap + from PyQt6.QtSvg import QSvgWidget from .commondial import CommonDial +from carla_shared import fontMetricsHorizontalAdvance # --------------------------------------------------------------------------------------------------------------------- # Widget Class @@ -34,7 +28,7 @@ class ScalableDial(CommonDial): def __init__(self, parent, index=0): CommonDial.__init__(self, parent, index) - self.fImage = QSvgWidget(":/scalable/dial_03.svg") + self.fImage = QSvgWidget(":/scalable/dial_03.svg") self.fImageNum = "01" if self.fImage.sizeHint().width() > self.fImage.sizeHint().height(): @@ -76,8 +70,9 @@ def updateSizes(self): self.fLabelWidth = 0 return - self.fLabelWidth = QFontMetrics(self.fLabelFont).width(self.fLabel) - self.fLabelHeight = QFontMetrics(self.fLabelFont).height() + metrics = QFontMetrics(self.fLabelFont) + self.fLabelWidth = fontMetricsHorizontalAdvance(metrics, self.fLabel) + self.fLabelHeight = metrics.height() self.fLabelPos.setX(float(self.fImageBaseSize)/2.0 - float(self.fLabelWidth)/2.0) diff --git a/source/frontend/xycontroller-ui b/source/frontend/xycontroller-ui index 3d8fbacbc3..06848b4576 100755 --- a/source/frontend/xycontroller-ui +++ b/source/frontend/xycontroller-ui @@ -1,27 +1,20 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# XY Controller UI, taken from Cadence -# Copyright (C) 2011-2020 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QPointF, QRectF, QSize, QTimer -from PyQt5.QtGui import QColor, QPainter, QPen -from PyQt5.QtWidgets import QGraphicsScene, QGraphicsSceneMouseEvent, QMainWindow +from qt_compat import qt_config + +if qt_config == 5: + from PyQt5.QtCore import pyqtSignal, pyqtSlot, QT_VERSION, Qt, QPointF, QRectF, QSize, QTimer + from PyQt5.QtGui import QColor, QPainter, QPen + from PyQt5.QtWidgets import QGraphicsScene, QGraphicsSceneMouseEvent, QMainWindow +elif qt_config == 6: + from PyQt6.QtCore import pyqtSignal, pyqtSlot, QT_VERSION, Qt, QPointF, QRectF, QSize, QTimer + from PyQt6.QtGui import QColor, QPainter, QPen + from PyQt6.QtWidgets import QGraphicsScene, QGraphicsSceneMouseEvent, QMainWindow # ----------------------------------------------------------------------- # Imports (Custom) @@ -278,8 +271,12 @@ class XYControllerUI(ExternalUI, QMainWindow): self.ui.dial_x.realValueChanged.connect(self.slot_knobValueChangedX) self.ui.dial_y.realValueChanged.connect(self.slot_knobValueChangedY) - self.ui.cb_control_x.currentIndexChanged[str].connect(self.slot_checkCC_X) - self.ui.cb_control_y.currentIndexChanged[str].connect(self.slot_checkCC_Y) + if QT_VERSION >= 0x60000: + self.ui.cb_control_x.currentTextChanged.connect(self.slot_checkCC_X) + self.ui.cb_control_y.currentTextChanged.connect(self.slot_checkCC_Y) + else: + self.ui.cb_control_x.currentIndexChanged[str].connect(self.slot_checkCC_X) + self.ui.cb_control_y.currentIndexChanged[str].connect(self.slot_checkCC_Y) self.ui.act_ch_01.triggered.connect(self.slot_checkChannel) self.ui.act_ch_02.triggered.connect(self.slot_checkChannel)