Daniel Brötzmann pushed to branch master at gajim / gajim
Commits: bf270763 by wurstsalat at 2024-08-05T23:04:28+02:00 fix: Notifications: Prevent loading of windows_toasts on unsupported Windows versions Fixes #11944 - - - - - 1 changed file: - gajim/gtk/notification.py Changes: ===================================== gajim/gtk/notification.py ===================================== @@ -57,7 +57,12 @@ from gajim.gtk.util import get_total_screen_geometry from gajim.gtk.util import load_icon_surface -if sys.platform == 'win32' or TYPE_CHECKING: +MIN_WINDOWS_TOASTS_WIN_VERSION = 10240 + +if ((sys.platform == 'win32' and + int(platform.version().split('.')[2]) >= MIN_WINDOWS_TOASTS_WIN_VERSION) or + TYPE_CHECKING): + # Importing windows_toasts on an unsupported Windows version will throw an Exception import winreg from windows_toasts import InteractableWindowsToaster @@ -68,7 +73,7 @@ from windows_toasts import ToastImage from windows_toasts import ToastImagePosition -MIN_WINDOWS_TOASTS_WIN_VERSION = 10240 + WINDOWS_TOAST_NOTIFIER_AUMID = 'Gajim.ToastNotification' log = logging.getLogger('gajim.gtk.notification') @@ -639,9 +644,9 @@ def _get_path_for_icon(surface: cairo.ImageSurface) -> Path: def get_notification_backend() -> NotificationBackend: if sys.platform == 'win32': - if int(platform.version().split('.')[2]) < MIN_WINDOWS_TOASTS_WIN_VERSION: - return WindowsLegacy() - return WindowsToastNotification() + if int(platform.version().split('.')[2]) >= MIN_WINDOWS_TOASTS_WIN_VERSION: + return WindowsToastNotification() + return WindowsLegacy() if sys.platform == 'darwin': return DummyBackend() View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/bf270763b64c79880e6c170b33643b85f575690e -- View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/bf270763b64c79880e6c170b33643b85f575690e You're receiving this email because of your account on dev.gajim.org.
_______________________________________________ Commits mailing list -- commits@gajim.org To unsubscribe send an email to commits-le...@gajim.org