mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
add aqt/
This commit is contained in:
parent
4e377a3b33
commit
c508498ba8
8 changed files with 29 additions and 14 deletions
|
@ -6,6 +6,8 @@ import json
|
|||
import re
|
||||
import zipfile
|
||||
from collections import defaultdict
|
||||
from typing import Callable, Dict, Any
|
||||
|
||||
import markdown
|
||||
from send2trash import send2trash
|
||||
import jsonschema
|
||||
|
@ -355,8 +357,8 @@ and have been disabled: %(found)s") % dict(name=self.addonName(dir), found=addon
|
|||
# Add-on Config
|
||||
######################################################################
|
||||
|
||||
_configButtonActions = {}
|
||||
_configUpdatedActions = {}
|
||||
_configButtonActions: Dict[str, Callable[[], None]] = {}
|
||||
_configUpdatedActions: Dict[str, Callable[[Any], None]] = {}
|
||||
|
||||
def addonConfigDefaults(self, dir):
|
||||
path = os.path.join(self.addonsFolder(dir), "config.json")
|
||||
|
@ -437,7 +439,7 @@ and have been disabled: %(found)s") % dict(name=self.addonName(dir), found=addon
|
|||
# Web Exports
|
||||
######################################################################
|
||||
|
||||
_webExports = {}
|
||||
_webExports: Dict[str, str] = {}
|
||||
|
||||
def setWebExports(self, module, pattern):
|
||||
addon = self.addonFromModule(module)
|
||||
|
|
|
@ -12,6 +12,8 @@ import shutil
|
|||
import io
|
||||
import locale
|
||||
|
||||
from typing import Dict, Any
|
||||
|
||||
from aqt.qt import *
|
||||
from anki.db import DB
|
||||
from anki.utils import isMac, isWin, intTime
|
||||
|
@ -35,7 +37,7 @@ metaConf = dict(
|
|||
disabledAddons=[],
|
||||
)
|
||||
|
||||
profileConf = dict(
|
||||
profileConf: Dict[str,Any] = dict(
|
||||
# profile
|
||||
mainWindowGeom=None,
|
||||
mainWindowState=None,
|
||||
|
|
|
@ -11,14 +11,15 @@ os.environ["LIBOVERLAY_SCROLLBAR"] = "0"
|
|||
|
||||
from anki.utils import isWin, isMac
|
||||
|
||||
from PyQt5.Qt import *
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtWidgets import *
|
||||
# trigger explicit message in case of missing libraries
|
||||
# instead of silently failing to import
|
||||
from PyQt5.QtWebEngineWidgets import *
|
||||
from PyQt5.QtWebEngineWidgets import * # type: ignore
|
||||
try:
|
||||
from PyQt5 import sip
|
||||
except ImportError:
|
||||
import sip
|
||||
import sip # type: ignore
|
||||
|
||||
from PyQt5.QtCore import pyqtRemoveInputHook # pylint: disable=no-name-in-module
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class SyncManager(QObject):
|
|||
auth=auth, media=self.pm.profile['syncMedia'],
|
||||
hostNum=self.pm.profile.get("hostNum"),
|
||||
)
|
||||
t.event.connect(self.onEvent)
|
||||
t._event.connect(self.onEvent)
|
||||
self.label = _("Connecting...")
|
||||
prog = self.mw.progress.start(immediate=True, label=self.label)
|
||||
self.sentBytes = self.recvBytes = 0
|
||||
|
@ -287,7 +287,7 @@ Check Database, then sync again."""))
|
|||
|
||||
class SyncThread(QThread):
|
||||
|
||||
event = pyqtSignal(str, str)
|
||||
_event = pyqtSignal(str, str)
|
||||
|
||||
def __init__(self, path, hkey, auth=None, media=True, hostNum=None):
|
||||
QThread.__init__(self)
|
||||
|
@ -460,6 +460,6 @@ class SyncThread(QThread):
|
|||
self.fireEvent("mediaSuccess")
|
||||
|
||||
def fireEvent(self, cmd, arg=""):
|
||||
self.event.emit(cmd, arg)
|
||||
self._event.emit(cmd, arg)
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ from anki.lang import _
|
|||
# Page for debug messages
|
||||
##########################################################################
|
||||
|
||||
class AnkiWebPage(QWebEnginePage):
|
||||
class AnkiWebPage(QWebEnginePage): # type: ignore
|
||||
|
||||
def __init__(self, onBridgeCmd):
|
||||
QWebEnginePage.__init__(self)
|
||||
|
@ -89,7 +89,7 @@ class AnkiWebPage(QWebEnginePage):
|
|||
# Main web view
|
||||
##########################################################################
|
||||
|
||||
class AnkiWebView(QWebEngineView):
|
||||
class AnkiWebView(QWebEngineView): # type: ignore
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWebEngineView.__init__(self, parent=parent)
|
||||
|
|
|
@ -7,7 +7,7 @@ Depends only on ctypes, and retrieves path locations in Unicode
|
|||
"""
|
||||
|
||||
import ctypes
|
||||
from ctypes import windll, wintypes
|
||||
from ctypes import windll, wintypes # type: ignore
|
||||
|
||||
__license__ = "MIT"
|
||||
__version__ = "0.2"
|
||||
|
|
10
mypy.ini
10
mypy.ini
|
@ -21,3 +21,13 @@ ignore_missing_imports = True
|
|||
ignore_missing_imports = True
|
||||
[mypy-bs4]
|
||||
ignore_missing_imports = True
|
||||
[mypy-pythoncom]
|
||||
ignore_missing_imports = True
|
||||
[mypy-win32com]
|
||||
ignore_missing_imports = True
|
||||
[mypy-send2trash]
|
||||
ignore_missing_imports = True
|
||||
[mypy-markdown]
|
||||
ignore_missing_imports = True
|
||||
[mypy-jsonschema.*]
|
||||
ignore_missing_imports = True
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
TOOLS="$(cd "`dirname "$0"`"; pwd)"
|
||||
mypy $TOOLS/../anki
|
||||
mypy $TOOLS/../anki $TOOLS/../aqt
|
||||
|
|
Loading…
Reference in a new issue