From a0e1268be61ab0f5fd4754a91c8a47a5b3826a9a Mon Sep 17 00:00:00 2001 From: Sylvain Leclerc Date: Mon, 30 Sep 2024 17:40:40 +0200 Subject: [PATCH] feature: try more modern toast lib Signed-off-by: Sylvain Leclerc --- antarest/gui.py | 20 +++++++++----------- requirements-windows.txt | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/antarest/gui.py b/antarest/gui.py index b291ed24b9..8d90b85e8f 100644 --- a/antarest/gui.py +++ b/antarest/gui.py @@ -19,12 +19,11 @@ from multiprocessing import Process from pathlib import Path from threading import Thread -from typing import Tuple import httpx import uvicorn from PyQt5.QtGui import QCursor, QIcon -from PyQt5.QtWidgets import QAction, QApplication, QMenu, QSystemTrayIcon +from PyQt5.QtWidgets import QApplication, QMenu, QSystemTrayIcon from antarest.core.utils.utils import get_local_path from antarest.main import fastapi_app, parse_arguments @@ -141,15 +140,14 @@ def wait_for_server_start() -> None: def notification_popup(message: str) -> None: if platform.system() == "Windows": # noinspection PyPackageRequirements - from win10toast import ToastNotifier # type: ignore - - toaster = ToastNotifier() - toaster.show_toast( - "AntaresWebServer", - message, - icon_path=RESOURCE_PATH / "webapp" / "favicon.ico", - threaded=True, - ) + from windows_toasts import Toast, ToastDisplayImage, WindowsToaster # type: ignore + + toaster = WindowsToaster("AntaresWebServer") + toast = Toast() + toast.text_fields = [message] + icon = ToastDisplayImage.fromPath(str(RESOURCE_PATH / "webapp" / "favicon.ico")) + toast.AddImage(icon) + toaster.show_toast(toast) else: from plyer import notification # type: ignore diff --git a/requirements-windows.txt b/requirements-windows.txt index c9500efdd2..d3a6d481d2 100644 --- a/requirements-windows.txt +++ b/requirements-windows.txt @@ -1 +1 @@ -win10toast +windows-toasts