diff --git a/plugin/__init__.py b/plugin/__init__.py index eceaa77..b947a06 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -20,26 +20,20 @@ import inspect import json import os import os.path -import random import re -import string import time import unicodedata -from PyQt5 import QtCore -from PyQt5.QtCore import QTimer -from PyQt5.QtWidgets import QMessageBox, QCheckBox - import anki import anki.exporting import anki.storage import aqt from anki.cards import Card from anki.consts import MODEL_CLOZE - from anki.exporting import AnkiPackageExporter from anki.importing import AnkiPackageImporter from anki.notes import Note +from aqt.qt import Qt, QTimer, QMessageBox, QCheckBox from .edit import Edit @@ -391,7 +385,7 @@ class AnkiConnect: msg.setStandardButtons(QMessageBox.Yes|QMessageBox.No) msg.setDefaultButton(QMessageBox.No) msg.setCheckBox(QCheckBox(text='Ignore further requests from "{}"'.format(origin), parent=msg)) - msg.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) + msg.setWindowFlags(Qt.WindowStaysOnTopHint) pressedButton = msg.exec_() if pressedButton == QMessageBox.Yes: diff --git a/plugin/edit.py b/plugin/edit.py index 1e063af..066df0e 100644 --- a/plugin/edit.py +++ b/plugin/edit.py @@ -184,7 +184,7 @@ class Edit(aqt.editcurrent.EditCurrent): # upon a request to open the dialog via `aqt.dialogs.open()`, # the manager will call either the constructor or the `reopen` method def __init__(self, note): - QDialog.__init__(self, None, Qt.Window) + QDialog.__init__(self, None, Qt.WindowType.Window) aqt.mw.garbage_collect_on_dialog_finish(self) self.form = aqt.forms.editcurrent.Ui_Dialog() self.form.setupUi(self) diff --git a/tests/conftest.py b/tests/conftest.py index c33f006..cb26734 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,7 +6,6 @@ from dataclasses import dataclass import aqt.operations.note import pytest import anki.collection -from PyQt5 import QtTest from _pytest.monkeypatch import MonkeyPatch # noqa from pytest_anki._launch import anki_running, temporary_user # noqa from waitress import wasyncore @@ -15,6 +14,11 @@ from plugin import AnkiConnect from plugin.edit import Edit from plugin.util import DEFAULT_CONFIG +try: + from PyQt6 import QtTest +except ImportError: + from PyQt5 import QtTest + ac = AnkiConnect() diff --git a/tox.ini b/tox.ini index b615d04..c8d3a41 100644 --- a/tox.ini +++ b/tox.ini @@ -40,25 +40,26 @@ # LIBGL_ALWAYS_INDIRECT=1 # QTWEBENGINE_CHROMIUM_FLAGS="--disable-gpu" # QT_DEBUG_PLUGINS=1 -# ANKIDEV=true +# ANKIDEV=1 [tox] minversion = 3.24 skipsdist = true skip_install = true -envlist = py38-anki{45,46,47,48,49},py39-anki50qt5 +envlist = py38-anki{45,46,47,48,49},py39-anki{50qt5,50qt6} [testenv] commands = xvfb-run python -m pytest {posargs} setenv = HOME={envdir}/home + anki50qt6: DISABLE_QT5_COMPAT=1 allowlist_externals = xvfb-run deps = pytest==7.1.1 pytest-forked==1.4.0 - pytest-anki @ git+https://github.com/oakkitten/pytest-anki.git@97708344 + pytest-anki @ git+https://github.com/oakkitten/pytest-anki.git@a0d27aa5 anki45: anki==2.1.45 anki45: aqt==2.1.45 @@ -77,3 +78,6 @@ deps = anki50qt5: anki==2.1.50 anki50qt5: aqt[qt5]==2.1.50 + + anki50qt6: anki==2.1.50 + anki50qt6: aqt[qt6]==2.1.50