a few more typing fixes

This commit is contained in:
Damien Elmes 2019-12-20 17:55:19 +10:00
parent 12093f2f2e
commit ddac1dd579
4 changed files with 9 additions and 3 deletions

View File

@ -27,6 +27,7 @@ appUpdate="https://ankiweb.net/update/desktop"
appHelpSite=HELP_SITE appHelpSite=HELP_SITE
from aqt.main import AnkiQt from aqt.main import AnkiQt
from aqt.profiles import ProfileManager
mw: Optional[AnkiQt] = None # set on init mw: Optional[AnkiQt] = None # set on init
@ -130,7 +131,7 @@ dialogs = DialogManager()
_gtrans: Optional[Any] = None _gtrans: Optional[Any] = None
_qtrans: Optional[QTranslator] = None _qtrans: Optional[QTranslator] = None
def setupLang(pm, app, force=None): def setupLang(pm: ProfileManager, app: QApplication, force: Optional[str]=None) -> None:
global _gtrans, _qtrans global _gtrans, _qtrans
try: try:
locale.setlocale(locale.LC_ALL, '') locale.setlocale(locale.LC_ALL, '')
@ -303,7 +304,6 @@ def _run(argv=None, exec=True):
opts, args = parseArgs(argv) opts, args = parseArgs(argv)
# profile manager # profile manager
from aqt.profiles import ProfileManager
pm = ProfileManager(opts.base) pm = ProfileManager(opts.base)
pmLoadResult = pm.setupMeta() pmLoadResult = pm.setupMeta()

View File

@ -10,6 +10,7 @@ import unicodedata
from operator import itemgetter from operator import itemgetter
from typing import Callable, List, Dict, Optional from typing import Callable, List, Dict, Optional
from anki.collection import _Collection
from anki.lang import ngettext from anki.lang import ngettext
import json import json
@ -512,6 +513,9 @@ class SidebarModel(QAbstractItemModel):
# fixme: respond to reset+edit hooks # fixme: respond to reset+edit hooks
class Browser(QMainWindow): class Browser(QMainWindow):
model: DataModel
mw: AnkiQt
col: _Collection
def __init__(self, mw: AnkiQt): def __init__(self, mw: AnkiQt):
QMainWindow.__init__(self, None, Qt.Window) QMainWindow.__init__(self, None, Qt.Window)

View File

@ -1,6 +1,7 @@
# Copyright: Ankitects Pty Ltd and contributors # Copyright: Ankitects Pty Ltd and contributors
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from typing import Any
from aqt.qt import * from aqt.qt import *
from aqt.utils import askUser, getOnlyText, openLink, showWarning, shortcut, \ from aqt.utils import askUser, getOnlyText, openLink, showWarning, shortcut, \
@ -14,6 +15,7 @@ from copy import deepcopy
from anki.lang import _, ngettext from anki.lang import _, ngettext
class DeckBrowser: class DeckBrowser:
_dueTree: Any
def __init__(self, mw): def __init__(self, mw):
self.mw = mw self.mw = mw

View File

@ -426,7 +426,7 @@ def downArrow():
###################################################################### ######################################################################
_tooltipTimer: Optional[QTimer] = None _tooltipTimer: Optional[QTimer] = None
_tooltipLabel: Optional[str] = None _tooltipLabel: Optional[QLabel] = None
def tooltip(msg, period=3000, parent=None): def tooltip(msg, period=3000, parent=None):
global _tooltipTimer, _tooltipLabel global _tooltipTimer, _tooltipLabel