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 423ba71 commit 8ab356f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/cryptoadvance/specter/notifications/notification_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,18 @@ def create_notification(self, title, **kwargs):
logger.debug(f"Created notification {notification}")
return notification

def flash(self, *args, **kwargs):
args = list(args)
if len(args) == 2:
kwargs["notification_type"] = args[1]
del args[1]
kwargs["target_uis"] = {"flash"}
self.create_and_show(*args, **kwargs)

def create_and_show(self, *args, **kwargs):
def flash(self, message: str, category: str = "message"):
self.create_and_show(message, notification_type=category, target_uis={"flash"})

def create_and_show(self, title, **kwargs):
"""
The arguments are identical to Notification(....), e.g.
- title
- None
- body=None
- target_uis='default'
"""
notification = self.create_notification(*args, **kwargs)
notification = self.create_notification(title, **kwargs)
if notification:
self.show(notification)

Expand Down

0 comments on commit 8ab356f

Please sign in to comment.