Skip to content

notification

dev_tool.services.notification

__all__ = ['NotificationDisplay', 'NotificationFormat', 'NotificationManager', 'NotificationService', 'NotificationType'] module-attribute

NotificationDisplay

A display class for rendering notifications in the terminal.

This class handles the formatting and styling of notifications for display in both banner and text formats with terminal color support.

The constructor for the NotificationDisplay class.

Parameters:

  • terminal (Terminal | None, default: None ) –

    The blessed Terminal instance for display operations.

  • theme (Default | None, default: None ) –

    The theme instance for styling notifications.

Source code in dev_tool/services/notification/display.py
def __init__(self, terminal: Terminal | None = None, theme: Default | None = None) -> None:
    """
    The constructor for the NotificationDisplay class.

    :param terminal: The blessed Terminal instance for display operations.
    :param theme: The theme instance for styling notifications.
    """

    self.notification = NotificationService()
    self.terminal = terminal or Terminal()
    self.theme = theme or Default(self.terminal)

notification = NotificationService() instance-attribute

terminal = terminal or Terminal() instance-attribute

theme = theme or Default(self.terminal) instance-attribute

display_active

A method that displays all active notifications in command mode.

Parameters:

Source code in dev_tool/services/notification/display.py
def display_active(self, service: NotificationService) -> None:
    """
    A method that displays all active notifications in command mode.

    :param service: The notification service to get active notifications from.
    """

    notifications = service.get_active()

    if notifications:
        print(self.terminal.clear_eos, end='', flush=True)  # noqa: T201

        for notification in notifications:
            banner = self.format_notification_banner(notification)
            print(banner)  # noqa: T201

display_new_notifications

A method that displays any new notifications that haven't been shown yet.

Parameters:

  • service (NotificationService) –

    The notification service to get active notifications from.

  • displayed (set) –

    Set of already displayed notification keys.

Source code in dev_tool/services/notification/display.py
def display_new_notifications(self, service: NotificationService, displayed: set) -> None:
    """
    A method that displays any new notifications that haven't been shown yet.

    :param service: The notification service to get active notifications from.
    :param displayed: Set of already displayed notification keys.
    """

    for notification in service.get_active():
        key = (notification.message, notification.timestamp)

        if key not in displayed:
            banner = self.format_notification_banner(notification)
            print(banner, flush=True)  # noqa: T201
            displayed.add(key)

format_notification_banner

A method that formats a notification for banner display.

Parameters:

  • notification (Notification) –

    The notification object to format.

Returns:

  • str

    The formatted notification banner string.

Source code in dev_tool/services/notification/display.py
def format_notification_banner(self, notification: Notification) -> str:
    """
    A method that formats a notification for banner display.

    :param notification: The notification object to format.
    :return: The formatted notification banner string.
    """

    if notification.notification_format == NotificationFormat.BANNER:
        return self._format_banner_style(notification)

    return self._format_text_style(notification)

get_notification_lines

A method that gets formatted notification lines for display.

Returns:

  • list[str]

    A list of formatted notification line strings.

Source code in dev_tool/services/notification/display.py
def get_notification_lines(self) -> list[str]:
    """
    A method that gets formatted notification lines for display.

    :return: A list of formatted notification line strings.
    """

    lines = []

    for notification in self.notification.get_active():
        if notification.persistent:
            dismiss = '[Press x to dismiss]'
        else:
            remaining = int(notification.remaining_time)
            dismiss = f'[Press x to dismiss] [{remaining}s]'

        if notification.notification_format == NotificationFormat.BANNER:
            line = self._format_notification_line(
                notification.notification_type,
                notification.message,
                dismiss,
                notification.show_prefix
            )
        else:
            line = self._format_text_notification_line(
                notification.notification_type,
                notification.message,
                dismiss,
                notification.show_prefix
            )

        lines.append(line)

    return lines

has_active_notifications

A method that checks if there are any active notifications.

Returns:

  • bool

    True if there are active notifications, False otherwise.

Source code in dev_tool/services/notification/display.py
def has_active_notifications(self) -> bool:
    """
    A method that checks if there are any active notifications.

    :return: True if there are active notifications, False otherwise.
    """

    active = self.notification.get_active()
    return len(active) > 0

NotificationFormat

Bases: StrEnum

BANNER = 'banner' class-attribute instance-attribute

TEXT = 'text' class-attribute instance-attribute

NotificationType

Bases: StrEnum

NORMAL = 'normal' class-attribute instance-attribute

INFO = 'info' class-attribute instance-attribute

