diff src/cagou/core/xmlui.py @ 33:c21d1be2e54c

core: XMLUI notifications coming from backend are handled: when a notification from backend is coming, it's added to a notification icon (on the right for important notifications which need user action, while left icon is used for notes). If user click on the notification icon, the XMLUI replace the main widget with a rise animation. When action is finished, ui is closed with a fall out animation.
author Goffi <goffi@goffi.org>
date Sun, 21 Aug 2016 21:41:52 +0200
parents 8b5827c43155
children 65775152aac1
line wrap: on
line diff
--- a/src/cagou/core/xmlui.py	Sun Aug 21 17:49:14 2016 +0200
+++ b/src/cagou/core/xmlui.py	Sun Aug 21 21:41:52 2016 +0200
@@ -114,7 +114,7 @@
         if self.close_cb is not None:
             self.close_cb(self)
         else:
-            log.error(u"No close method defined")
+            G.host.closeUI()
 
     def constructUI(self, parsed_dom):
         xmlui.XMLUIPanel.constructUI(self, parsed_dom)
@@ -131,6 +131,12 @@
                 self.add_widget(cancel_btn)
         self.add_widget(Widget()) # to have elements on the top
 
+    def show(self, *args, **kwargs):
+        if not self.user_action and not kwargs.get("force", False):
+            G.host.addNotifUI(self)
+        else:
+            G.host.showUI(self)
+
 
 class XMLUIDialog(xmlui.XMLUIDialog):
     dialog_factory = WidgetFactory()