From 4749e5f5a0830f9db194227826a555dd83ac6086 Mon Sep 17 00:00:00 2001 From: Blaise deB Frederick Date: Wed, 18 Sep 2024 23:31:18 -0400 Subject: [PATCH] Changes for PyQt6 compatibility --- picachooser/graderTemplate_qt6.py | 66 +++++++ picachooser/melodicompTemplate_qt6.py | 89 ++++++++++ picachooser/picachooserTemplate_qt6.py | 168 ++++++++++++++++++ picachooser/picachooser_imonlyTemplate_qt6.py | 111 ++++++++++++ picachooser/rtgraderTemplate_qt6.py | 89 ++++++++++ picachooser/scripts/PICAchooser | 53 +++--- picachooser/scripts/grader | 40 +++-- picachooser/scripts/melodicomp | 36 ++-- picachooser/scripts/rtgrader | 40 +++-- 9 files changed, 632 insertions(+), 60 deletions(-) create mode 100644 picachooser/graderTemplate_qt6.py create mode 100644 picachooser/melodicompTemplate_qt6.py create mode 100644 picachooser/picachooserTemplate_qt6.py create mode 100644 picachooser/picachooser_imonlyTemplate_qt6.py create mode 100644 picachooser/rtgraderTemplate_qt6.py diff --git a/picachooser/graderTemplate_qt6.py b/picachooser/graderTemplate_qt6.py new file mode 100644 index 0000000..a3e8d58 --- /dev/null +++ b/picachooser/graderTemplate_qt6.py @@ -0,0 +1,66 @@ +# Form implementation generated from reading ui file 'graderTemplate.ui' +# +# Created by: PyQt6 UI code generator 6.6.0 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(1112, 525) + self.centralwidget = QtWidgets.QWidget(parent=MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout_2 = QtWidgets.QGridLayout(self.centralwidget) + self.gridLayout_2.setObjectName("gridLayout_2") + self.gridLayout = QtWidgets.QGridLayout() + self.gridLayout.setObjectName("gridLayout") + self.timecourse_graphicsView = GraphicsLayoutWidget(parent=self.centralwidget) + self.timecourse_graphicsView.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.timecourse_graphicsView.sizePolicy().hasHeightForWidth()) + self.timecourse_graphicsView.setSizePolicy(sizePolicy) + self.timecourse_graphicsView.setMinimumSize(QtCore.QSize(610, 100)) + self.timecourse_graphicsView.setMaximumSize(QtCore.QSize(3000, 1000)) + self.timecourse_graphicsView.setSizeIncrement(QtCore.QSize(1, 1)) + self.timecourse_graphicsView.setObjectName("timecourse_graphicsView") + self.gridLayout.addWidget(self.timecourse_graphicsView, 0, 0, 1, 1) + self.spectrum_graphicsView = GraphicsLayoutWidget(parent=self.centralwidget) + self.spectrum_graphicsView.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.spectrum_graphicsView.sizePolicy().hasHeightForWidth()) + self.spectrum_graphicsView.setSizePolicy(sizePolicy) + self.spectrum_graphicsView.setMinimumSize(QtCore.QSize(610, 100)) + self.spectrum_graphicsView.setMaximumSize(QtCore.QSize(3000, 1000)) + self.spectrum_graphicsView.setSizeIncrement(QtCore.QSize(1, 1)) + self.spectrum_graphicsView.setObjectName("spectrum_graphicsView") + self.gridLayout.addWidget(self.spectrum_graphicsView, 1, 0, 1, 1) + self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) + self.label = QtWidgets.QLabel(parent=self.centralwidget) + self.label.setObjectName("label") + self.gridLayout_2.addWidget(self.label, 1, 0, 1, 1) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtWidgets.QMenuBar(parent=MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1112, 24)) + self.menubar.setObjectName("menubar") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtWidgets.QStatusBar(parent=MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) + self.label.setText(_translate("MainWindow", "Right and left arrows step through components. Up and down arrows toggle component retention. ESC to write component file.")) +from pyqtgraph import GraphicsLayoutWidget diff --git a/picachooser/melodicompTemplate_qt6.py b/picachooser/melodicompTemplate_qt6.py new file mode 100644 index 0000000..781212b --- /dev/null +++ b/picachooser/melodicompTemplate_qt6.py @@ -0,0 +1,89 @@ +# Form implementation generated from reading ui file 'melodicompTemplate.ui' +# +# Created by: PyQt6 UI code generator 6.6.0 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(1750, 826) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) + MainWindow.setSizePolicy(sizePolicy) + MainWindow.setMinimumSize(QtCore.QSize(0, 100)) + self.centralwidget = QtWidgets.QWidget(parent=MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) + self.gridLayout.setObjectName("gridLayout") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetNoConstraint) + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.pane1_label = QtWidgets.QLabel(parent=self.centralwidget) + self.pane1_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.pane1_label.setObjectName("pane1_label") + self.verticalLayout.addWidget(self.pane1_label) + self.image_graphicsView_1 = GraphicsLayoutWidget(parent=self.centralwidget) + self.image_graphicsView_1.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.image_graphicsView_1.sizePolicy().hasHeightForWidth()) + self.image_graphicsView_1.setSizePolicy(sizePolicy) + self.image_graphicsView_1.setMinimumSize(QtCore.QSize(100, 100)) + self.image_graphicsView_1.setMaximumSize(QtCore.QSize(1000, 1200)) + self.image_graphicsView_1.setSizeIncrement(QtCore.QSize(1, 1)) + self.image_graphicsView_1.setObjectName("image_graphicsView_1") + self.verticalLayout.addWidget(self.image_graphicsView_1) + self.horizontalLayout.addLayout(self.verticalLayout) + self.verticalLayout_2 = QtWidgets.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.pane2_label = QtWidgets.QLabel(parent=self.centralwidget) + self.pane2_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.pane2_label.setObjectName("pane2_label") + self.verticalLayout_2.addWidget(self.pane2_label) + self.image_graphicsView_2 = GraphicsLayoutWidget(parent=self.centralwidget) + self.image_graphicsView_2.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.image_graphicsView_2.sizePolicy().hasHeightForWidth()) + self.image_graphicsView_2.setSizePolicy(sizePolicy) + self.image_graphicsView_2.setMinimumSize(QtCore.QSize(100, 100)) + self.image_graphicsView_2.setMaximumSize(QtCore.QSize(1000, 1200)) + self.image_graphicsView_2.setSizeIncrement(QtCore.QSize(1, 1)) + self.image_graphicsView_2.setObjectName("image_graphicsView_2") + self.verticalLayout_2.addWidget(self.image_graphicsView_2) + self.horizontalLayout.addLayout(self.verticalLayout_2) + self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) + self.label = QtWidgets.QLabel(parent=self.centralwidget) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 1, 0, 1, 1) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtWidgets.QMenuBar(parent=MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1750, 24)) + self.menubar.setObjectName("menubar") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtWidgets.QStatusBar(parent=MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) + self.pane1_label.setText(_translate("MainWindow", "Component XX of XX: XX.X% explained var., XX.X% total var.")) + self.pane2_label.setText(_translate("MainWindow", "Component XX of XX: XX.X% explained var., XX.X% total var.")) + self.label.setText(_translate("MainWindow", "Right and left arrows step through components. Up and down arrows toggle sortmode. \"r\" to reset component. \"a\", \"c\", and \"s\" select axial, coronal, or sagittal views. ESC to write component file. \"b\" to blink! ")) +from pyqtgraph import GraphicsLayoutWidget diff --git a/picachooser/picachooserTemplate_qt6.py b/picachooser/picachooserTemplate_qt6.py new file mode 100644 index 0000000..814bb87 --- /dev/null +++ b/picachooser/picachooserTemplate_qt6.py @@ -0,0 +1,168 @@ +# Form implementation generated from reading ui file 'picachooserTemplate.ui' +# +# Created by: PyQt6 UI code generator 6.6.0 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(1746, 839) + MainWindow.setMinimumSize(QtCore.QSize(0, 100)) + self.centralwidget = QtWidgets.QWidget(parent=MainWindow) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth()) + self.centralwidget.setSizePolicy(sizePolicy) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) + self.gridLayout.setObjectName("gridLayout") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetNoConstraint) + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.translation_graphicsView = GraphicsLayoutWidget(parent=self.centralwidget) + self.translation_graphicsView.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.translation_graphicsView.sizePolicy().hasHeightForWidth()) + self.translation_graphicsView.setSizePolicy(sizePolicy) + self.translation_graphicsView.setMinimumSize(QtCore.QSize(400, 100)) + self.translation_graphicsView.setMaximumSize(QtCore.QSize(610, 1000)) + self.translation_graphicsView.setSizeIncrement(QtCore.QSize(1, 1)) + self.translation_graphicsView.setObjectName("translation_graphicsView") + self.verticalLayout.addWidget(self.translation_graphicsView) + self.rotation_graphicsView = GraphicsLayoutWidget(parent=self.centralwidget) + self.rotation_graphicsView.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.rotation_graphicsView.sizePolicy().hasHeightForWidth()) + self.rotation_graphicsView.setSizePolicy(sizePolicy) + self.rotation_graphicsView.setMinimumSize(QtCore.QSize(400, 100)) + self.rotation_graphicsView.setMaximumSize(QtCore.QSize(610, 1000)) + self.rotation_graphicsView.setSizeIncrement(QtCore.QSize(1, 1)) + self.rotation_graphicsView.setObjectName("rotation_graphicsView") + self.verticalLayout.addWidget(self.rotation_graphicsView) + self.timecourse_graphicsView = GraphicsLayoutWidget(parent=self.centralwidget) + self.timecourse_graphicsView.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.timecourse_graphicsView.sizePolicy().hasHeightForWidth()) + self.timecourse_graphicsView.setSizePolicy(sizePolicy) + self.timecourse_graphicsView.setMinimumSize(QtCore.QSize(400, 100)) + self.timecourse_graphicsView.setMaximumSize(QtCore.QSize(610, 1000)) + self.timecourse_graphicsView.setSizeIncrement(QtCore.QSize(1, 1)) + self.timecourse_graphicsView.setObjectName("timecourse_graphicsView") + self.verticalLayout.addWidget(self.timecourse_graphicsView) + self.spectrum_graphicsView = GraphicsLayoutWidget(parent=self.centralwidget) + self.spectrum_graphicsView.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.spectrum_graphicsView.sizePolicy().hasHeightForWidth()) + self.spectrum_graphicsView.setSizePolicy(sizePolicy) + self.spectrum_graphicsView.setMinimumSize(QtCore.QSize(400, 100)) + self.spectrum_graphicsView.setMaximumSize(QtCore.QSize(610, 1000)) + self.spectrum_graphicsView.setSizeIncrement(QtCore.QSize(1, 1)) + self.spectrum_graphicsView.setObjectName("spectrum_graphicsView") + self.verticalLayout.addWidget(self.spectrum_graphicsView) + self.horizontalLayout.addLayout(self.verticalLayout) + self.stackedWidget = QtWidgets.QStackedWidget(parent=self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.stackedWidget.sizePolicy().hasHeightForWidth()) + self.stackedWidget.setSizePolicy(sizePolicy) + self.stackedWidget.setSizeIncrement(QtCore.QSize(1, 1)) + self.stackedWidget.setObjectName("stackedWidget") + self.page = QtWidgets.QWidget() + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.page.sizePolicy().hasHeightForWidth()) + self.page.setSizePolicy(sizePolicy) + self.page.setMinimumSize(QtCore.QSize(100, 100)) + self.page.setSizeIncrement(QtCore.QSize(1, 1)) + self.page.setObjectName("page") + self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.page) + self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetNoConstraint) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.image_graphicsView = GraphicsLayoutWidget(parent=self.page) + self.image_graphicsView.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.image_graphicsView.sizePolicy().hasHeightForWidth()) + self.image_graphicsView.setSizePolicy(sizePolicy) + self.image_graphicsView.setMinimumSize(QtCore.QSize(600, 100)) + self.image_graphicsView.setMaximumSize(QtCore.QSize(16384, 8192)) + self.image_graphicsView.setSizeIncrement(QtCore.QSize(1, 1)) + self.image_graphicsView.setObjectName("image_graphicsView") + self.horizontalLayout_2.addWidget(self.image_graphicsView) + self.verticalLayout_2.addLayout(self.horizontalLayout_2) + self.stackedWidget.addWidget(self.page) + self.page_2 = QtWidgets.QWidget() + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.page_2.sizePolicy().hasHeightForWidth()) + self.page_2.setSizePolicy(sizePolicy) + self.page_2.setMinimumSize(QtCore.QSize(100, 100)) + self.page_2.setSizeIncrement(QtCore.QSize(1, 1)) + self.page_2.setObjectName("page_2") + self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.page_2) + self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetNoConstraint) + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.image_altgraphicsView = GraphicsLayoutWidget(parent=self.page_2) + self.image_altgraphicsView.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.image_altgraphicsView.sizePolicy().hasHeightForWidth()) + self.image_altgraphicsView.setSizePolicy(sizePolicy) + self.image_altgraphicsView.setMinimumSize(QtCore.QSize(600, 100)) + self.image_altgraphicsView.setMaximumSize(QtCore.QSize(16384, 8192)) + self.image_altgraphicsView.setSizeIncrement(QtCore.QSize(1, 1)) + self.image_altgraphicsView.setObjectName("image_altgraphicsView") + self.horizontalLayout_3.addWidget(self.image_altgraphicsView) + self.verticalLayout_3.addLayout(self.horizontalLayout_3) + self.stackedWidget.addWidget(self.page_2) + self.horizontalLayout.addWidget(self.stackedWidget) + self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) + self.label = QtWidgets.QLabel(parent=self.centralwidget) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 1, 0, 1, 1) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtWidgets.QMenuBar(parent=MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1746, 24)) + self.menubar.setObjectName("menubar") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtWidgets.QStatusBar(parent=MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + self.stackedWidget.setCurrentIndex(0) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) + self.label.setText(_translate("MainWindow", "Right and left arrows step through components. Up and down arrows toggle component retention. \"r\" to reset component. \"a\", \"c\", and \"s\" select axial, coronal, or sagittal views. ESC to write component file. \"f\" to show filter command, \"F\" to run filter.")) +from pyqtgraph import GraphicsLayoutWidget diff --git a/picachooser/picachooser_imonlyTemplate_qt6.py b/picachooser/picachooser_imonlyTemplate_qt6.py new file mode 100644 index 0000000..8ffa6fc --- /dev/null +++ b/picachooser/picachooser_imonlyTemplate_qt6.py @@ -0,0 +1,111 @@ +# Form implementation generated from reading ui file 'picachooser_imonlyTemplate.ui' +# +# Created by: PyQt6 UI code generator 6.6.0 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(1896, 839) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) + MainWindow.setSizePolicy(sizePolicy) + self.centralwidget = QtWidgets.QWidget(parent=MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) + self.gridLayout.setObjectName("gridLayout") + self.label = QtWidgets.QLabel(parent=self.centralwidget) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 1, 1, 1, 1) + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetNoConstraint) + self.horizontalLayout.setObjectName("horizontalLayout") + self.stackedWidget = QtWidgets.QStackedWidget(parent=self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.stackedWidget.sizePolicy().hasHeightForWidth()) + self.stackedWidget.setSizePolicy(sizePolicy) + self.stackedWidget.setObjectName("stackedWidget") + self.page = QtWidgets.QWidget() + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.page.sizePolicy().hasHeightForWidth()) + self.page.setSizePolicy(sizePolicy) + self.page.setObjectName("page") + self.verticalLayout = QtWidgets.QVBoxLayout(self.page) + self.verticalLayout.setContentsMargins(0, 0, 0, 12) + self.verticalLayout.setObjectName("verticalLayout") + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetMaximumSize) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.image_graphicsView = GraphicsLayoutWidget(parent=self.page) + self.image_graphicsView.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.image_graphicsView.sizePolicy().hasHeightForWidth()) + self.image_graphicsView.setSizePolicy(sizePolicy) + self.image_graphicsView.setMinimumSize(QtCore.QSize(600, 100)) + self.image_graphicsView.setMaximumSize(QtCore.QSize(2000, 1200)) + self.image_graphicsView.setSizeIncrement(QtCore.QSize(1, 1)) + self.image_graphicsView.setObjectName("image_graphicsView") + self.horizontalLayout_2.addWidget(self.image_graphicsView) + self.verticalLayout.addLayout(self.horizontalLayout_2) + self.stackedWidget.addWidget(self.page) + self.page_2 = QtWidgets.QWidget() + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.page_2.sizePolicy().hasHeightForWidth()) + self.page_2.setSizePolicy(sizePolicy) + self.page_2.setObjectName("page_2") + self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.page_2) + self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetMaximumSize) + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.image_altgraphicsView = GraphicsLayoutWidget(parent=self.page_2) + self.image_altgraphicsView.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.image_altgraphicsView.sizePolicy().hasHeightForWidth()) + self.image_altgraphicsView.setSizePolicy(sizePolicy) + self.image_altgraphicsView.setMinimumSize(QtCore.QSize(600, 100)) + self.image_altgraphicsView.setMaximumSize(QtCore.QSize(2000, 1200)) + self.image_altgraphicsView.setSizeIncrement(QtCore.QSize(1, 1)) + self.image_altgraphicsView.setObjectName("image_altgraphicsView") + self.horizontalLayout_3.addWidget(self.image_altgraphicsView) + self.verticalLayout_2.addLayout(self.horizontalLayout_3) + self.stackedWidget.addWidget(self.page_2) + self.horizontalLayout.addWidget(self.stackedWidget) + self.gridLayout.addLayout(self.horizontalLayout, 0, 1, 1, 1) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtWidgets.QMenuBar(parent=MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1896, 24)) + self.menubar.setObjectName("menubar") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtWidgets.QStatusBar(parent=MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + self.stackedWidget.setCurrentIndex(0) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) + self.label.setText(_translate("MainWindow", "Right and left arrows step through components. Up and down arrows toggle component retention. \"r\" to reset component. \"a\", \"c\", and \"s\" select axial, coronal, or sagittal views. ESC to write component file. \"f\" to show filter command, \"F\" to run filter.")) +from pyqtgraph import GraphicsLayoutWidget diff --git a/picachooser/rtgraderTemplate_qt6.py b/picachooser/rtgraderTemplate_qt6.py new file mode 100644 index 0000000..e27fdc2 --- /dev/null +++ b/picachooser/rtgraderTemplate_qt6.py @@ -0,0 +1,89 @@ +# Form implementation generated from reading ui file 'rtgraderTemplate.ui' +# +# Created by: PyQt6 UI code generator 6.6.0 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(1750, 826) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) + MainWindow.setSizePolicy(sizePolicy) + MainWindow.setMinimumSize(QtCore.QSize(0, 100)) + self.centralwidget = QtWidgets.QWidget(parent=MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) + self.gridLayout.setObjectName("gridLayout") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetNoConstraint) + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.pane1_label = QtWidgets.QLabel(parent=self.centralwidget) + self.pane1_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.pane1_label.setObjectName("pane1_label") + self.verticalLayout.addWidget(self.pane1_label) + self.image_graphicsView_1 = GraphicsLayoutWidget(parent=self.centralwidget) + self.image_graphicsView_1.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.image_graphicsView_1.sizePolicy().hasHeightForWidth()) + self.image_graphicsView_1.setSizePolicy(sizePolicy) + self.image_graphicsView_1.setMinimumSize(QtCore.QSize(100, 100)) + self.image_graphicsView_1.setMaximumSize(QtCore.QSize(1000, 1200)) + self.image_graphicsView_1.setSizeIncrement(QtCore.QSize(1, 1)) + self.image_graphicsView_1.setObjectName("image_graphicsView_1") + self.verticalLayout.addWidget(self.image_graphicsView_1) + self.horizontalLayout.addLayout(self.verticalLayout) + self.verticalLayout_2 = QtWidgets.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.pane2_label = QtWidgets.QLabel(parent=self.centralwidget) + self.pane2_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.pane2_label.setObjectName("pane2_label") + self.verticalLayout_2.addWidget(self.pane2_label) + self.image_graphicsView_2 = GraphicsLayoutWidget(parent=self.centralwidget) + self.image_graphicsView_2.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.image_graphicsView_2.sizePolicy().hasHeightForWidth()) + self.image_graphicsView_2.setSizePolicy(sizePolicy) + self.image_graphicsView_2.setMinimumSize(QtCore.QSize(100, 100)) + self.image_graphicsView_2.setMaximumSize(QtCore.QSize(1000, 1200)) + self.image_graphicsView_2.setSizeIncrement(QtCore.QSize(1, 1)) + self.image_graphicsView_2.setObjectName("image_graphicsView_2") + self.verticalLayout_2.addWidget(self.image_graphicsView_2) + self.horizontalLayout.addLayout(self.verticalLayout_2) + self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) + self.label = QtWidgets.QLabel(parent=self.centralwidget) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 1, 0, 1, 1) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtWidgets.QMenuBar(parent=MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1750, 24)) + self.menubar.setObjectName("menubar") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtWidgets.QStatusBar(parent=MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) + self.pane1_label.setText(_translate("MainWindow", "Component XX of XX: XX.X% explained var., XX.X% total var.")) + self.pane2_label.setText(_translate("MainWindow", "Component XX of XX: XX.X% explained var., XX.X% total var.")) + self.label.setText(_translate("MainWindow", "Right and left arrows step through datasets (Shift for rejected datasets, Ctrl/Cmd for accepted). Up and down arrows toggle status. \"r\" to reset to first dataset. \"a\", \"c\", and \"s\" select axial, coronal, or sagittal view. ESC to write grade file. \"b\" to swap windows. ")) +from pyqtgraph import GraphicsLayoutWidget diff --git a/picachooser/scripts/PICAchooser b/picachooser/scripts/PICAchooser index a8760bc..f127f8f 100755 --- a/picachooser/scripts/PICAchooser +++ b/picachooser/scripts/PICAchooser @@ -42,6 +42,13 @@ import picachooser.io as io import picachooser.LightboxItem as lb import picachooser.util as pica_util +try: + from PyQt6.QtCore import QT_VERSION_STR +except ImportError: + pyqtversion = 5 +else: + pyqtversion = 6 + hammingwindows = {} DEFAULT_RETAINTHRESH = 0.5 @@ -367,49 +374,49 @@ def keyPressed(evt): print("processing keypress event") keymods = None - if evt.modifiers() & QtCore.Qt.ShiftModifier: + if evt.modifiers() & QtCore.Qt.KeyboardModifier.ShiftModifier: keymods = "shift" - elif evt.modifiers() & QtCore.Qt.ControlModifier: + elif evt.modifiers() & QtCore.Qt.KeyboardModifier.ControlModifier: keymods = "ctrl" - if evt.key() == QtCore.Qt.Key_Up: + if evt.key() == QtCore.Qt.Key.Key_Up: incrementgrade(whichcomponent) - elif evt.key() == QtCore.Qt.Key_Down: + elif evt.key() == QtCore.Qt.Key.Key_Down: decrementgrade(whichcomponent) - elif evt.key() == QtCore.Qt.Key_Left: + elif evt.key() == QtCore.Qt.Key.Key_Left: whichcomponent = (whichcomponent - 1) % numelements print("IC set to:", whichcomponent + 1) - elif evt.key() == QtCore.Qt.Key_Right: + elif evt.key() == QtCore.Qt.Key.Key_Right: whichcomponent = (whichcomponent + 1) % numelements print("IC set to:", whichcomponent + 1) - elif evt.key() == QtCore.Qt.Key_A: + elif evt.key() == QtCore.Qt.Key.Key_A: mainwin.setorient("ax") mainwin.resetWinProps() if usereferencefile: altwin.setorient("ax") altwin.resetWinProps() print("Setting orientation to axial") - elif evt.key() == QtCore.Qt.Key_C: + elif evt.key() == QtCore.Qt.Key.Key_C: mainwin.setorient("cor") mainwin.resetWinProps() if usereferencefile: altwin.setorient("cor") altwin.resetWinProps() print("Setting orientation to coronal") - elif evt.key() == QtCore.Qt.Key_S: + elif evt.key() == QtCore.Qt.Key.Key_S: mainwin.setorient("sag") mainwin.resetWinProps() if usereferencefile: altwin.setorient("sag") altwin.resetWinProps() print("Setting orientation to sagittal") - elif evt.key() == QtCore.Qt.Key_D: + elif evt.key() == QtCore.Qt.Key.Key_D: print("Dumping main window information") mainwin.printWinProps() if usereferencefile: print("Dumping reference window information") altwin.printWinProps() - elif evt.key() == QtCore.Qt.Key_B: + elif evt.key() == QtCore.Qt.Key.Key_B: if usereferencefile: print("Blinking") blinkstatus = not blinkstatus @@ -421,12 +428,12 @@ def keyPressed(evt): altwin.setviewinfo(altinfo) else: pass - elif evt.key() == QtCore.Qt.Key_R: + elif evt.key() == QtCore.Qt.Key.Key_R: whichcomponent = 0 - elif evt.key() == QtCore.Qt.Key_Escape: + elif evt.key() == QtCore.Qt.Key.Key_Escape: writegrades() print("bad component file written") - elif evt.key() == QtCore.Qt.Key_F: + elif evt.key() == QtCore.Qt.Key.Key_F: if keymods == "shift": filterdata(glmtype="fsl") print("ran fsl_regfilt") @@ -558,7 +565,7 @@ def updateMotion(): limitpen = pg.mkPen( config["motionlimitcolor"], width=config["motionlimitlinewidth"], - style=QtCore.Qt.DotLine, + style=QtCore.Qt.PenStyle.DotLine, ) transtopLine = pg.InfiniteLine(angle=0, movable=False, pen=limitpen) transtopLine.setZValue(20) @@ -639,7 +646,7 @@ def updateMotion(): limitpen = pg.mkPen( config["motionlimitcolor"], width=config["motionlimitlinewidth"], - style=QtCore.Qt.DotLine, + style=QtCore.Qt.PenStyle.DotLine, ) rottopLine = pg.InfiniteLine(angle=0, movable=False, pen=limitpen) rottopLine.setZValue(20) @@ -1448,10 +1455,16 @@ def main(): whichcomponent = 0 # make the main window - if dotimecourse: - import picachooser.picachooserTemplate as uiTemplate + if pyqtversion == 5: + if dotimecourse: + import picachooser.picachooserTemplate as uiTemplate + else: + import picachooser.picachooser_imonlyTemplate as uiTemplate else: - import picachooser.picachooser_imonlyTemplate as uiTemplate + if dotimecourse: + import picachooser.picachooserTemplate_qt6 as uiTemplate + else: + import picachooser.picachooser_imonlyTemplate_qt6 as uiTemplate app = QtWidgets.QApplication([]) print("setting up output window") @@ -1591,7 +1604,7 @@ def main(): updateMotion() updateLightbox() - QtWidgets.QApplication.instance().exec_() + QtWidgets.QApplication.instance().exec() if __name__ == "__main__": diff --git a/picachooser/scripts/grader b/picachooser/scripts/grader index 5a85b0f..6a3c4fe 100755 --- a/picachooser/scripts/grader +++ b/picachooser/scripts/grader @@ -40,6 +40,13 @@ from scipy import fftpack import picachooser.LightboxItem as lb import picachooser.util as pica_util +try: + from PyQt6.QtCore import QT_VERSION_STR +except ImportError: + pyqtversion = 5 +else: + pyqtversion = 6 + hammingwindows = {} @@ -190,15 +197,15 @@ def windowResized(evt): def keyPressed(evt): global whichfile, numelements, mainwin - if evt.key() == QtCore.Qt.Key_Up: + if evt.key() == QtCore.Qt.Key.Key_Up: incrementgrade(whichfile) - elif evt.key() == QtCore.Qt.Key_Down: + elif evt.key() == QtCore.Qt.Key.Key_Down: decrementgrade(whichfile) - elif evt.key() == QtCore.Qt.Key_Left: + elif evt.key() == QtCore.Qt.Key.Key_Left: whichfile = (whichfile - 1) % numelements - elif evt.key() == QtCore.Qt.Key_Right: + elif evt.key() == QtCore.Qt.Key.Key_Right: whichfile = (whichfile + 1) % numelements - elif evt.key() == QtCore.Qt.Key_Escape: + elif evt.key() == QtCore.Qt.Key.Key_Escape: writegrades() print("done") else: @@ -470,13 +477,22 @@ def main(): print("Read in", numelements, "files") # make the main window - if runmode == "timecourse": - import picachooser.graderTemplate as uiTemplate - elif runmode == "aroma": - import picachooser.aromaviewTemplate as uiTemplate + if pyqtversion == 5: + if runmode == "timecourse": + import picachooser.graderTemplate as uiTemplate + elif runmode == "aroma": + import picachooser.aromaviewTemplate as uiTemplate + else: + print("illegal runmode") + sys.exit() else: - print("illegal runmode") - sys.exit() + if runmode == "timecourse": + import picachooser.graderTemplate_qt6 as uiTemplate + elif runmode == "aroma": + import picachooser.aromaviewTemplate_qt6 as uiTemplate + else: + print("illegal runmode") + sys.exit() app = QtWidgets.QApplication([]) print("setting up output window") @@ -541,7 +557,7 @@ def main(): # wire up keystrokes to control interface - QtWidgets.QApplication.instance().exec_() + QtWidgets.QApplication.instance().exec() if __name__ == "__main__": diff --git a/picachooser/scripts/melodicomp b/picachooser/scripts/melodicomp index 01c4248..da027e6 100755 --- a/picachooser/scripts/melodicomp +++ b/picachooser/scripts/melodicomp @@ -39,6 +39,13 @@ import picachooser.io as io import picachooser.LightboxItem as lb import picachooser.util as pica_util +try: + from PyQt6.QtCore import QT_VERSION_STR +except ImportError: + pyqtversion = 5 +else: + pyqtversion = 6 + # fix for Big Sur on macOS os.environ["QT_MAC_WANTS_LAYER"] = "1" @@ -126,36 +133,36 @@ def keyPressed(evt): if verbose: print("processing keypress event") - if evt.key() == QtCore.Qt.Key_Up: + if evt.key() == QtCore.Qt.Key.Key_Up: incrementsorttype() - elif evt.key() == QtCore.Qt.Key_Down: + elif evt.key() == QtCore.Qt.Key.Key_Down: decrementsorttype() - elif evt.key() == QtCore.Qt.Key_Left: + elif evt.key() == QtCore.Qt.Key.Key_Left: whichcomponent = (whichcomponent - 1) % numelements1 print("IC set to:", whichcomponent + 1) - elif evt.key() == QtCore.Qt.Key_Right: + elif evt.key() == QtCore.Qt.Key.Key_Right: whichcomponent = (whichcomponent + 1) % numelements1 print("IC set to:", whichcomponent + 1) - elif evt.key() == QtCore.Qt.Key_A: + elif evt.key() == QtCore.Qt.Key.Key_A: for thewin in [lbwin1, lbwin2]: thewin.setorient("ax") thewin.resetWinProps() print("Setting orientation to axial") - elif evt.key() == QtCore.Qt.Key_C: + elif evt.key() == QtCore.Qt.Key.Key_C: for thewin in [lbwin1, lbwin2]: thewin.setorient("cor") thewin.resetWinProps() print("Setting orientation to coronal") - elif evt.key() == QtCore.Qt.Key_S: + elif evt.key() == QtCore.Qt.Key.Key_S: for thewin in [lbwin1, lbwin2]: thewin.setorient("sag") thewin.resetWinProps() print("Setting orientation to sagittal") - elif evt.key() == QtCore.Qt.Key_D: + elif evt.key() == QtCore.Qt.Key.Key_D: print("Dumping main window information") for thewin in [lbwin1, lbwin2]: thewin.printWinProps() - elif evt.key() == QtCore.Qt.Key_B: + elif evt.key() == QtCore.Qt.Key.Key_B: print("Blinking") blinkstatus = not blinkstatus if blinkstatus: @@ -164,9 +171,9 @@ def keyPressed(evt): else: lbwin1.setviewinfo(leftinfo) lbwin2.setviewinfo(rightinfo) - elif evt.key() == QtCore.Qt.Key_R: + elif evt.key() == QtCore.Qt.Key.Key_R: whichcomponent = 0 - elif evt.key() == QtCore.Qt.Key_Escape: + elif evt.key() == QtCore.Qt.Key.Key_Escape: writecorrespondance() print("correspondance file written") else: @@ -549,7 +556,10 @@ def main(): sortnames = ["file 1 order", "correlation coefficient"] # make the main window - import picachooser.melodicompTemplate as uiTemplate + if pyqtversion == 5: + import picachooser.melodicompTemplate as uiTemplate + else: + import picachooser.melodicompTemplate_qt6 as uiTemplate app = QtWidgets.QApplication([]) print("setting up output window") @@ -614,7 +624,7 @@ def main(): updateTCinfo() updateLightboxes() - QtWidgets.QApplication.instance().exec_() + QtWidgets.QApplication.instance().exec() if __name__ == "__main__": diff --git a/picachooser/scripts/rtgrader b/picachooser/scripts/rtgrader index 4a3e16f..0dc8e0d 100755 --- a/picachooser/scripts/rtgrader +++ b/picachooser/scripts/rtgrader @@ -39,6 +39,13 @@ import picachooser.io as io import picachooser.LightboxItem as lb import picachooser.util as pica_util +try: + from PyQt6.QtCore import QT_VERSION_STR +except ImportError: + pyqtversion = 5 +else: + pyqtversion = 6 + # fix for Big Sur on macOS os.environ["QT_MAC_WANTS_LAYER"] = "1" @@ -116,19 +123,19 @@ def keyPressed(evt): print("processing keypress event") keymods = None - if evt.modifiers() & QtCore.Qt.ShiftModifier: + if evt.modifiers() & QtCore.Qt.KeyboardModifier.ShiftModifier: keymods = "shift" - elif evt.modifiers() & QtCore.Qt.ControlModifier: + elif evt.modifiers() & QtCore.Qt.KeyboardModifier.ControlModifier: keymods = "ctrl" badindices = np.where(grades == False)[0] goodindices = np.where(grades == True)[0] - if evt.key() == QtCore.Qt.Key_Up: + if evt.key() == QtCore.Qt.Key.Key_Up: incrementgrade() - elif evt.key() == QtCore.Qt.Key_Down: + elif evt.key() == QtCore.Qt.Key.Key_Down: decrementgrade() - elif evt.key() == QtCore.Qt.Key_Left: + elif evt.key() == QtCore.Qt.Key.Key_Left: if keymods == "shift": whichcomponent = pica_util.nextmatch(whichcomponent, badindices, backwards=True) elif keymods == "ctrl": @@ -136,7 +143,7 @@ def keyPressed(evt): else: whichcomponent = (whichcomponent - 1) % numelements print(f"Index is {whichcomponent}, label is {datasetlabels[whichcomponent]}") - elif evt.key() == QtCore.Qt.Key_Right: + elif evt.key() == QtCore.Qt.Key.Key_Right: if keymods == "shift": whichcomponent = pica_util.nextmatch(whichcomponent, badindices, backwards=False) elif keymods == "ctrl": @@ -144,26 +151,26 @@ def keyPressed(evt): else: whichcomponent = (whichcomponent + 1) % numelements print(f"Index is {whichcomponent}, label is {datasetlabels[whichcomponent]}") - elif evt.key() == QtCore.Qt.Key_A: + elif evt.key() == QtCore.Qt.Key.Key_A: for thewin in [lbwin1, lbwin2]: thewin.setorient("ax") thewin.resetWinProps() print("Setting orientation to axial") - elif evt.key() == QtCore.Qt.Key_C: + elif evt.key() == QtCore.Qt.Key.Key_C: for thewin in [lbwin1, lbwin2]: thewin.setorient("cor") thewin.resetWinProps() print("Setting orientation to coronal") - elif evt.key() == QtCore.Qt.Key_S: + elif evt.key() == QtCore.Qt.Key.Key_S: for thewin in [lbwin1, lbwin2]: thewin.setorient("sag") thewin.resetWinProps() print("Setting orientation to sagittal") - elif evt.key() == QtCore.Qt.Key_D: + elif evt.key() == QtCore.Qt.Key.Key_D: print("Dumping main window information") for thewin in [lbwin1, lbwin2]: thewin.printWinProps() - elif evt.key() == QtCore.Qt.Key_B: + elif evt.key() == QtCore.Qt.Key.Key_B: print("Blinking") blinkstatus = not blinkstatus if blinkstatus: @@ -172,10 +179,10 @@ def keyPressed(evt): else: lbwin1.setviewinfo(leftinfo) lbwin2.setviewinfo(rightinfo) - elif evt.key() == QtCore.Qt.Key_R: + elif evt.key() == QtCore.Qt.Key.Key_R: whichcomponent = 0 print(f"Index is {whichcomponent}, label is {datasetlabels[whichcomponent]}") - elif evt.key() == QtCore.Qt.Key_Escape: + elif evt.key() == QtCore.Qt.Key.Key_Escape: goodindices = [] goodlabels = [] badindices = [] @@ -491,7 +498,10 @@ def main(): grades[idx] = False # make the main window - import picachooser.rtgraderTemplate as uiTemplate + if pyqtversion == 5: + import picachooser.rtgraderTemplate as uiTemplate + else: + import picachooser.rtgraderTemplate_qt6 as uiTemplate app = QtWidgets.QApplication([]) print("setting up output window") @@ -570,7 +580,7 @@ def main(): updateTCinfo() updateLightboxes() - QtWidgets.QApplication.instance().exec_() + QtWidgets.QApplication.instance().exec() if __name__ == "__main__":