WARNING = 'warning' class-attribute instance-attribute

ERROR = 'error' class-attribute instance-attribute

SUCCESS = 'success' class-attribute instance-attribute

NotificationManager

A manager class that coordinates between notification service and display.

This class orchestrates notification monitoring, display, and lifecycle without mixing the concerns of data management and presentation.

The constructor for the NotificationManager class.

Parameters:

Source code in dev_tool/services/notification/manager.py
def __init__(self, display: NotificationDisplay, service: NotificationService) -> None:
    """
    The constructor for the NotificationManager class.

    :param display: The notification display instance for rendering.
    :param service: The notification service instance for data management.
    """

    self.display = display
    self.last_count = 0
    self.last_update = 0
    self.service = service

display = display instance-attribute

last_count = 0 instance-attribute

last_update = 0 instance-attribute

service = service instance-attribute

clear

A method that clears all notifications.

Source code in dev_tool/services/notification/manager.py
def clear(self) -> None:
    """A method that clears all notifications."""

    self.service.clear()

display_active

A method that displays all active notifications in command mode.

Source code in dev_tool/services/notification/manager.py
def display_active(self) -> None:
    """A method that displays all active notifications in command mode."""

    notifications = self.service.get_active()

    if notifications:
        print(self.display.terminal.clear_eos, end='', flush=True)  # noqa: T201

        for notification in notifications:
            banner = self.display.format_notification_banner(notification)
            print(banner)  # noqa: T201

display_new

A method that displays any new notifications that haven't been shown yet.

Parameters:

  • displayed (set) –

    Set of already displayed notification keys.

Source code in dev_tool/services/notification/manager.py
def display_new(self, displayed: set) -> None:
    """
    A method that displays any new notifications that haven't been shown yet.

    :param displayed: Set of already displayed notification keys.
    """

    for notification in self.service.get_active():
        key = (notification.message, notification.timestamp)

        if key not in displayed:
            banner = self.display.format_notification_banner(notification)
            print(banner, flush=True)  # noqa: T201
            displayed.add(key)

error

A method that adds an error notification.

Parameters:

  • message (str) –

    The error message text.

Source code in dev_tool/services/notification/manager.py
def error(self, message: str) -> None:
    """
    A method that adds an error notification.

    :param message: The error message text.
    """

    self.service.error(message)

get_active_count

A method that gets the count of active notifications.

Returns:

  • int

    The number of active notifications.

Source code in dev_tool/services/notification/manager.py
def get_active_count(self) -> int:
    """
    A method that gets the count of active notifications.

    :return: The number of active notifications.
    """

    amount = self.service.get_active()
    return len(amount)

info

A method that adds an info notification.

Parameters:

  • message (str) –

    The info message text.

Source code in dev_tool/services/notification/manager.py
def info(self, message: str) -> None:
    """
    A method that adds an info notification.

    :param message: The info message text.
    """

    self.service.info(message)

is_changed

A method that checks if notifications have changed in a way that requires attention.

Returns:

  • bool

    True if notifications have changed, False otherwise.

Source code in dev_tool/services/notification/manager.py
def is_changed(self) -> bool:
    """
    A method that checks if notifications have changed in a way that requires attention.

    :return: True if notifications have changed, False otherwise.
    """

    current_second = int(time.time())
    current_count = len(self.service.get_active())

    is_changed = False

    if current_count != self.last_count:
        is_changed = True

    if current_count > 0 and current_second != self.last_update:
        is_changed = True

    if is_changed:
        self.last_update = current_second
        self.last_count = current_count

    return is_changed

monitor

A context manager for monitoring and displaying notifications during command execution.

Returns:

  • Generator[None, None, None]

    A generator for the context manager.

Source code in dev_tool/services/notification/manager.py
@contextmanager
def monitor(self) -> Generator[None, None, None]:
    """
    A context manager for monitoring and displaying notifications during command execution.

    :return: A generator for the context manager.
    """

    event = threading.Event()
    displayed = set()

    def _monitor() -> None:
        while not event.is_set():
            self.display_new(displayed)
            time.sleep(0.5)

    thread = threading.Thread(target=_monitor, daemon=True)
    thread.start()

    try:
        yield
    finally:
        event.set()
        thread.join(timeout=0.5)

normal

A method that adds a normal notification.

Parameters:

  • message (str) –

    The notification message text.

Source code in dev_tool/services/notification/manager.py
def normal(self, message: str) -> None:
    """
    A method that adds a normal notification.

    :param message: The notification message text.
    """

    self.service.normal(message)

