typing fixes

This commit is contained in:
Damien Elmes 2019-12-20 10:21:20 +10:00
parent 85c3ca1c39
commit da9426177d
2 changed files with 4 additions and 4 deletions

View File

@ -486,10 +486,11 @@ class SidebarModel(QAbstractItemModel):
self._expandWhereNeccessary(idx, tree)
def _expandWhereNeccessary(self, parent: QModelIndex, tree: QTreeView) -> None:
parentItem: SidebarItem
if not parent.isValid():
parentItem = self.root
else:
parentItem: SidebarItem = parent.internalPointer()
parentItem = parent.internalPointer()
# nothing to do?
if not parentItem.expanded:
@ -972,7 +973,7 @@ by clicking on one on the left."""))
self.sidebarTree.setUniformRowHeights(True)
self.sidebarTree.setHeaderHidden(True)
self.sidebarTree.setIndentation(15)
self.sidebarTree.expanded.connect(self.onSidebarItemExpanded)
self.sidebarTree.expanded.connect(self.onSidebarItemExpanded) # type: ignore
dw.setWidget(self.sidebarTree)
p = QPalette()
p.setColor(QPalette.Base, p.window().color())

View File

@ -13,7 +13,6 @@ from threading import Thread
from typing import Optional
from send2trash import send2trash
from anki.collection import _Collection
from aqt.profiles import ProfileManager
from aqt.qt import *
from anki.storage import Collection
from anki.utils import isWin, isMac, intTime, splitFields, ids2str, \
@ -34,7 +33,7 @@ from aqt.qt import sip
from anki.lang import _, ngettext
class AnkiQt(QMainWindow):
def __init__(self, app: QApplication, profileManager: ProfileManager, opts, args):
def __init__(self, app: QApplication, profileManager, opts, args):
QMainWindow.__init__(self)
self.state = "startup"
self.opts = opts