Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
relativisticelectron committed Jun 19, 2022
1 parent f48642a commit 423ba71
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/cryptoadvance/specter/notifications/notification_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def get_default_target_ui_name(self):
def get_all_target_ui_names(self):
return {ui_notification.name for ui_notification in self.ui_notifications}

def create_notification(self, *args, **kwargs):
def create_notification(self, title, **kwargs):
"""
The arguments are identical to Notification(....), e.g.
- title
Expand All @@ -112,12 +112,14 @@ def create_notification(self, *args, **kwargs):
- target_uis='default'
"""
logger.debug(
f"Starting to ceated notification with *args, **kwargs {args, kwargs}"
f"Starting to ceated notification with title, **kwargs {title, kwargs}"
)

notification = Notification(*args, **kwargs)
notification.cleanup_target_uis(
self.get_default_target_ui_name(), self.get_all_target_ui_names()
notification = Notification(
title,
self.get_default_target_ui_name(),
self.get_all_target_ui_names(),
**kwargs,
)
logger.debug(f"Middle of creating notification {notification}")

Expand Down
11 changes: 10 additions & 1 deletion src/cryptoadvance/specter/notifications/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ class Notification(dict):
"""

def __init__(
self, title, notification_type=None, body=None, target_uis="default", **kwargs
self,
title,
default_target_ui,
all_target_uis,
notification_type=None,
body=None,
target_uis="default",
**kwargs
):
self["title"] = str(title)
self["date"] = datetime.datetime.now()
Expand Down Expand Up @@ -54,6 +61,8 @@ def __init__(
for key, value in kwargs.items():
self[key] = value

self.cleanup_target_uis(default_target_ui, all_target_uis)

# set id (dependent on all other properties, so must eb set last)
self["id"] = None
self._set_id()
Expand Down

0 comments on commit 423ba71

Please sign in to comment.