success

A method that adds a success notification.

Parameters:

  • message (str) –

    The success message text.

Source code in dev_tool/services/notification/manager.py
def success(self, message: str) -> None:
    """
    A method that adds a success notification.

    :param message: The success message text.
    """

    self.service.success(message)

warning

A method that adds a warning notification.

Parameters:

  • message (str) –

    The warning message text.

Source code in dev_tool/services/notification/manager.py
def warning(self, message: str) -> None:
    """
    A method that adds a warning notification.

    :param message: The warning message text.
    """

    self.service.warning(message)

NotificationService

A thread-safe singleton service for managing application notifications.

This class provides centralized notification management with support for different notification types, formats, and lifecycle management.

The constructor for the NotificationService class.

Initializes the service with an empty notification list and thread safety.

Source code in dev_tool/services/notification/service.py
def __init__(self) -> None:
    """
    The constructor for the NotificationService class.

    Initializes the service with an empty notification list and thread safety.
    """

    if hasattr(self, '_initialized'):
        return

    self._initialized = True
    self._notifications = []
    self._lock = threading.Lock()

__new__

A class method that creates a singleton instance with thread safety.

Returns:

  • Self

    The singleton NotificationService instance.

Source code in dev_tool/services/notification/service.py
def __new__(cls) -> Self:
    """
    A class method that creates a singleton instance with thread safety.

    :return: The singleton NotificationService instance.
    """

    if cls._instance is None:
        with cls._lock:
            if cls._instance is None:
                cls._instance = super().__new__(cls)

    return cls._instance

add_notification

A method that adds a new notification to the active list.

