Skip to content

Commit

Permalink
Added DisplayPendigTask class in notification.py
Browse files Browse the repository at this point in the history
  • Loading branch information
swetayadav1 committed Jul 5, 2024
1 parent 56dd833 commit c9b57ad
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 39 deletions.
34 changes: 33 additions & 1 deletion nxdrive/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
if TYPE_CHECKING:
from .engine.engine import Engine # noqa
from .manager import Manager # noqa
from .notifications.tasks_notification import DisplayPendingTask # noqa

__all__ = ("DefaultNotificationService", "Notification")

Expand Down Expand Up @@ -520,6 +519,39 @@ def __init__(self, engine_uid: str, /) -> None:
)


class DisplayPendingTask(Notification):
"""Display a notification for pending tasks"""

def __init__(
self,
engine_uid: str,
remote_ref: str,
remote_path: str,
notification_title: str,
/,
) -> None:
values = [remote_path]
super().__init__(
uid=notification_title,
title=(" ".join(notification_title.split("_"))).title(),
description=Translator.get(notification_title, values=values),
level=Notification.LEVEL_INFO,
flags=(
Notification.FLAG_PERSISTENT
| Notification.FLAG_BUBBLE
| Notification.FLAG_ACTIONABLE
| Notification.FLAG_DISCARD_ON_TRIGGER
| Notification.FLAG_REMOVE_ON_DISCARD
),
action="display_pending_task",
action_args=(
engine_uid,
remote_ref,
remote_path,
),
)


class DefaultNotificationService(NotificationService):
def init_signals(self) -> None:
self._manager.initEngine.connect(self._connect_engine)
Expand Down
Empty file removed nxdrive/notifications/__init__.py
Empty file.
38 changes: 0 additions & 38 deletions nxdrive/notifications/tasks_notification.py

This file was deleted.

0 comments on commit c9b57ad

Please sign in to comment.