desktop-notifier 6.0.0__tar.gz → 6.0.0.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {desktop_notifier-6.0.0/src/desktop_notifier.egg-info → desktop_notifier-6.0.0.dev0}/PKG-INFO +2 -2
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/pyproject.toml +2 -2
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/__init__.py +1 -1
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/base.py +2 -2
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/dbus.py +6 -9
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/macos.py +2 -2
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/winrt.py +51 -61
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/main.py +20 -1
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0/src/desktop_notifier.egg-info}/PKG-INFO +2 -2
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier.egg-info/SOURCES.txt +0 -1
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier.egg-info/requires.txt +1 -1
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/tests/test_api.py +4 -14
- desktop_notifier-6.0.0/tests/test_callbacks.py +0 -186
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/LICENSE +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/README.md +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/setup.cfg +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/__init__.py +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/dummy.py +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/macos_support.py +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/common.py +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/py.typed +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/resources/__init__.py +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/resources/python.png +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/sync.py +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier.egg-info/dependency_links.txt +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier.egg-info/top_level.txt +0 -0
- {desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/tests/test_sync_api.py +0 -0
{desktop_notifier-6.0.0/src/desktop_notifier.egg-info → desktop_notifier-6.0.0.dev0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: desktop-notifier
|
|
3
|
-
Version: 6.0.0
|
|
3
|
+
Version: 6.0.0.dev0
|
|
4
4
|
Summary: Python library for cross-platform desktop notifications
|
|
5
5
|
Author-email: Sam Schott <sam.schott@outlook.com>
|
|
6
6
|
License: MIT
|
|
@@ -31,7 +31,7 @@ Description-Content-Type: text/markdown
|
|
|
31
31
|
License-File: LICENSE
|
|
32
32
|
Requires-Dist: bidict
|
|
33
33
|
Requires-Dist: packaging
|
|
34
|
-
Requires-Dist: dbus-
|
|
34
|
+
Requires-Dist: dbus-next; sys_platform == "linux"
|
|
35
35
|
Requires-Dist: rubicon-objc; sys_platform == "darwin"
|
|
36
36
|
Requires-Dist: winrt-windows.applicationmodel.core; sys_platform == "win32"
|
|
37
37
|
Requires-Dist: winrt-windows.data.xml.dom; sys_platform == "win32"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "desktop-notifier"
|
|
7
|
-
version = "6.0.0"
|
|
7
|
+
version = "6.0.0.dev0"
|
|
8
8
|
authors = [{name = "Sam Schott", email = "sam.schott@outlook.com"}]
|
|
9
9
|
license = {text = "MIT"}
|
|
10
10
|
description = "Python library for cross-platform desktop notifications"
|
|
@@ -41,7 +41,7 @@ requires-python = ">=3.7"
|
|
|
41
41
|
dependencies = [
|
|
42
42
|
"bidict",
|
|
43
43
|
"packaging",
|
|
44
|
-
"dbus-
|
|
44
|
+
"dbus-next;sys_platform=='linux'",
|
|
45
45
|
"rubicon-objc;sys_platform=='darwin'",
|
|
46
46
|
"winrt-windows.applicationmodel.core;sys_platform=='win32'",
|
|
47
47
|
"winrt-windows.data.xml.dom;sys_platform=='win32'",
|
{desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/base.py
RENAMED
|
@@ -67,12 +67,12 @@ class DesktopNotifierBackend(ABC):
|
|
|
67
67
|
logger.debug("Notification sent: %s", notification)
|
|
68
68
|
self._notification_cache[notification.identifier] = notification
|
|
69
69
|
|
|
70
|
-
def _clear_notification_from_cache(self, identifier: str) ->
|
|
70
|
+
def _clear_notification_from_cache(self, identifier: str) -> None:
|
|
71
71
|
"""
|
|
72
72
|
Removes the notification from our cache. Should be called by backends when the
|
|
73
73
|
notification is closed.
|
|
74
74
|
"""
|
|
75
|
-
|
|
75
|
+
self._notification_cache.pop(identifier, None)
|
|
76
76
|
|
|
77
77
|
@abstractmethod
|
|
78
78
|
async def _send(self, notification: Notification) -> None:
|
{desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/dbus.py
RENAMED
|
@@ -11,10 +11,10 @@ import logging
|
|
|
11
11
|
from typing import TypeVar
|
|
12
12
|
|
|
13
13
|
from bidict import bidict
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
14
|
+
from dbus_next.aio.message_bus import MessageBus
|
|
15
|
+
from dbus_next.aio.proxy_object import ProxyInterface
|
|
16
|
+
from dbus_next.errors import DBusError
|
|
17
|
+
from dbus_next.signature import Variant
|
|
18
18
|
|
|
19
19
|
from ..common import Capability, Notification, Urgency
|
|
20
20
|
from .base import DesktopNotifierBackend
|
|
@@ -222,7 +222,7 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
222
222
|
ourselves when scheduling the notification.
|
|
223
223
|
"""
|
|
224
224
|
identifier = self._platform_to_interface_notification_identifier.pop(nid, "")
|
|
225
|
-
notification = self.
|
|
225
|
+
notification = self._notification_cache.pop(identifier, None)
|
|
226
226
|
|
|
227
227
|
if not notification:
|
|
228
228
|
return
|
|
@@ -242,10 +242,7 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
242
242
|
:param reason: An integer describing the reason why the notification was closed.
|
|
243
243
|
"""
|
|
244
244
|
identifier = self._platform_to_interface_notification_identifier.pop(nid, "")
|
|
245
|
-
notification = self.
|
|
246
|
-
|
|
247
|
-
if not notification:
|
|
248
|
-
return
|
|
245
|
+
notification = self._notification_cache.pop(identifier, None)
|
|
249
246
|
|
|
250
247
|
if reason == NOTIFICATION_CLOSED_DISMISSED:
|
|
251
248
|
self.handle_dismissed(identifier, notification)
|
{desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/macos.py
RENAMED
|
@@ -93,7 +93,7 @@ class NotificationCenterDelegate(NSObject): # type:ignore
|
|
|
93
93
|
self, center, response, completion_handler: objc_block
|
|
94
94
|
) -> None:
|
|
95
95
|
identifier = py_from_ns(response.notification.request.identifier)
|
|
96
|
-
notification = self.implementation.
|
|
96
|
+
notification = self.implementation._notification_cache.pop(identifier, None)
|
|
97
97
|
|
|
98
98
|
if response.actionIdentifier == UNNotificationDefaultActionIdentifier:
|
|
99
99
|
self.implementation.handle_clicked(identifier, notification)
|
|
@@ -107,7 +107,7 @@ class NotificationCenterDelegate(NSObject): # type:ignore
|
|
|
107
107
|
|
|
108
108
|
else:
|
|
109
109
|
action_id = py_from_ns(response.actionIdentifier)
|
|
110
|
-
self.implementation.
|
|
110
|
+
self.implementation.handle_replied(identifier, action_id, notification)
|
|
111
111
|
|
|
112
112
|
completion_handler()
|
|
113
113
|
|
{desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/winrt.py
RENAMED
|
@@ -213,69 +213,59 @@ class WinRTDesktopNotifier(DesktopNotifierBackend):
|
|
|
213
213
|
native.tag = notification.identifier
|
|
214
214
|
native.priority = self._to_native_urgency[notification.urgency]
|
|
215
215
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
216
|
+
def on_activated(
|
|
217
|
+
sender: ToastNotification | None, boxed_activated_args: WinRTObject | None
|
|
218
|
+
) -> None:
|
|
219
|
+
if not sender or not boxed_activated_args:
|
|
220
|
+
return
|
|
221
|
+
|
|
222
|
+
try:
|
|
223
|
+
activated_args = ToastActivatedEventArgs._from(boxed_activated_args)
|
|
224
|
+
except Exception:
|
|
225
|
+
return
|
|
226
|
+
|
|
227
|
+
action_id = activated_args.arguments
|
|
228
|
+
|
|
229
|
+
if action_id == DEFAULT_ACTION:
|
|
230
|
+
self.handle_clicked(notification.identifier, notification)
|
|
231
|
+
|
|
232
|
+
elif action_id == REPLY_ACTION and activated_args.user_input:
|
|
233
|
+
boxed_reply = activated_args.user_input[REPLY_TEXTBOX_NAME]
|
|
234
|
+
reply = unbox(boxed_reply)
|
|
235
|
+
self.handle_replied(notification.identifier, reply, notification)
|
|
236
|
+
|
|
237
|
+
elif action_id.startswith(BUTTON_ACTION_PREFIX):
|
|
238
|
+
button_id = action_id.replace(BUTTON_ACTION_PREFIX, "")
|
|
239
|
+
self.handle_button(notification.identifier, button_id, notification)
|
|
240
|
+
|
|
241
|
+
def on_dismissed(
|
|
242
|
+
sender: ToastNotification | None,
|
|
243
|
+
dismissed_args: ToastDismissedEventArgs | None,
|
|
244
|
+
) -> None:
|
|
245
|
+
self._clear_notification_from_cache(notification.identifier)
|
|
246
|
+
|
|
247
|
+
if (
|
|
248
|
+
dismissed_args
|
|
249
|
+
and dismissed_args.reason == ToastDismissalReason.USER_CANCELED
|
|
250
|
+
):
|
|
251
|
+
self.handle_dismissed(notification.identifier, notification)
|
|
252
|
+
|
|
253
|
+
def on_failed(
|
|
254
|
+
sender: ToastNotification | None, failed_args: ToastFailedEventArgs | None
|
|
255
|
+
) -> None:
|
|
256
|
+
if failed_args:
|
|
257
|
+
logger.warning(
|
|
258
|
+
"Notification failed with error code %s",
|
|
259
|
+
failed_args.error_code.value,
|
|
260
|
+
)
|
|
261
|
+
else:
|
|
262
|
+
logger.warning("Notification failed with unknown error")
|
|
257
263
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
):
|
|
262
|
-
self.handle_dismissed(sender.tag, notification)
|
|
264
|
+
native.add_activated(on_activated)
|
|
265
|
+
native.add_dismissed(on_dismissed)
|
|
266
|
+
native.add_failed(on_failed)
|
|
263
267
|
|
|
264
|
-
|
|
265
|
-
self, sender: ToastNotification | None, failed_args: ToastFailedEventArgs | None
|
|
266
|
-
) -> None:
|
|
267
|
-
if not sender:
|
|
268
|
-
return
|
|
269
|
-
|
|
270
|
-
self._clear_notification_from_cache(sender.tag)
|
|
271
|
-
if failed_args:
|
|
272
|
-
logger.warning(
|
|
273
|
-
"Notification '%s' failed with error code %s",
|
|
274
|
-
sender.tag,
|
|
275
|
-
failed_args.error_code.value,
|
|
276
|
-
)
|
|
277
|
-
else:
|
|
278
|
-
logger.warning("Notification '%s' failed with unknown error", sender.tag)
|
|
268
|
+
self.notifier.show(native)
|
|
279
269
|
|
|
280
270
|
async def _clear(self, identifier: str) -> None:
|
|
281
271
|
"""
|
|
@@ -134,9 +134,28 @@ class DesktopNotifier:
|
|
|
134
134
|
def __init__(
|
|
135
135
|
self,
|
|
136
136
|
app_name: str = "Python",
|
|
137
|
-
app_icon: Icon | None = DEFAULT_ICON,
|
|
137
|
+
app_icon: Icon | Path | str | None = DEFAULT_ICON,
|
|
138
138
|
notification_limit: int | None = None,
|
|
139
139
|
) -> None:
|
|
140
|
+
if isinstance(app_icon, str):
|
|
141
|
+
warnings.warn(
|
|
142
|
+
message="Pass an Icon instance instead of a string. "
|
|
143
|
+
"Support for string input will be removed in a future release.",
|
|
144
|
+
category=DeprecationWarning,
|
|
145
|
+
)
|
|
146
|
+
if parse.urlparse(app_icon).hostname != "":
|
|
147
|
+
app_icon = Icon(uri=app_icon)
|
|
148
|
+
else:
|
|
149
|
+
app_icon = Icon(name=app_icon)
|
|
150
|
+
|
|
151
|
+
if isinstance(app_icon, Path):
|
|
152
|
+
warnings.warn(
|
|
153
|
+
message="Pass an Icon instance instead of a Path. "
|
|
154
|
+
"Support for string input will be removed in a future release.",
|
|
155
|
+
category=DeprecationWarning,
|
|
156
|
+
)
|
|
157
|
+
app_icon = Icon(path=app_icon)
|
|
158
|
+
|
|
140
159
|
if notification_limit is not None:
|
|
141
160
|
warnings.warn(
|
|
142
161
|
message="Notification limits have been deprecated and no longer have an effect",
|
{desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0/src/desktop_notifier.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: desktop-notifier
|
|
3
|
-
Version: 6.0.0
|
|
3
|
+
Version: 6.0.0.dev0
|
|
4
4
|
Summary: Python library for cross-platform desktop notifications
|
|
5
5
|
Author-email: Sam Schott <sam.schott@outlook.com>
|
|
6
6
|
License: MIT
|
|
@@ -31,7 +31,7 @@ Description-Content-Type: text/markdown
|
|
|
31
31
|
License-File: LICENSE
|
|
32
32
|
Requires-Dist: bidict
|
|
33
33
|
Requires-Dist: packaging
|
|
34
|
-
Requires-Dist: dbus-
|
|
34
|
+
Requires-Dist: dbus-next; sys_platform == "linux"
|
|
35
35
|
Requires-Dist: rubicon-objc; sys_platform == "darwin"
|
|
36
36
|
Requires-Dist: winrt-windows.applicationmodel.core; sys_platform == "win32"
|
|
37
37
|
Requires-Dist: winrt-windows.data.xml.dom; sys_platform == "win32"
|
|
@@ -14,19 +14,6 @@ from desktop_notifier import (
|
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
@pytest.mark.asyncio
|
|
18
|
-
async def test_request_authorisation(notifier):
|
|
19
|
-
"""
|
|
20
|
-
Authorization should already be grated when setting up the test environment.
|
|
21
|
-
Check that calling request_authorisation returns true.
|
|
22
|
-
"""
|
|
23
|
-
if not await notifier.has_authorisation():
|
|
24
|
-
pytest.skip("Not authorised and we cannot request authorisation in test")
|
|
25
|
-
|
|
26
|
-
has_authorisation = await notifier.request_authorisation()
|
|
27
|
-
assert has_authorisation
|
|
28
|
-
|
|
29
|
-
|
|
30
17
|
@pytest.mark.asyncio
|
|
31
18
|
async def test_send(notifier):
|
|
32
19
|
notification = await notifier.send(
|
|
@@ -34,7 +21,10 @@ async def test_send(notifier):
|
|
|
34
21
|
message="Et tu, Brute?",
|
|
35
22
|
urgency=Urgency.Critical,
|
|
36
23
|
buttons=[
|
|
37
|
-
Button(
|
|
24
|
+
Button(
|
|
25
|
+
title="Mark as read",
|
|
26
|
+
on_pressed=lambda: print("Marked as read"),
|
|
27
|
+
)
|
|
38
28
|
],
|
|
39
29
|
reply_field=ReplyField(
|
|
40
30
|
title="Reply",
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import platform
|
|
2
|
-
from unittest.mock import Mock
|
|
3
|
-
|
|
4
|
-
import pytest
|
|
5
|
-
|
|
6
|
-
from desktop_notifier import (
|
|
7
|
-
Button,
|
|
8
|
-
Capability,
|
|
9
|
-
DesktopNotifier,
|
|
10
|
-
Notification,
|
|
11
|
-
ReplyField,
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
from .backends import (
|
|
15
|
-
simulate_button_pressed,
|
|
16
|
-
simulate_clicked,
|
|
17
|
-
simulate_dismissed,
|
|
18
|
-
simulate_replied,
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
if platform.system() == "Windows":
|
|
22
|
-
pytest.skip("Windows test infra missing", allow_module_level=True)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
async def check_supported(notifier: DesktopNotifier, capability: Capability) -> None:
|
|
26
|
-
capabilities = await notifier.get_capabilities()
|
|
27
|
-
if capability not in capabilities:
|
|
28
|
-
pytest.skip(f"{notifier} not supported by backend")
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
@pytest.mark.asyncio
|
|
32
|
-
async def test_clicked_callback_called(notifier):
|
|
33
|
-
await check_supported(notifier, Capability.ON_CLICKED)
|
|
34
|
-
|
|
35
|
-
notifier.on_clicked = Mock()
|
|
36
|
-
notification = Notification(
|
|
37
|
-
title="Julius Caesar",
|
|
38
|
-
message="Et tu, Brute?",
|
|
39
|
-
on_clicked=Mock(),
|
|
40
|
-
)
|
|
41
|
-
identifier = await notifier.send_notification(notification)
|
|
42
|
-
|
|
43
|
-
simulate_clicked(notifier, identifier)
|
|
44
|
-
|
|
45
|
-
notifier.on_clicked.assert_not_called()
|
|
46
|
-
notification.on_clicked.assert_called_once()
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
@pytest.mark.asyncio
|
|
50
|
-
async def test_clicked_callback_dismissed_not_called(notifier):
|
|
51
|
-
"""
|
|
52
|
-
Dbus may send an on_dismissed event any time a notification is closed. Ensure that
|
|
53
|
-
its callback is not tiggered on different types of interactions.
|
|
54
|
-
"""
|
|
55
|
-
await check_supported(notifier, Capability.ON_CLICKED)
|
|
56
|
-
|
|
57
|
-
notification = Notification(
|
|
58
|
-
title="Julius Caesar",
|
|
59
|
-
message="Et tu, Brute?",
|
|
60
|
-
on_clicked=Mock(),
|
|
61
|
-
on_dismissed=Mock(),
|
|
62
|
-
)
|
|
63
|
-
identifier = await notifier.send_notification(notification)
|
|
64
|
-
|
|
65
|
-
simulate_clicked(notifier, identifier)
|
|
66
|
-
|
|
67
|
-
notification.on_dismissed.assert_not_called()
|
|
68
|
-
notification.on_clicked.assert_called_once()
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
@pytest.mark.asyncio
|
|
72
|
-
async def test_dismissed_callback_called(notifier):
|
|
73
|
-
await check_supported(notifier, Capability.ON_DISMISSED)
|
|
74
|
-
|
|
75
|
-
notifier.on_dismissed = Mock()
|
|
76
|
-
notification = Notification(
|
|
77
|
-
title="Julius Caesar",
|
|
78
|
-
message="Et tu, Brute?",
|
|
79
|
-
on_dismissed=Mock(),
|
|
80
|
-
)
|
|
81
|
-
identifier = await notifier.send_notification(notification)
|
|
82
|
-
|
|
83
|
-
simulate_dismissed(notifier, identifier)
|
|
84
|
-
|
|
85
|
-
notifier.on_dismissed.assert_not_called()
|
|
86
|
-
notification.on_dismissed.assert_called_once()
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
@pytest.mark.asyncio
|
|
90
|
-
async def test_button_pressed_callback_called(notifier):
|
|
91
|
-
await check_supported(notifier, Capability.BUTTONS)
|
|
92
|
-
|
|
93
|
-
notifier.on_button_pressed = Mock()
|
|
94
|
-
button1 = Button(title="Button 1", on_pressed=Mock())
|
|
95
|
-
button2 = Button(title="Button 2", on_pressed=Mock())
|
|
96
|
-
notification = Notification(
|
|
97
|
-
title="Julius Caesar",
|
|
98
|
-
message="Et tu, Brute?",
|
|
99
|
-
buttons=[button1, button2],
|
|
100
|
-
)
|
|
101
|
-
identifier = await notifier.send_notification(notification)
|
|
102
|
-
|
|
103
|
-
simulate_button_pressed(notifier, identifier, button2.identifier)
|
|
104
|
-
|
|
105
|
-
notifier.on_button_pressed.assert_not_called()
|
|
106
|
-
button2.on_pressed.assert_called_once()
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
@pytest.mark.asyncio
|
|
110
|
-
async def test_replied_callback_called(notifier):
|
|
111
|
-
await check_supported(notifier, Capability.REPLY_FIELD)
|
|
112
|
-
|
|
113
|
-
notifier.on_replied = Mock()
|
|
114
|
-
notification = Notification(
|
|
115
|
-
title="Julius Caesar",
|
|
116
|
-
message="Et tu, Brute?",
|
|
117
|
-
reply_field=ReplyField(on_replied=Mock()),
|
|
118
|
-
)
|
|
119
|
-
identifier = await notifier.send_notification(notification)
|
|
120
|
-
|
|
121
|
-
simulate_replied(notifier, identifier, "A notification response")
|
|
122
|
-
|
|
123
|
-
notifier.on_replied.assert_not_called()
|
|
124
|
-
notification.reply_field.on_replied.assert_called_with("A notification response")
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
@pytest.mark.asyncio
|
|
128
|
-
async def test_clicked_fallback_handler_called(notifier):
|
|
129
|
-
await check_supported(notifier, Capability.ON_CLICKED)
|
|
130
|
-
|
|
131
|
-
notifier.on_clicked = Mock()
|
|
132
|
-
notification = Notification(title="Julius Caesar", message="Et tu, Brute?")
|
|
133
|
-
identifier = await notifier.send_notification(notification)
|
|
134
|
-
|
|
135
|
-
simulate_clicked(notifier, identifier)
|
|
136
|
-
|
|
137
|
-
notifier.on_clicked.assert_called_with(identifier)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
@pytest.mark.asyncio
|
|
141
|
-
async def test_dismissed_fallback_handler_called(notifier):
|
|
142
|
-
await check_supported(notifier, Capability.ON_DISMISSED)
|
|
143
|
-
|
|
144
|
-
notifier.on_dismissed = Mock()
|
|
145
|
-
notification = Notification(title="Julius Caesar", message="Et tu, Brute?")
|
|
146
|
-
identifier = await notifier.send_notification(notification)
|
|
147
|
-
|
|
148
|
-
simulate_dismissed(notifier, identifier)
|
|
149
|
-
|
|
150
|
-
notifier.on_dismissed.assert_called_with(identifier)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
@pytest.mark.asyncio
|
|
154
|
-
async def test_button_pressed_fallback_handler_called(notifier):
|
|
155
|
-
await check_supported(notifier, Capability.BUTTONS)
|
|
156
|
-
|
|
157
|
-
notifier.on_button_pressed = Mock()
|
|
158
|
-
button1 = Button(title="Button 1")
|
|
159
|
-
button2 = Button(title="Button 2")
|
|
160
|
-
notification = Notification(
|
|
161
|
-
title="Julius Caesar",
|
|
162
|
-
message="Et tu, Brute?",
|
|
163
|
-
buttons=[button1, button2],
|
|
164
|
-
)
|
|
165
|
-
identifier = await notifier.send_notification(notification)
|
|
166
|
-
|
|
167
|
-
simulate_button_pressed(notifier, identifier, button2.identifier)
|
|
168
|
-
|
|
169
|
-
notifier.on_button_pressed.assert_called_with(identifier, button2.identifier)
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
@pytest.mark.asyncio
|
|
173
|
-
async def test_replied_fallback_handler_called(notifier):
|
|
174
|
-
await check_supported(notifier, Capability.REPLY_FIELD)
|
|
175
|
-
|
|
176
|
-
notifier.on_replied = Mock()
|
|
177
|
-
notification = Notification(
|
|
178
|
-
title="Julius Caesar",
|
|
179
|
-
message="Et tu, Brute?",
|
|
180
|
-
reply_field=ReplyField(),
|
|
181
|
-
)
|
|
182
|
-
identifier = await notifier.send_notification(notification)
|
|
183
|
-
|
|
184
|
-
simulate_replied(notifier, identifier, "A notification response")
|
|
185
|
-
|
|
186
|
-
notifier.on_replied.assert_called_with(identifier, "A notification response")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/__init__.py
RENAMED
|
File without changes
|
{desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/backends/dummy.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/resources/__init__.py
RENAMED
|
File without changes
|
{desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier/resources/python.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{desktop_notifier-6.0.0 → desktop_notifier-6.0.0.dev0}/src/desktop_notifier.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|