Skip to content

Commit

Permalink
feature: try more modern toast lib
Browse files Browse the repository at this point in the history
Signed-off-by: Sylvain Leclerc <[email protected]>
  • Loading branch information
sylvlecl committed Sep 30, 2024
1 parent a067642 commit a0e1268
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions antarest/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion requirements-windows.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
win10toast
windows-toasts

0 comments on commit a0e1268

Please sign in to comment.