fix: resolve Pyright type errors

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
2025-06-15 22:51:50 +05:00
parent 56b105d7b4
commit b77609cb5f
2 changed files with 11 additions and 11 deletions

View File

@ -29,12 +29,10 @@ def main():
else:
logger.error(f"Qt translations for {system_locale.name()} not found in {translations_path}")
# Парсинг аргументов командной строки
args = parse_args()
window = MainWindow()
# Обработка флага --fullscreen
if args.fullscreen:
logger.info("Launching in fullscreen mode due to --fullscreen flag")
save_fullscreen_config(True)
@ -53,18 +51,19 @@ def main():
tray = None
current_theme = read_theme_from_config()
tray = SystemTray(app, current_theme)
tray.show_action.triggered.connect(window.show)
tray.hide_action.triggered.connect(window.hide)
# Ensure window is not None before connecting signals
if window:
tray.show_action.triggered.connect(window.show)
tray.hide_action.triggered.connect(window.hide)
def cleanup_on_exit():
nonlocal tray, window
app.aboutToQuit.disconnect() # Disconnect to prevent further calls
app.aboutToQuit.disconnect()
if tray:
tray.cleanup()
tray = None
if window:
window.close()
window = None
app.quit()
window.settings_saved.connect(recreate_tray)

View File

@ -35,14 +35,15 @@ class SystemTray:
"""Скрыть иконку трея"""
if self.tray:
self.tray.setVisible(False)
self.tray.setContextMenu(None)
if self.menu:
self.menu.deleteLater()
self.menu = None
def cleanup(self):
"""Очистка ресурсов трея"""
self.hide_tray()
if self.tray:
self.tray.setVisible(False)
self.tray = None
if self.menu:
self.menu.deleteLater()
self.menu = None
if self.tray:
self.tray.deleteLater()
self.tray = None