diff --git a/qt/aqt/__init__.py b/qt/aqt/__init__.py index bcf489fc5..1041b3e9b 100644 --- a/qt/aqt/__init__.py +++ b/qt/aqt/__init__.py @@ -291,7 +291,7 @@ class AnkiApp(QApplication): sys.stderr.write(sock.errorString()) return path = bytes(sock.readAll()).decode("utf8") - self.appMsg.emit(path) + self.appMsg.emit(path) # type: ignore sock.disconnectFromServer() # OS X file/url handler @@ -299,7 +299,7 @@ class AnkiApp(QApplication): def event(self, evt): if evt.type() == QEvent.FileOpen: - self.appMsg.emit(evt.file() or "raise") + self.appMsg.emit(evt.file() or "raise") # type: ignore return True return QApplication.event(self, evt) @@ -383,6 +383,9 @@ PROFILE_CODE = os.environ.get("ANKI_PROFILE_CODE") def write_profile_results(): + import cProfile + + profiler: cProfile.Profile profiler.disable() profiler.dump_stats("anki.prof") print("profile stats written to anki.prof") diff --git a/qt/aqt/qt.py b/qt/aqt/qt.py index 3ce6e2fca..43c42b17d 100644 --- a/qt/aqt/qt.py +++ b/qt/aqt/qt.py @@ -13,6 +13,7 @@ from PyQt5.Qt import * # type: ignore from PyQt5.QtCore import * from PyQt5.QtCore import pyqtRemoveInputHook # pylint: disable=no-name-in-module from PyQt5.QtGui import * # type: ignore +from PyQt5.QtNetwork import QLocalServer, QLocalSocket, QNetworkProxy from PyQt5.QtWebChannel import QWebChannel from PyQt5.QtWebEngineWidgets import * from PyQt5.QtWidgets import *