add type hinting to systray (avoid circular imports)

This commit is contained in:
deeplow 2022-07-21 15:55:25 +01:00
parent b34f7381b4
commit b1c039c4a4
No known key found for this signature in database
GPG key ID: 577982871529A52A

View file

@ -1,10 +1,23 @@
import platform import platform
from typing import TYPE_CHECKING
from PySide2 import QtWidgets from PySide2 import QtWidgets
from ..global_common import GlobalCommon
from .common import GuiCommon
if TYPE_CHECKING:
from . import ApplicationWrapper
class SysTray(QtWidgets.QSystemTrayIcon): class SysTray(QtWidgets.QSystemTrayIcon):
def __init__(self, global_common, gui_common, app, app_wrapper): def __init__(
self,
global_common: GlobalCommon,
gui_common: GuiCommon,
app: QtWidgets.QApplication,
app_wrapper: "ApplicationWrapper",
) -> None:
super(SysTray, self).__init__() super(SysTray, self).__init__()
self.global_common = global_common self.global_common = global_common
self.gui_common = gui_common self.gui_common = gui_common
@ -24,8 +37,8 @@ class SysTray(QtWidgets.QSystemTrayIcon):
self.setContextMenu(menu) self.setContextMenu(menu)
self.show() self.show()
def new_window(self): def new_window(self) -> None:
self.app_wrapper.new_window.emit() self.app_wrapper.new_window.emit()
def quit_clicked(self): def quit_clicked(self) -> None:
self.app.quit() self.app.quit()