# HG changeset patch # User Goffi # Date 1447759725 -3600 # Node ID 48f324352c52facc84d4466f17a9cef5c22aefd7 # Parent f4a0b12d2442062b3ee6a95234b81984f8a40b4a primitivus: fixed showDialog and XMLUI message dialog diff -r f4a0b12d2442 -r 48f324352c52 frontends/src/primitivus/primitivus --- a/frontends/src/primitivus/primitivus Mon Nov 16 11:58:11 2015 +0100 +++ b/frontends/src/primitivus/primitivus Tue Nov 17 12:28:45 2015 +0100 @@ -585,12 +585,14 @@ def _dialogOkCb(self, widget, data): popup, answer_cb, answer_data = data self.removePopUp(popup) - answer_cb(True, *answer_data) + if answer_cb is not None: + answer_cb(True, answer_data) def _dialogCancelCb(self, widget, data): popup, answer_cb, answer_data = data self.removePopUp(popup) - answer_cb(False, *answer_data) + if answer_cb is not None: + answer_cb(False, answer_data) def showDialog(self, message, title="", type_="info", answer_cb = None, answer_data = None): if type_ == 'info': @@ -602,9 +604,9 @@ if answer_cb is None: popup.setCallback('ok', lambda dummy: self.removePopUp(popup)) elif type_ == 'yes/no': - popup = sat_widgets.ConfirmDialog(message, - yes_cb=self._dialogOkCb, yes_value = (popup, answer_cb, answer_data), - no_cb=self._dialogCancelCb, no_value = (popup, answer_cb, answer_data)) + popup = sat_widgets.ConfirmDialog(message) + popup.setCallback('yes', self._dialogOkCb, (popup, answer_cb, answer_data)) + popup.setCallback('no', self._dialogCancelCb, (popup, answer_cb, answer_data)) else: popup = sat_widgets.alert(title, message, ok_cb=answer_cb) if answer_cb is None: diff -r f4a0b12d2442 -r 48f324352c52 frontends/src/primitivus/xmlui.py --- a/frontends/src/primitivus/xmlui.py Mon Nov 16 11:58:11 2015 +0100 +++ b/frontends/src/primitivus/xmlui.py Tue Nov 17 12:28:45 2015 +0100 @@ -336,7 +336,7 @@ def __init__(self, _xmlui_parent, title, message, level): PrimitivusDialog.__init__(self, _xmlui_parent) xmlui.MessageDialog.__init__(self, _xmlui_parent) - sat_widgets.Alert.__init__(self, title, message, ok_cb=lambda dummy: self._xmluiValidated()) + sat_widgets.Alert.__init__(self, title, message, ok_cb=lambda dummy: self._xmluiClose()) class PrimitivusNoteDialog(xmlui.NoteDialog, PrimitivusMessageDialog):