mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
avoid importing directly from PyQt5 where possible
This commit is contained in:
parent
183e45c698
commit
2a3072191f
6 changed files with 11 additions and 22 deletions
|
@ -6,8 +6,6 @@ from __future__ import annotations
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QLineEdit
|
|
||||||
|
|
||||||
import aqt
|
import aqt
|
||||||
from anki.consts import NEW_CARDS_RANDOM
|
from anki.consts import NEW_CARDS_RANDOM
|
||||||
from anki.decks import DeckConfigDict
|
from anki.decks import DeckConfigDict
|
||||||
|
|
|
@ -26,8 +26,12 @@ import typing
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
# other modules we require that may not be automatically included
|
# other modules we require that may not be automatically included
|
||||||
import PyQt5.QtSvg
|
try:
|
||||||
import PyQt5.QtMultimedia
|
import PyQt6.QtSvg # type: ignore
|
||||||
|
import PyQt6.QtMultimedia # type: ignore
|
||||||
|
except:
|
||||||
|
import PyQt5.QtSvg # type: ignore
|
||||||
|
import PyQt5.QtMultimedia # type: ignore
|
||||||
import socks
|
import socks
|
||||||
import pyaudio
|
import pyaudio
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@ from dataclasses import dataclass
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
from typing import Any, Callable, Literal, Match, Sequence, cast
|
from typing import Any, Callable, Literal, Match, Sequence, cast
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
|
||||||
|
|
||||||
from anki import hooks
|
from anki import hooks
|
||||||
from anki.cards import Card, CardId
|
from anki.cards import Card, CardId
|
||||||
from anki.collection import Config, OpChanges, OpChangesWithCount
|
from anki.collection import Config, OpChanges, OpChangesWithCount
|
||||||
|
|
|
@ -14,10 +14,8 @@ from concurrent.futures.thread import ThreadPoolExecutor
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
|
|
||||||
from PyQt5.QtCore import QObject, pyqtSignal
|
|
||||||
|
|
||||||
import aqt
|
import aqt
|
||||||
from aqt.qt import QWidget, qconnect
|
from aqt.qt import *
|
||||||
|
|
||||||
Closure = Callable[[], None]
|
Closure = Callable[[], None]
|
||||||
|
|
||||||
|
|
|
@ -9,18 +9,6 @@ import sys
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import TYPE_CHECKING, Any, Literal, Sequence, cast
|
from typing import TYPE_CHECKING, Any, Literal, Sequence, cast
|
||||||
|
|
||||||
from PyQt5.QtWidgets import (
|
|
||||||
QAction,
|
|
||||||
QDialog,
|
|
||||||
QDialogButtonBox,
|
|
||||||
QFileDialog,
|
|
||||||
QHeaderView,
|
|
||||||
QMenu,
|
|
||||||
QPushButton,
|
|
||||||
QSplitter,
|
|
||||||
QWidget,
|
|
||||||
)
|
|
||||||
|
|
||||||
import aqt
|
import aqt
|
||||||
from anki.collection import Collection, HelpPage
|
from anki.collection import Collection, HelpPage
|
||||||
from anki.lang import TR, tr_legacyglobal # pylint: disable=unused-import
|
from anki.lang import TR, tr_legacyglobal # pylint: disable=unused-import
|
||||||
|
|
|
@ -6,7 +6,10 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import PyQt5
|
try:
|
||||||
|
import PyQt6
|
||||||
|
except:
|
||||||
|
import PyQt5
|
||||||
from pylint.lint import Run
|
from pylint.lint import Run
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue