From 719a624892864491b351a0483c1bd0370f9d7546 Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 11 Nov 2015 18:29:32 +0100 Subject: [PATCH] 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 --- frontends/src/primitivus/xmlui.py | 2 +- frontends/src/tools/xmlui.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/frontends/src/primitivus/xmlui.py b/frontends/src/primitivus/xmlui.py index d165edc1..937d44e6 100644 --- a/frontends/src/primitivus/xmlui.py +++ b/frontends/src/primitivus/xmlui.py @@ -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) diff --git a/frontends/src/tools/xmlui.py b/frontends/src/tools/xmlui.py index ac3e52d4..db659c18 100644 --- a/frontends/src/tools/xmlui.py +++ b/frontends/src/tools/xmlui.py @@ -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