|
@@ -0,0 +1,28 @@
|
|
|
+import justpy as jp
|
|
|
+from .element import Element
|
|
|
+
|
|
|
+class Notify(Element):
|
|
|
+
|
|
|
+ def __init__(self,
|
|
|
+ message: str = '',
|
|
|
+ position: str = 'bottom',
|
|
|
+ close_button: str = ''
|
|
|
+ ):
|
|
|
+ """Notification Element
|
|
|
+
|
|
|
+ Displays a notification on the screen.
|
|
|
+
|
|
|
+ :param message: the content of the notification
|
|
|
+ :param position: possible position: 'top-left', 'top-right', 'bottom-left','bottom-right, 'top', 'bottom', 'left', 'right', 'center'
|
|
|
+ :param close_button:
|
|
|
+ """
|
|
|
+
|
|
|
+ view = jp.QNotify(message=message, position=position)
|
|
|
+
|
|
|
+ if close_button:
|
|
|
+ view.closeBtn = close_button
|
|
|
+
|
|
|
+ super().__init__(view)
|
|
|
+
|
|
|
+ def notify(self, state: bool):
|
|
|
+ self.view.notify = state
|