changeset 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 7fef6cdf5953
children 641cfd2faefe
files frontends/src/primitivus/xmlui.py frontends/src/tools/xmlui.py
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/primitivus/xmlui.py	Wed Nov 11 18:21:20 2015 +0100
+++ b/frontends/src/primitivus/xmlui.py	Wed Nov 11 18:29:32 2015 +0100
@@ -406,7 +406,7 @@
                     if not 'NO_CANCEL' in self.flags:
                         buttons.append(urwid.Button(_('Cancel'), self.onFormCancelled))
                 else:
-                    buttons.append(urwid.Button(_('OK'), lambda dummy: self._xmluiClose()))
+                    buttons.append(urwid.Button(_('OK')))
                 max_len = max([len(button.get_label()) for button in buttons])
                 grid_wid = urwid.GridFlow(buttons, max_len + 4, 1, 0, 'center')
                 self.main_cont.body.append(grid_wid)
--- a/frontends/src/tools/xmlui.py	Wed Nov 11 18:21:20 2015 +0100
+++ b/frontends/src/tools/xmlui.py	Wed Nov 11 18:29:32 2015 +0100
@@ -180,17 +180,16 @@
             data = {}
         self._xmluiSetData(C.XMLUI_STATUS_VALIDATED, data)
         self._xmluiSubmit(data)
-        self._xmluiClose()
 
     def _xmluiCancelled(self):
         data = {C.XMLUI_DATA_CANCELLED: C.BOOL_TRUE}
         self._xmluiSetData(C.XMLUI_STATUS_CANCELLED, data)
         self._xmluiSubmit(data)
-        self._xmluiClose()
 
     def _xmluiSubmit(self, data):
         if self._xmlui_parent.submit_id is None:
             log.debug(_("Nothing to submit"))
+            self._xmluiClose()
         else:
             self._xmlui_parent.submit(data)
 
@@ -295,7 +294,7 @@
         self.host.launchAction(action_id, data, callback=self.callback, profile=self.profile)
 
     def _xmluiClose(self):
-        """Close the window/popup/... where the constructeur XMLUI is
+        """Close the window/popup/... where the constructor XMLUI is
 
         this method must be overrided
         """
@@ -657,7 +656,7 @@
             self.submit(data)
         else:
             log.warning(_("The form data is not sent back, the type is not managed properly"))
-        self._xmluiClose()
+            self._xmluiClose()
 
     def onFormCancelled(self, ignore=None):
         """Called when a form is cancelled"""
@@ -725,6 +724,9 @@
     def show(self):
         self.dlg._xmluiShow()
 
+    def _xmluiClose(self):
+        self.dlg._xmluiClose()
+
 
 def registerClass(type_, class_):
     """Register the class to use with the factory