avoid importing directly from PyQt5 where possible

This commit is contained in:
Damien Elmes 2021-10-05 10:17:56 +10:00
parent 183e45c698
commit 2a3072191f
6 changed files with 11 additions and 22 deletions

View file

@ -6,8 +6,6 @@ from __future__ import annotations
from operator import itemgetter
from typing import Any
from PyQt5.QtWidgets import QLineEdit
import aqt
from anki.consts import NEW_CARDS_RANDOM
from anki.decks import DeckConfigDict

View file

@ -26,8 +26,12 @@ import typing
import uuid
# other modules we require that may not be automatically included
import PyQt5.QtSvg
import PyQt5.QtMultimedia
try:
import PyQt6.QtSvg # type: ignore
import PyQt6.QtMultimedia # type: ignore
except:
import PyQt5.QtSvg # type: ignore
import PyQt5.QtMultimedia # type: ignore
import socks
import pyaudio

View file

@ -13,8 +13,6 @@ from dataclasses import dataclass
from enum import Enum, auto
from typing import Any, Callable, Literal, Match, Sequence, cast
from PyQt5.QtCore import Qt
from anki import hooks
from anki.cards import Card, CardId
from anki.collection import Config, OpChanges, OpChangesWithCount

View file

@ -14,10 +14,8 @@ from concurrent.futures.thread import ThreadPoolExecutor
from threading import Lock
from typing import Any, Callable
from PyQt5.QtCore import QObject, pyqtSignal
import aqt
from aqt.qt import QWidget, qconnect
from aqt.qt import *
Closure = Callable[[], None]

View file

@ -9,18 +9,6 @@ import sys
from functools import wraps
from typing import TYPE_CHECKING, Any, Literal, Sequence, cast
from PyQt5.QtWidgets import (
QAction,
QDialog,
QDialogButtonBox,
QFileDialog,
QHeaderView,
QMenu,
QPushButton,
QSplitter,
QWidget,
)
import aqt
from anki.collection import Collection, HelpPage
from anki.lang import TR, tr_legacyglobal # pylint: disable=unused-import

View file

@ -6,7 +6,10 @@ import os
import subprocess
import sys
import PyQt5
try:
import PyQt6
except:
import PyQt5
from pylint.lint import Run
if __name__ == "__main__":