aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/win32_toast.py
diff options
context:
space:
mode:
authorbors-servo <infra@servo.org>2023-04-13 10:02:35 +0200
committerGitHub <noreply@github.com>2023-04-13 10:02:35 +0200
commit15f966bde5985d02b4a35b1078d44a3023dcf382 (patch)
treeae3aeaba1d7576c63da0f569ba251747fb62bcb2 /python/servo/win32_toast.py
parent7ab48556b04e327939df8a066de10de68cdd4bd5 (diff)
parent492091e5b0cfbee3d4e988d699bd910e2cd806fa (diff)
downloadservo-15f966bde5985d02b4a35b1078d44a3023dcf382.tar.gz
servo-15f966bde5985d02b4a35b1078d44a3023dcf382.zip
Auto merge of #29610 - mrobinson:notify, r=mukilan
Use notify-py to send notifications - Use notify-py to send notifications, but use a custom notifier on Linux since transient (ie non-sticky) notifications are not supported. - Add an icon to the notification. - Don't send a notification after doing `./mach check` because that can trigger notifications when `rust-analyzer` is working. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because they just change build notifications. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'python/servo/win32_toast.py')
-rw-r--r--python/servo/win32_toast.py45
1 files changed, 0 insertions, 45 deletions
diff --git a/python/servo/win32_toast.py b/python/servo/win32_toast.py
deleted file mode 100644
index 22a7ccd917f..00000000000
--- a/python/servo/win32_toast.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-from win32api import GetModuleHandle
-from win32gui import WNDCLASS, RegisterClass, CreateWindow, UpdateWindow
-from win32gui import DestroyWindow, LoadIcon, NIF_ICON, NIF_MESSAGE, NIF_TIP
-from win32gui import Shell_NotifyIcon, NIM_ADD, NIM_MODIFY, NIF_INFO, NIIF_INFO
-import win32con
-
-
-class WindowsToast:
- def __init__(self):
- # Register window class; it's okay to do this multiple times
- wc = WNDCLASS()
- wc.lpszClassName = 'ServoTaskbarNotification'
- wc.lpfnWndProc = {win32con.WM_DESTROY: self.OnDestroy, }
- self.classAtom = RegisterClass(wc)
- self.hinst = wc.hInstance = GetModuleHandle(None)
-
- def OnDestroy(self, hwnd, msg, wparam, lparam):
- # We don't have to Shell_NotifyIcon to delete it, since
- # we destroyed
- pass
-
- def balloon_tip(self, title, msg):
- style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
- hwnd = CreateWindow(self.classAtom, "Taskbar", style, 0, 0,
- win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT,
- 0, 0, self.hinst, None)
- UpdateWindow(hwnd)
-
- hicon = LoadIcon(0, win32con.IDI_APPLICATION)
-
- nid = (hwnd, 0, NIF_ICON | NIF_MESSAGE | NIF_TIP, win32con.WM_USER + 20, hicon, 'Tooltip')
- Shell_NotifyIcon(NIM_ADD, nid)
- nid = (hwnd, 0, NIF_INFO, win32con.WM_USER + 20, hicon, 'Balloon Tooltip', msg, 200, title, NIIF_INFO)
- Shell_NotifyIcon(NIM_MODIFY, nid)
-
- DestroyWindow(hwnd)