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 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

View file

@ -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

View file

@ -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

View file

@ -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]

View file

@ -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

View file

@ -6,6 +6,9 @@ import os
import subprocess import subprocess
import sys import sys
try:
import PyQt6
except:
import PyQt5 import PyQt5
from pylint.lint import Run from pylint.lint import Run