Add types for eventfilter/quitter
This commit is contained in:
parent
29e0127034
commit
9d4de0163a
12
mypy.ini
12
mypy.ini
|
|
@ -87,6 +87,14 @@ disallow_incomplete_defs = True
|
|||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.misc.backendproblem]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.misc.eventfilter]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.commands.cmdutils]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
|
@ -127,10 +135,6 @@ disallow_incomplete_defs = True
|
|||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.misc.backendproblem]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.mainwindow.statusbar.command]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ class EventFilter(QObject):
|
|||
QEvent.ShortcutOverride: self._handle_key_event,
|
||||
}
|
||||
|
||||
def install(self):
|
||||
def install(self) -> None:
|
||||
QApplication.instance().installEventFilter(self)
|
||||
|
||||
@pyqtSlot()
|
||||
def shutdown(self):
|
||||
def shutdown(self) -> None:
|
||||
QApplication.instance().removeEventFilter(self)
|
||||
|
||||
def _handle_key_event(self, event: QKeyEvent) -> bool:
|
||||
|
|
@ -105,7 +105,8 @@ class EventFilter(QObject):
|
|||
raise
|
||||
|
||||
|
||||
def init():
|
||||
def init() -> None:
|
||||
"""Initialize the global EventFilter instance."""
|
||||
event_filter = EventFilter(parent=QApplication.instance())
|
||||
event_filter.install()
|
||||
quitter.instance.shutting_down.connect(event_filter.shutdown)
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ class Quitter(QObject):
|
|||
# segfaults.
|
||||
QTimer.singleShot(0, functools.partial(self._shutdown_3, status))
|
||||
|
||||
def _shutdown_3(self, status):
|
||||
def _shutdown_3(self, status: int) -> None:
|
||||
"""Finally shut down the QApplication."""
|
||||
log.destroy.debug("Now calling QApplication::exit.")
|
||||
if 'debug-exit' in objects.debug_flags:
|
||||
|
|
|
|||
Loading…
Reference in New Issue