Parameters:

  • message (str) –

    The notification message text.

  • notification_type (NotificationType, default: INFO ) –

    The type of notification for styling.

  • notification_format (NotificationFormat, default: BANNER ) –

    The display format for the notification.

  • duration (float, default: 5.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • show_prefix (bool, default: False ) –

    Whether to show the notification type prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def add_notification(
    self,
    message: str,
    notification_type: NotificationType = NotificationType.INFO,
    notification_format: NotificationFormat = NotificationFormat.BANNER,
    duration: float = 5.0,
    persistent: bool = False,
    show_prefix: bool = False,
    identifier: str | None = None
) -> None:
    """
    A method that adds a new notification to the active list.

    :param message: The notification message text.
    :param notification_type: The type of notification for styling.
    :param notification_format: The display format for the notification.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param show_prefix: Whether to show the notification type prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    notification = Notification(
        message=message,
        notification_type=notification_type,
        notification_format=notification_format,
        timestamp=time.time(),
        duration=duration,
        persistent=persistent,
        show_prefix=show_prefix,
        identifier=identifier
    )

    with self._lock:
        self._notifications.append(notification)

clear

A method that removes all notifications from the active list.

Source code in dev_tool/services/notification/service.py
def clear(self) -> None:
    """A method that removes all notifications from the active list."""

    with self._lock:
        self._notifications.clear()

dismiss

A method that removes a specific notification from the active list.

Parameters:

  • notification (Notification) –

    The notification object to remove.

Source code in dev_tool/services/notification/service.py
def dismiss(self, notification: Notification) -> None:
    """
    A method that removes a specific notification from the active list.

    :param notification: The notification object to remove.
    """

    with self._lock:
        if notification in self._notifications:
            self._notifications.remove(notification)

dismiss_by_identifier

A method that removes notifications with a specific identifier.

Parameters:

  • identifier (str) –

    The identifier to match for removal.

Source code in dev_tool/services/notification/service.py
def dismiss_by_identifier(self, identifier: str) -> None:
    """
    A method that removes notifications with a specific identifier.

    :param identifier: The identifier to match for removal.
    """

    with self._lock:
        self._notifications = [
            n for n in self._notifications
            if n.identifier != identifier
        ]

error

A method that adds an error notification with red styling.

Parameters:

  • message (str) –

    The error message text.

  • duration (float, default: 10.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • banner (bool, default: False ) –

    Whether to use banner format instead of text format.

  • show_prefix (bool, default: False ) –

    Whether to show the error prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def error(self, message: str, duration: float = 10.0, persistent: bool = False, banner: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds an error notification with red styling.

    :param message: The error message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param banner: Whether to use banner format instead of text format.
    :param show_prefix: Whether to show the error prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    format_type = NotificationFormat.BANNER if banner else NotificationFormat.TEXT
    self.add_notification(message, NotificationType.ERROR, format_type, duration, persistent, show_prefix, identifier)

error_banner

A method that adds an error notification with banner format.

Parameters:

  • message (str) –

    The error message text.

  • duration (float, default: 10.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • show_prefix (bool, default: False ) –

    Whether to show the error prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def error_banner(self, message: str, duration: float = 10.0, persistent: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds an error notification with banner format.

    :param message: The error message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param show_prefix: Whether to show the error prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    self.add_notification(message, NotificationType.ERROR, NotificationFormat.BANNER, duration, persistent, show_prefix, identifier)

error_text

A method that adds an error notification with text format.

Parameters:

  • message (str) –

    The error message text.

  • duration (float, default: 10.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • show_prefix (bool, default: False ) –

    Whether to show the error prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def error_text(self, message: str, duration: float = 10.0, persistent: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds an error notification with text format.

    :param message: The error message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param show_prefix: Whether to show the error prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    self.add_notification(message, NotificationType.ERROR, NotificationFormat.TEXT, duration, persistent, show_prefix, identifier)

flush

A method that clears all active notifications.

Source code in dev_tool/services/notification/service.py
def flush(self) -> None:
    """A method that clears all active notifications."""

    with self._lock:
        self._notifications.clear()

get_active

A method that gets active notifications and cleans up expired ones.

Returns:

Source code in dev_tool/services/notification/service.py
def get_active(self) -> list[Notification]:
    """
    A method that gets active notifications and cleans up expired ones.

    :return: A list of active notification objects.
    """

    with self._lock:
        active = [
            notification
            for notification in self._notifications
            if not notification.expired
        ]

        self._notifications = active
        return active.copy()

info

A method that adds an info notification with blue styling.

Parameters:

  • message (str) –

    The info message text.

  • duration (float, default: 5.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • banner (bool, default: False ) –

    Whether to use banner format instead of text format.

  • show_prefix (bool, default: False ) –

    Whether to show the info prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def info(self, message: str, duration: float = 5.0, persistent: bool = False, banner: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds an info notification with blue styling.

    :param message: The info message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param banner: Whether to use banner format instead of text format.
    :param show_prefix: Whether to show the info prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    format_type = NotificationFormat.BANNER if banner else NotificationFormat.TEXT
    self.add_notification(message, NotificationType.INFO, format_type, duration, persistent, show_prefix, identifier)

info_banner

A method that adds an info notification with banner format.

Parameters:

  • message (str) –

    The info message text.

  • duration (float, default: 5.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • show_prefix (bool, default: False ) –

    Whether to show the info prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def info_banner(self, message: str, duration: float = 5.0, persistent: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds an info notification with banner format.

    :param message: The info message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param show_prefix: Whether to show the info prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    self.add_notification(message, NotificationType.INFO, NotificationFormat.BANNER, duration, persistent, show_prefix, identifier)

info_text

A method that adds an info notification with text format.

Parameters:

  • message (str) –

    The info message text.

  • duration (float, default: 5.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • show_prefix (bool, default: False ) –

    Whether to show the info prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def info_text(self, message: str, duration: float = 5.0, persistent: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds an info notification with text format.

    :param message: The info message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param show_prefix: Whether to show the info prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    self.add_notification(message, NotificationType.INFO, NotificationFormat.TEXT, duration, persistent, show_prefix, identifier)

normal

A method that adds a normal notification with plain styling.

Parameters:

  • message (str) –

    The notification message text.

  • duration (float, default: 5.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • banner (bool, default: False ) –

    Whether to use banner format instead of text format.

  • show_prefix (bool, default: False ) –

    Whether to show the normal prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def normal(self, message: str, duration: float = 5.0, persistent: bool = False, banner: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds a normal notification with plain styling.

    :param message: The notification message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param banner: Whether to use banner format instead of text format.
    :param show_prefix: Whether to show the normal prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    format_type = NotificationFormat.BANNER if banner else NotificationFormat.TEXT
    self.add_notification(message, NotificationType.NORMAL, format_type, duration, persistent, show_prefix, identifier)

normal_banner

A method that adds a normal notification with banner format.

Parameters:

  • message (str) –

    The notification message text.

  • duration (float, default: 5.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • show_prefix (bool, default: False ) –

    Whether to show the normal prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def normal_banner(self, message: str, duration: float = 5.0, persistent: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds a normal notification with banner format.

    :param message: The notification message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param show_prefix: Whether to show the normal prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    self.add_notification(message, NotificationType.NORMAL, NotificationFormat.BANNER, duration, persistent, show_prefix, identifier)

normal_text

A method that adds a normal notification with text format.

Parameters:

  • message (str) –

    The notification message text.

  • duration (float, default: 5.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • show_prefix (bool, default: False ) –

    Whether to show the normal prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def normal_text(self, message: str, duration: float = 5.0, persistent: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds a normal notification with text format.

    :param message: The notification message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param show_prefix: Whether to show the normal prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    self.add_notification(message, NotificationType.NORMAL, NotificationFormat.TEXT, duration, persistent, show_prefix, identifier)

success

A method that adds a success notification with green styling.

Parameters:

  • message (str) –

    The success message text.

  • duration (float, default: 3.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • banner (bool, default: False ) –

    Whether to use banner format instead of text format.

  • show_prefix (bool, default: False ) –

    Whether to show the success prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def success(self, message: str, duration: float = 3.0, persistent: bool = False, banner: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds a success notification with green styling.

    :param message: The success message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param banner: Whether to use banner format instead of text format.
    :param show_prefix: Whether to show the success prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    format_type = NotificationFormat.BANNER if banner else NotificationFormat.TEXT
    self.add_notification(message, NotificationType.SUCCESS, format_type, duration, persistent, show_prefix, identifier)

success_banner

A method that adds a success notification with banner format.

Parameters:

  • message (str) –

    The success message text.

  • duration (float, default: 3.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • show_prefix (bool, default: False ) –

    Whether to show the success prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def success_banner(self, message: str, duration: float = 3.0, persistent: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds a success notification with banner format.

    :param message: The success message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param show_prefix: Whether to show the success prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    self.add_notification(message, NotificationType.SUCCESS, NotificationFormat.BANNER, duration, persistent, show_prefix, identifier)

success_text

A method that adds a success notification with text format.

Parameters:

  • message (str) –

    The success message text.

  • duration (float, default: 3.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • show_prefix (bool, default: False ) –

    Whether to show the success prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def success_text(self, message: str, duration: float = 3.0, persistent: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds a success notification with text format.

    :param message: The success message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param show_prefix: Whether to show the success prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    self.add_notification(message, NotificationType.SUCCESS, NotificationFormat.TEXT, duration, persistent, show_prefix, identifier)

warning

A method that adds a warning notification with yellow styling.

Parameters:

  • message (str) –

    The warning message text.

  • duration (float, default: 7.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • banner (bool, default: False ) –

    Whether to use banner format instead of text format.

  • show_prefix (bool, default: False ) –

    Whether to show the warning prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def warning(self, message: str, duration: float = 7.0, persistent: bool = False, banner: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds a warning notification with yellow styling.

    :param message: The warning message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param banner: Whether to use banner format instead of text format.
    :param show_prefix: Whether to show the warning prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    format_type = NotificationFormat.BANNER if banner else NotificationFormat.TEXT
    self.add_notification(message, NotificationType.WARNING, format_type, duration, persistent, show_prefix, identifier)

warning_banner

A method that adds a warning notification with banner format.

Parameters:

  • message (str) –

    The warning message text.

  • duration (float, default: 7.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • show_prefix (bool, default: False ) –

    Whether to show the warning prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def warning_banner(self, message: str, duration: float = 7.0, persistent: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds a warning notification with banner format.

    :param message: The warning message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param show_prefix: Whether to show the warning prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    self.add_notification(message, NotificationType.WARNING, NotificationFormat.BANNER, duration, persistent, show_prefix, identifier)

warning_text

A method that adds a warning notification with text format.

Parameters:

  • message (str) –

    The warning message text.

  • duration (float, default: 7.0 ) –

    The display duration in seconds.

  • persistent (bool, default: False ) –

    Whether the notification should persist until dismissed.

  • show_prefix (bool, default: False ) –

    Whether to show the warning prefix.

  • identifier (str | None, default: None ) –

    Optional identifier for targeted dismissal.

Source code in dev_tool/services/notification/service.py
def warning_text(self, message: str, duration: float = 7.0, persistent: bool = False, show_prefix: bool = False, identifier: str | None = None) -> None:
    """
    A method that adds a warning notification with text format.

    :param message: The warning message text.
    :param duration: The display duration in seconds.
    :param persistent: Whether the notification should persist until dismissed.
    :param show_prefix: Whether to show the warning prefix.
    :param identifier: Optional identifier for targeted dismissal.
    """

    self.add_notification(message, NotificationType.WARNING, NotificationFormat.TEXT, duration, persistent, show_prefix, identifier)