Mercurial > libervia-backend
comparison frontends/src/tools/xmlui.py @ 1579:d5e332055d9f
quick_frontend, primitivus (xmlui): removed _xmluiClose from workflow were submit is triggered, as submit launch the callback which close the dialog itself + fixed dialogs _xmluiClose
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 11 Nov 2015 18:29:32 +0100 |
parents | cb1b0fe10415 |
children | 05274b27e90e |
comparison
equal
deleted
inserted
replaced
1578:7fef6cdf5953 | 1579:d5e332055d9f |
---|---|
178 def _xmluiValidated(self, data=None): | 178 def _xmluiValidated(self, data=None): |
179 if data is None: | 179 if data is None: |
180 data = {} | 180 data = {} |
181 self._xmluiSetData(C.XMLUI_STATUS_VALIDATED, data) | 181 self._xmluiSetData(C.XMLUI_STATUS_VALIDATED, data) |
182 self._xmluiSubmit(data) | 182 self._xmluiSubmit(data) |
183 self._xmluiClose() | |
184 | 183 |
185 def _xmluiCancelled(self): | 184 def _xmluiCancelled(self): |
186 data = {C.XMLUI_DATA_CANCELLED: C.BOOL_TRUE} | 185 data = {C.XMLUI_DATA_CANCELLED: C.BOOL_TRUE} |
187 self._xmluiSetData(C.XMLUI_STATUS_CANCELLED, data) | 186 self._xmluiSetData(C.XMLUI_STATUS_CANCELLED, data) |
188 self._xmluiSubmit(data) | 187 self._xmluiSubmit(data) |
189 self._xmluiClose() | |
190 | 188 |
191 def _xmluiSubmit(self, data): | 189 def _xmluiSubmit(self, data): |
192 if self._xmlui_parent.submit_id is None: | 190 if self._xmlui_parent.submit_id is None: |
193 log.debug(_("Nothing to submit")) | 191 log.debug(_("Nothing to submit")) |
192 self._xmluiClose() | |
194 else: | 193 else: |
195 self._xmlui_parent.submit(data) | 194 self._xmlui_parent.submit(data) |
196 | 195 |
197 def _xmluiSetData(self, status, data): | 196 def _xmluiSetData(self, status, data): |
198 pass | 197 pass |
293 | 292 |
294 def _xmluiLaunchAction(self, action_id, data): | 293 def _xmluiLaunchAction(self, action_id, data): |
295 self.host.launchAction(action_id, data, callback=self.callback, profile=self.profile) | 294 self.host.launchAction(action_id, data, callback=self.callback, profile=self.profile) |
296 | 295 |
297 def _xmluiClose(self): | 296 def _xmluiClose(self): |
298 """Close the window/popup/... where the constructeur XMLUI is | 297 """Close the window/popup/... where the constructor XMLUI is |
299 | 298 |
300 this method must be overrided | 299 this method must be overrided |
301 """ | 300 """ |
302 raise NotImplementedError | 301 raise NotImplementedError |
303 | 302 |
655 if self.submit_id is not None: | 654 if self.submit_id is not None: |
656 data = dict(selected_values) | 655 data = dict(selected_values) |
657 self.submit(data) | 656 self.submit(data) |
658 else: | 657 else: |
659 log.warning(_("The form data is not sent back, the type is not managed properly")) | 658 log.warning(_("The form data is not sent back, the type is not managed properly")) |
660 self._xmluiClose() | 659 self._xmluiClose() |
661 | 660 |
662 def onFormCancelled(self, ignore=None): | 661 def onFormCancelled(self, ignore=None): |
663 """Called when a form is cancelled""" | 662 """Called when a form is cancelled""" |
664 log.debug(_("Cancelling form")) | 663 log.debug(_("Cancelling form")) |
665 self._xmluiClose() | 664 self._xmluiClose() |
723 raise ValueError("Unknown dialog type [%s]" % dlg_type) | 722 raise ValueError("Unknown dialog type [%s]" % dlg_type) |
724 | 723 |
725 def show(self): | 724 def show(self): |
726 self.dlg._xmluiShow() | 725 self.dlg._xmluiShow() |
727 | 726 |
727 def _xmluiClose(self): | |
728 self.dlg._xmluiClose() | |
729 | |
728 | 730 |
729 def registerClass(type_, class_): | 731 def registerClass(type_, class_): |
730 """Register the class to use with the factory | 732 """Register the class to use with the factory |
731 | 733 |
732 @param type_: one of: | 734 @param type_: one of: |