diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aca3eb33..9115dceb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,9 +26,14 @@ jobs: if [ "${{ runner.os }}" = "Windows" ]; then source pyenv/Scripts/activate else + # Qt6 complains because Ubuntu is missing libEGL.so.1 + if [ "${{ runner.os }}" = "Linux" ]; then + sudo apt-get update -y -qq + sudo apt-get install -y -qq libegl1 + fi source pyenv/bin/activate fi - python -m pip install aqt==${{ matrix.anki }} anki==${{ matrix.anki }} pyqtwebengine pylint + python -m pip install aqt==${{ matrix.anki }} anki==${{ matrix.anki }} PyQt6-WebEngine pylint - name: Lint shell: bash run: | @@ -50,4 +55,3 @@ jobs: export QT_QPA_PLATFORM=minimal export PYTHONPATH=./ python test.py - diff --git a/.pylintrc b/.pylintrc index 95d2dcb6..5772b3ed 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,6 +1,6 @@ [MASTER] ignore=deps -extension-pkg-whitelist=PyQt5 +extension-pkg-whitelist=PyQt6 [MESSAGES CONTROL] disable=C,R, diff --git a/README.md b/README.md index fb23f0b9..b76d594a 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ See the [MorphMan wiki](https://github.com/kaegi/MorphMan/wiki) for more informa ``` python -m virtualenv pyenv source pyenv/bin/activate - python -m pip install aqt==2.1.54 anki==2.1.54 pyqtwebengine pylint + python -m pip install aqt==2.1.54 anki==2.1.54 pyqt6-webengine pylint export PYTHONPATH=./ ``` - Run tests: `python test.py` diff --git a/__init__.py b/__init__.py index 9a1688d2..e43fb62d 100644 --- a/__init__.py +++ b/__init__.py @@ -1,5 +1,5 @@ from .morph.util import * -from PyQt5.QtWidgets import * +from PyQt6.QtWidgets import * import anki.stats from anki.hooks import wrap diff --git a/morph/UI/morphemizerComboBox.py b/morph/UI/morphemizerComboBox.py index 87edb643..6a1117cf 100644 --- a/morph/UI/morphemizerComboBox.py +++ b/morph/UI/morphemizerComboBox.py @@ -1,5 +1,5 @@ -from PyQt5.QtWidgets import QComboBox +from PyQt6.QtWidgets import QComboBox class MorphemizerComboBox(QComboBox): diff --git a/morph/browser/massTagger.py b/morph/browser/massTagger.py index baf68f68..276995f1 100644 --- a/morph/browser/massTagger.py +++ b/morph/browser/massTagger.py @@ -11,7 +11,7 @@ def pre(b): # :: Browser -> State note_count = len(b.selectedNotes()) - tags, ok = QInputDialog.getText(b, 'Enter tags (e.x \"tag1 tag2\")', 'Tags', QLineEdit.Normal, 'hasMorph') + tags, ok = QInputDialog.getText(b, 'Enter tags (e.x \"tag1 tag2\")', 'Tags', QLineEdit.EchoMode.Normal, 'hasMorph') if not ok or not tags: return diff --git a/morph/customTableWidget.py b/morph/customTableWidget.py index 3b5b4f19..3db35afd 100644 --- a/morph/customTableWidget.py +++ b/morph/customTableWidget.py @@ -1,10 +1,10 @@ -from PyQt5.QtWidgets import QApplication, QTableWidget -from PyQt5.QtGui import QKeySequence +from PyQt6.QtWidgets import QApplication, QTableWidget +from PyQt6.QtGui import QKeySequence class CustomTableWidget(QTableWidget): def keyPressEvent(self, event): - if event.matches(QKeySequence.Copy): + if event.matches(QKeySequence.StandardKey.Copy): text = '' sel_range = self.selectionModel().selection().first() diff --git a/morph/main.py b/morph/main.py index 4ad06365..9148d715 100644 --- a/morph/main.py +++ b/morph/main.py @@ -183,6 +183,9 @@ def mkAllDb(all_db=None): except KeyError: continue except TypeError: + # We need to finish the progress bar before presenting an error window or the UI will hang waiting on progress updates. + # The proper solution here is probably to not block the main thread at all by doing the recalc in the background. + mw.progress.finish() mname = mw.col.models.get(mid)['name'] errorMsg('Failed to get field "{field}" from a note of model "{model}". Please fix your Note Filters ' 'under MorphMan > Preferences to match your collection appropriately.'.format( diff --git a/morph/manager.py b/morph/manager.py index 0eaa560e..ca2777dd 100644 --- a/morph/manager.py +++ b/morph/manager.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- import os -from PyQt5.QtCore import * -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * +from PyQt6.QtCore import * +from PyQt6.QtGui import * +from PyQt6.QtWidgets import * from anki.utils import is_mac from .UI import MorphemizerComboBox @@ -22,7 +22,7 @@ def getPath(le): # LineEdit -> GUI () def getProgressWidget(): progressWidget = QWidget() progressWidget.setFixedSize(400, 70) - progressWidget.setWindowModality(Qt.ApplicationModal) + progressWidget.setWindowModality(Qt.WindowModality.ApplicationModal) bar = QProgressBar(progressWidget) if is_mac: bar.setFixedSize(380, 50) @@ -30,7 +30,7 @@ def getProgressWidget(): bar.setFixedSize(390, 50) bar.move(10, 10) per = QLabel(bar) - per.setAlignment(Qt.AlignCenter) + per.setAlignment(Qt.AlignmentFlag.AlignCenter) progressWidget.show() return progressWidget, bar diff --git a/morph/preferencesDialog.py b/morph/preferencesDialog.py index 58462c23..394a007f 100644 --- a/morph/preferencesDialog.py +++ b/morph/preferencesDialog.py @@ -1,6 +1,6 @@ -from PyQt5.QtCore import * -from PyQt5.QtWidgets import * -from PyQt5.QtGui import * +from PyQt6.QtCore import * +from PyQt6.QtWidgets import * +from PyQt6.QtGui import * from anki.lang import _ from aqt.utils import tooltip @@ -47,15 +47,15 @@ def createNoteFilterTab(self): self.tableModel = QStandardItemModel(0, 6) self.tableView = QTableView() self.tableView.setModel(self.tableModel) - self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) - self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows) - self.tableView.setSelectionMode(QAbstractItemView.SingleSelection) - self.tableModel.setHeaderData(0, Qt.Horizontal, "Note type") - self.tableModel.setHeaderData(1, Qt.Horizontal, "Tags") - self.tableModel.setHeaderData(2, Qt.Horizontal, "Fields") - self.tableModel.setHeaderData(3, Qt.Horizontal, "Morphemizer") - self.tableModel.setHeaderData(4, Qt.Horizontal, "Read?") - self.tableModel.setHeaderData(5, Qt.Horizontal, "Modify?") + self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch) + self.tableView.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows) + self.tableView.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection) + self.tableModel.setHeaderData(0, Qt.Orientation.Horizontal, "Note type") + self.tableModel.setHeaderData(1, Qt.Orientation.Horizontal, "Tags") + self.tableModel.setHeaderData(2, Qt.Orientation.Horizontal, "Fields") + self.tableModel.setHeaderData(3, Qt.Orientation.Horizontal, "Morphemizer") + self.tableModel.setHeaderData(4, Qt.Orientation.Horizontal, "Read?") + self.tableModel.setHeaderData(5, Qt.Orientation.Horizontal, "Modify?") rowData = get_preference('Filter') self.tableModel.setRowCount(len(rowData)) @@ -178,7 +178,7 @@ def createTagsTab(self): self.checkboxSetNotRequiredTags = QCheckBox( "Add tags even if not required") self.checkboxSetNotRequiredTags.setCheckState( - Qt.Checked if get_preference('Option_SetNotRequiredTags') else Qt.Unchecked) + Qt.CheckState.Checked if get_preference('Option_SetNotRequiredTags') else Qt.CheckState.Unchecked) vbox.addWidget(self.checkboxSetNotRequiredTags) vbox.addStretch() @@ -236,7 +236,7 @@ def createGeneralTab(self): self.boolOptionList = [] for i, (layout, name, key, tooltipInfo) in enumerate(optionList): checkBox = QCheckBox(name) - checkBox.setCheckState(Qt.Checked if get_preference(key) else Qt.Unchecked) + checkBox.setCheckState(Qt.CheckState.Checked if get_preference(key) else Qt.CheckState.Unchecked) checkBox.setToolTip(tooltipInfo) checkBox.setMinimumSize(0, 30) self.boolOptionList.append((key, checkBox)) @@ -250,7 +250,7 @@ def createButtons(self): hbox = QHBoxLayout() self.vbox.addLayout(hbox) buttonCancel = QPushButton("&Cancel") - hbox.addWidget(buttonCancel, 1, Qt.AlignRight) + hbox.addWidget(buttonCancel, 1, Qt.AlignmentFlag.AlignRight) buttonCancel.setMaximumWidth(150) buttonCancel.clicked.connect(self.onCancel) @@ -282,11 +282,11 @@ def setTableRow(self, rowIndex, data): readItem = QStandardItem() readItem.setCheckable(True) - readItem.setCheckState(Qt.Checked if data.get('Read', True) else Qt.Unchecked) + readItem.setCheckState(Qt.CheckState.Checked if data.get('Read', True) else Qt.CheckState.Unchecked) modifyItem = QStandardItem() modifyItem.setCheckable(True) - modifyItem.setCheckState(Qt.Checked if data.get('Modify', True) else Qt.Unchecked) + modifyItem.setCheckState(Qt.CheckState.Checked if data.get('Modify', True) else Qt.CheckState.Unchecked) rowGui['modelComboBox'] = modelComboBox rowGui['tagsEntry'] = QLineEdit(', '.join(data['Tags'])) @@ -327,8 +327,8 @@ def rowGuiToFilter(row_gui): x for x in row_gui['fieldsEntry'].text().split(', ') if x] filter['Morphemizer'] = row_gui['morphemizerComboBox'].getCurrent().getName() - filter['Read'] = row_gui['readCheckBox'].checkState() != Qt.Unchecked - filter['Modify'] = row_gui['modifyCheckBox'].checkState() != Qt.Unchecked + filter['Read'] = row_gui['readCheckBox'].checkState() != Qt.CheckState.Unchecked + filter['Modify'] = row_gui['modifyCheckBox'].checkState() != Qt.CheckState.Unchecked return filter @@ -339,14 +339,14 @@ def readConfigFromGui(self): for (key, entry) in self.tagEntryList: cfg[key] = entry.text() for (key, checkBox) in self.boolOptionList: - cfg[key] = (checkBox.checkState() == Qt.Checked) + cfg[key] = (checkBox.checkState() == Qt.CheckState.Checked) cfg['Filter'] = [] for i, rowGui in enumerate(self.rowGui): cfg['Filter'].append(self.rowGuiToFilter(rowGui)) cfg['Option_SetNotRequiredTags'] = self.checkboxSetNotRequiredTags.checkState( - ) != Qt.Unchecked + ) != Qt.CheckState.Unchecked return cfg diff --git a/morph/readability.py b/morph/readability.py index f8d25b7e..1c8f587c 100644 --- a/morph/readability.py +++ b/morph/readability.py @@ -16,12 +16,12 @@ from collections import namedtuple from contextlib import redirect_stdout, redirect_stderr -from PyQt5.QtCore import * -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * +from PyQt6.QtCore import * +from PyQt6.QtGui import * +from PyQt6.QtWidgets import * try: - from PyQt5 import QtWebSockets, QtNetwork + from PyQt6 import QtWebSockets, QtNetwork except: pass @@ -104,7 +104,7 @@ def getPath(le, caption, open_directory=False): # LineEdit -> GUI () try: if open_directory: path = QFileDialog.getExistingDirectory(caption=caption, directory=start_path, - options=QFileDialog.ShowDirsOnly) + options=QFileDialog.Option.ShowDirsOnly) else: path = QFileDialog.getOpenFileName(caption=caption, directory=start_path)[0] except: @@ -271,7 +271,7 @@ def load(self, path, save_lines=False): class TableInteger(QTableWidgetItem): def __init__(self, value): super(TableInteger, self).__init__(str(int(value))) - self.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) + self.setTextAlignment(Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter) def __lt__(self, other): lvalue = self.text() @@ -281,7 +281,7 @@ def __lt__(self, other): class TableFloat(QTableWidgetItem): def __init__(self, value): super(TableFloat, self).__init__('%0.03f' % value) - self.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) + self.setTextAlignment(Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter) def __lt__(self, other): lvalue = self.text() @@ -291,7 +291,7 @@ def __lt__(self, other): class TablePercent(QTableWidgetItem): def __init__(self, value): super(TablePercent, self).__init__('%0.02f' % value) - self.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) + self.setTextAlignment(Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter) def __lt__(self, other): lvalue = self.text() @@ -433,8 +433,8 @@ def __init__(self, parent=None): self.clients = set() if cfg('Option_EnableWebService'): - self.server = QtWebSockets.QWebSocketServer('MorphMan Service', QtWebSockets.QWebSocketServer.NonSecureMode) - if self.server.listen(QtNetwork.QHostAddress.LocalHost, 9779): + self.server = QtWebSockets.QWebSocketServer('MorphMan Service', QtWebSockets.QWebSocketServer.SslMode.NonSecureMode) + if self.server.listen(QtNetwork.QHostAddress.SpecialAddress.LocalHost, 9779): self.write('Web Service Created: '+self.server.serverName()+' : '+self.server.serverAddress().toString()+':'+str(self.server.serverPort()) + '\n') else: self.write("Could't create Web Service\n") @@ -568,11 +568,11 @@ def clearOutput(self): self.ui.outputText.clear() def writeOutput(self, m): - self.ui.outputText.moveCursor(QTextCursor.End) + self.ui.outputText.moveCursor(QTextCursor.MoveOperation.End) self.ui.outputText.insertPlainText(m) def write(self, txt): - self.ui.outputText.moveCursor(QTextCursor.End) + self.ui.outputText.moveCursor(QTextCursor.MoveOperation.End) self.ui.outputText.insertPlainText(txt) def flush(self): diff --git a/morph/readability_settings_ui.py b/morph/readability_settings_ui.py index 96d6c913..00976335 100644 --- a/morph/readability_settings_ui.py +++ b/morph/readability_settings_ui.py @@ -1,14 +1,12 @@ -# -*- coding: utf-8 -*- - # Form implementation generated from reading ui file 'morph/readability_settings.ui' # -# Created by: PyQt5 UI code generator 5.15.7 +# Created by: PyQt6 UI code generator 6.4.0 # -# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# 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 PyQt5 import QtCore, QtGui, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets class Ui_ReadabilitySettingsDialog(object): @@ -35,28 +33,28 @@ def setupUi(self, ReadabilitySettingsDialog): self.resetLearnedAfterEachInputCheckBox.setObjectName("resetLearnedAfterEachInputCheckBox") self.verticalLayout.addWidget(self.resetLearnedAfterEachInputCheckBox) self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) + self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetDefaultConstraint) self.horizontalLayout.setObjectName("horizontalLayout") self.optimalMasterTargetLabel = QtWidgets.QLabel(self.studyPlanGroup) self.optimalMasterTargetLabel.setMinimumSize(QtCore.QSize(0, 0)) self.optimalMasterTargetLabel.setObjectName("optimalMasterTargetLabel") self.horizontalLayout.addWidget(self.optimalMasterTargetLabel) self.optimalMasterTargetSpinBox = QtWidgets.QDoubleSpinBox(self.studyPlanGroup) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.optimalMasterTargetSpinBox.sizePolicy().hasHeightForWidth()) self.optimalMasterTargetSpinBox.setSizePolicy(sizePolicy) self.optimalMasterTargetSpinBox.setMinimumSize(QtCore.QSize(0, 0)) self.optimalMasterTargetSpinBox.setMaximumSize(QtCore.QSize(16777215, 16777215)) - self.optimalMasterTargetSpinBox.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.optimalMasterTargetSpinBox.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter) self.optimalMasterTargetSpinBox.setPrefix("") self.optimalMasterTargetSpinBox.setMinimum(0.0) self.optimalMasterTargetSpinBox.setMaximum(100.0) self.optimalMasterTargetSpinBox.setProperty("value", 0.0) self.optimalMasterTargetSpinBox.setObjectName("optimalMasterTargetSpinBox") self.horizontalLayout.addWidget(self.optimalMasterTargetSpinBox) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) self.horizontalLayout.addItem(spacerItem) self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout_3.addWidget(self.studyPlanGroup) @@ -98,11 +96,11 @@ def setupUi(self, ReadabilitySettingsDialog): self.webServiceCheckBox.setObjectName("webServiceCheckBox") self.verticalLayout_4.addWidget(self.webServiceCheckBox) self.verticalLayout_3.addWidget(self.extrasGroup) - spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) self.verticalLayout_3.addItem(spacerItem1) self.buttonBox = QtWidgets.QDialogButtonBox(ReadabilitySettingsDialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout_3.addWidget(self.buttonBox) diff --git a/morph/readability_ui.py b/morph/readability_ui.py index d1f25373..327ab314 100644 --- a/morph/readability_ui.py +++ b/morph/readability_ui.py @@ -1,21 +1,19 @@ -# -*- coding: utf-8 -*- - # Form implementation generated from reading ui file 'morph/readability.ui' # -# Created by: PyQt5 UI code generator 5.15.7 +# Created by: PyQt6 UI code generator 6.4.0 # -# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# 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 PyQt5 import QtCore, QtGui, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets class Ui_ReadabilityDialog(object): def setupUi(self, ReadabilityDialog): ReadabilityDialog.setObjectName("ReadabilityDialog") ReadabilityDialog.resize(901, 730) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(ReadabilityDialog.sizePolicy().hasHeightForWidth()) @@ -29,8 +27,8 @@ def setupUi(self, ReadabilityDialog): self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.frame = QtWidgets.QFrame(ReadabilityDialog) self.frame.setMinimumSize(QtCore.QSize(730, 90)) - self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel) - self.frame.setFrameShadow(QtWidgets.QFrame.Raised) + self.frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel) + self.frame.setFrameShadow(QtWidgets.QFrame.Shadow.Raised) self.frame.setObjectName("frame") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame) self.verticalLayout_2.setObjectName("verticalLayout_2") @@ -58,7 +56,7 @@ def setupUi(self, ReadabilityDialog): self.morphemizerComboBox = MorphemizerComboBox(self.frame) self.morphemizerComboBox.setObjectName("morphemizerComboBox") self.horizontalLayout_4.addWidget(self.morphemizerComboBox) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) self.horizontalLayout_4.addItem(spacerItem) self.minFrequencyLabel = QtWidgets.QLabel(self.frame) self.minFrequencyLabel.setObjectName("minFrequencyLabel") @@ -68,17 +66,17 @@ def setupUi(self, ReadabilityDialog): self.minFrequencySpinBox.setObjectName("minFrequencySpinBox") self.horizontalLayout_4.addWidget(self.minFrequencySpinBox) self.targetLabel = QtWidgets.QLabel(self.frame) - self.targetLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.targetLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter) self.targetLabel.setObjectName("targetLabel") self.horizontalLayout_4.addWidget(self.targetLabel) self.targetSpinBox = QtWidgets.QDoubleSpinBox(self.frame) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.targetSpinBox.sizePolicy().hasHeightForWidth()) self.targetSpinBox.setSizePolicy(sizePolicy) - self.targetSpinBox.setLayoutDirection(QtCore.Qt.LeftToRight) - self.targetSpinBox.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.targetSpinBox.setLayoutDirection(QtCore.Qt.LayoutDirection.LeftToRight) + self.targetSpinBox.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter) self.targetSpinBox.setDecimals(1) self.targetSpinBox.setProperty("value", 98.0) self.targetSpinBox.setObjectName("targetSpinBox") @@ -87,8 +85,8 @@ def setupUi(self, ReadabilityDialog): self.horizontalLayout_2.addWidget(self.frame) self.frame_2 = QtWidgets.QFrame(ReadabilityDialog) self.frame_2.setMinimumSize(QtCore.QSize(130, 0)) - self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel) - self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised) + self.frame_2.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel) + self.frame_2.setFrameShadow(QtWidgets.QFrame.Shadow.Raised) self.frame_2.setObjectName("frame_2") self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.frame_2) self.verticalLayout_4.setObjectName("verticalLayout_4") @@ -101,11 +99,11 @@ def setupUi(self, ReadabilityDialog): self.closeButton.setObjectName("closeButton") self.verticalLayout_4.addWidget(self.closeButton) self.horizontalLayout_2.addWidget(self.frame_2) - spacerItem1 = QtWidgets.QSpacerItem(0, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + spacerItem1 = QtWidgets.QSpacerItem(0, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) self.horizontalLayout_2.addItem(spacerItem1) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) + self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetDefaultConstraint) self.horizontalLayout.setContentsMargins(6, 6, 6, 6) self.horizontalLayout.setObjectName("horizontalLayout") self.generalSettingsGroupBox = QtWidgets.QGroupBox(ReadabilityDialog) @@ -114,7 +112,7 @@ def setupUi(self, ReadabilityDialog): self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.generalSettingsGroupBox) self.verticalLayout_3.setObjectName("verticalLayout_3") self.masterFreqLabel = QtWidgets.QLabel(self.generalSettingsGroupBox) - self.masterFreqLabel.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft) + self.masterFreqLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignBottom|QtCore.Qt.AlignmentFlag.AlignLeading|QtCore.Qt.AlignmentFlag.AlignLeft) self.masterFreqLabel.setObjectName("masterFreqLabel") self.verticalLayout_3.addWidget(self.masterFreqLabel) self.horizontalLayout_MasterFrequency = QtWidgets.QHBoxLayout() @@ -127,7 +125,7 @@ def setupUi(self, ReadabilityDialog): self.horizontalLayout_MasterFrequency.addWidget(self.masterFreqEdit) self.verticalLayout_3.addLayout(self.horizontalLayout_MasterFrequency) self.knownMorphsLabel = QtWidgets.QLabel(self.generalSettingsGroupBox) - self.knownMorphsLabel.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft) + self.knownMorphsLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignBottom|QtCore.Qt.AlignmentFlag.AlignLeading|QtCore.Qt.AlignmentFlag.AlignLeft) self.knownMorphsLabel.setObjectName("knownMorphsLabel") self.verticalLayout_3.addWidget(self.knownMorphsLabel) self.horizontalLayout_KnownMorphs = QtWidgets.QHBoxLayout() @@ -153,7 +151,7 @@ def setupUi(self, ReadabilityDialog): self.verticalLayout_3.addLayout(self.horizontalLayout_Output) self.horizontalLayout.addWidget(self.generalSettingsGroupBox) self.OutputsGroupBox = QtWidgets.QGroupBox(ReadabilityDialog) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.OutputsGroupBox.sizePolicy().hasHeightForWidth()) @@ -183,14 +181,14 @@ def setupUi(self, ReadabilityDialog): self.processLinesCheckBox.setObjectName("processLinesCheckBox") self.verticalLayout_5.addWidget(self.processLinesCheckBox) self.advancedSettingsButton = QtWidgets.QPushButton(self.OutputsGroupBox) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.advancedSettingsButton.sizePolicy().hasHeightForWidth()) self.advancedSettingsButton.setSizePolicy(sizePolicy) self.advancedSettingsButton.setObjectName("advancedSettingsButton") self.verticalLayout_5.addWidget(self.advancedSettingsButton) - self.horizontalLayout.addWidget(self.OutputsGroupBox, 0, QtCore.Qt.AlignTop) + self.horizontalLayout.addWidget(self.OutputsGroupBox, 0, QtCore.Qt.AlignmentFlag.AlignTop) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setContentsMargins(6, -1, 6, -1) @@ -202,7 +200,7 @@ def setupUi(self, ReadabilityDialog): self.verticalLayout_21 = QtWidgets.QVBoxLayout(self.tabOutputLog) self.verticalLayout_21.setObjectName("verticalLayout_21") self.outputText = QtWidgets.QPlainTextEdit(self.tabOutputLog) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.outputText.sizePolicy().hasHeightForWidth()) @@ -216,8 +214,8 @@ def setupUi(self, ReadabilityDialog): self.verticalLayout_31 = QtWidgets.QVBoxLayout(self.tabReadabilityReport) self.verticalLayout_31.setObjectName("verticalLayout_31") self.readabilityTable = CustomTableWidget(self.tabReadabilityReport) - self.readabilityTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) - self.readabilityTable.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectItems) + self.readabilityTable.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers) + self.readabilityTable.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectItems) self.readabilityTable.setRowCount(0) self.readabilityTable.setColumnCount(0) self.readabilityTable.setObjectName("readabilityTable") @@ -228,7 +226,7 @@ def setupUi(self, ReadabilityDialog): self.verticalLayout_41 = QtWidgets.QVBoxLayout(self.tabStudyPlan) self.verticalLayout_41.setObjectName("verticalLayout_41") self.studyPlanTable = CustomTableWidget(self.tabStudyPlan) - self.studyPlanTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) + self.studyPlanTable.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers) self.studyPlanTable.setObjectName("studyPlanTable") self.studyPlanTable.setColumnCount(0) self.studyPlanTable.setRowCount(0) diff --git a/scripts/build_ui.py b/scripts/build_ui.py index 69d34cf3..576154b9 100644 --- a/scripts/build_ui.py +++ b/scripts/build_ui.py @@ -2,7 +2,7 @@ def build_ui(in_file, out_file): - stdout = subprocess.run(["pyuic5", in_file], stdout=subprocess.PIPE).stdout + stdout = subprocess.run(["pyuic6", in_file], stdout=subprocess.PIPE).stdout lines = stdout.decode("utf-8").replace("__relpath__", "") diff --git a/scripts/run_anki.py b/scripts/run_anki.py new file mode 100644 index 00000000..7c987077 --- /dev/null +++ b/scripts/run_anki.py @@ -0,0 +1,2 @@ +import aqt +aqt.run() diff --git a/test/test_MorphemizerComboBox.py b/test/test_MorphemizerComboBox.py index 7c26c84c..190daa50 100644 --- a/test/test_MorphemizerComboBox.py +++ b/test/test_MorphemizerComboBox.py @@ -1,6 +1,6 @@ import unittest -from PyQt5.QtWidgets import QApplication +from PyQt6.QtWidgets import QApplication from morph.UI import MorphemizerComboBox from morph.morphemizer import getAllMorphemizers