|
@@ -4,19 +4,14 @@ from typing_extensions import Literal
|
|
|
|
|
|
from .. import globals, outbox
|
|
from .. import globals, outbox
|
|
|
|
|
|
-ARG_MAP = {
|
|
|
|
- 'close_button': 'closeBtn',
|
|
|
|
- 'multi_line': 'multiLine',
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
|
|
def notify(message: Any, *,
|
|
def notify(message: Any, *,
|
|
position: Literal['top-left', 'top-right', 'bottom-left', 'bottom-right', 'top', 'bottom', 'left', 'right', 'center'] = 'bottom',
|
|
position: Literal['top-left', 'top-right', 'bottom-left', 'bottom-right', 'top', 'bottom', 'left', 'right', 'center'] = 'bottom',
|
|
close_button: Union[bool, str] = False,
|
|
close_button: Union[bool, str] = False,
|
|
type: Optional[Literal['positive', 'negative', 'warning', 'info', 'ongoing']] = None,
|
|
type: Optional[Literal['positive', 'negative', 'warning', 'info', 'ongoing']] = None,
|
|
color: Optional[str] = None,
|
|
color: Optional[str] = None,
|
|
- multi_line: bool = False,
|
|
|
|
- **kwargs,
|
|
|
|
|
|
+ multi_line: Optional[bool] = False,
|
|
|
|
+ **_kwargs,
|
|
) -> None:
|
|
) -> None:
|
|
"""Notification
|
|
"""Notification
|
|
|
|
|
|
@@ -27,11 +22,18 @@ def notify(message: Any, *,
|
|
:param close_button: optional label of a button to dismiss the notification (default: `False`)
|
|
:param close_button: optional label of a button to dismiss the notification (default: `False`)
|
|
:param type: optional type ("positive", "negative", "warning", "info" or "ongoing")
|
|
:param type: optional type ("positive", "negative", "warning", "info" or "ongoing")
|
|
:param color: optional color name
|
|
:param color: optional color name
|
|
- :param multi_line: enable multi-line notifications
|
|
|
|
|
|
+ :param multi_line: optional boolean to enable multi-line notifications
|
|
|
|
|
|
Note: You can pass additional keyword arguments according to `Quasar's Notify API <https://quasar.dev/quasar-plugins/notify#notify-api>`_.
|
|
Note: You can pass additional keyword arguments according to `Quasar's Notify API <https://quasar.dev/quasar-plugins/notify#notify-api>`_.
|
|
"""
|
|
"""
|
|
- options = {ARG_MAP.get(key, key): value for key, value in locals().items() if key != 'kwargs' and value is not None}
|
|
|
|
|
|
+ _arg_map = {'close_button': 'closeBtn',
|
|
|
|
+ 'multi_line': 'multiLine',
|
|
|
|
+ }
|
|
|
|
+ options = {_arg_map.get(key, key): value
|
|
|
|
+ for key, value
|
|
|
|
+ in locals().items()
|
|
|
|
+ if not key.startswith('_') and value is not None
|
|
|
|
+ }
|
|
options['message'] = str(message)
|
|
options['message'] = str(message)
|
|
- options.update(kwargs)
|
|
|
|
|
|
+ options.update(_kwargs)
|
|
outbox.enqueue_message('notify', options, globals.get_client().id)
|
|
outbox.enqueue_message('notify', options, globals.get_client().id)
|