Mercurial > libervia-backend
diff frontends/src/primitivus/primitivus @ 1612:48f324352c52
primitivus: fixed showDialog and XMLUI message dialog
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 17 Nov 2015 12:28:45 +0100 |
parents | 66f0e877625b |
children | 4f9fa67758eb |
line wrap: on
line diff
--- 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: