comparison 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
comparison
equal deleted inserted replaced
32:fdaf914e2729 33:c21d1be2e54c
112 112
113 def _xmluiClose(self): 113 def _xmluiClose(self):
114 if self.close_cb is not None: 114 if self.close_cb is not None:
115 self.close_cb(self) 115 self.close_cb(self)
116 else: 116 else:
117 log.error(u"No close method defined") 117 G.host.closeUI()
118 118
119 def constructUI(self, parsed_dom): 119 def constructUI(self, parsed_dom):
120 xmlui.XMLUIPanel.constructUI(self, parsed_dom) 120 xmlui.XMLUIPanel.constructUI(self, parsed_dom)
121 if self.xmlui_title: 121 if self.xmlui_title:
122 self.add_widget(Title(text=self.xmlui_title)) 122 self.add_widget(Title(text=self.xmlui_title))
129 cancel_btn = Button(text=_(u"Cancel"), size_hint=(1,0.2)) 129 cancel_btn = Button(text=_(u"Cancel"), size_hint=(1,0.2))
130 cancel_btn.bind(on_press=self.onFormCancelled) 130 cancel_btn.bind(on_press=self.onFormCancelled)
131 self.add_widget(cancel_btn) 131 self.add_widget(cancel_btn)
132 self.add_widget(Widget()) # to have elements on the top 132 self.add_widget(Widget()) # to have elements on the top
133 133
134 def show(self, *args, **kwargs):
135 if not self.user_action and not kwargs.get("force", False):
136 G.host.addNotifUI(self)
137 else:
138 G.host.showUI(self)
139
134 140
135 class XMLUIDialog(xmlui.XMLUIDialog): 141 class XMLUIDialog(xmlui.XMLUIDialog):
136 dialog_factory = WidgetFactory() 142 dialog_factory = WidgetFactory()
137 143
138 144