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

This commit is contained in:
Goffi 2015-11-11 18:29:32 +01:00
commit 719a624892
2 changed files with 7 additions and 5 deletions

View file

@ -406,7 +406,7 @@ class XMLUIPanel(xmlui.XMLUIPanel, PrimitivusWidget):
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)

View file

@ -180,17 +180,16 @@ class Dialog(object):
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 @@ class XMLUIBase(object):
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 @@ class XMLUIPanel(XMLUIBase):
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 @@ class XMLUIDialog(XMLUIBase):
def show(self):
self.dlg._xmluiShow()
def _xmluiClose(self):
self.dlg._xmluiClose()
def registerClass(type_, class_):
"""Register the class to use with the factory