From 7f8b0bb2958bb64d6a235df67cefbbbfeb844be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 9 Apr 2011 14:29:54 +0200 Subject: [PATCH] Don't destroy dialog in AskDialog before reading value The Entry value is lost if the dialog is destroyed before getting the value --- tryton/common/common.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tryton/common/common.py b/tryton/common/common.py index d3cf205ea6..c6d7e4fb89 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -643,11 +643,22 @@ class AskDialog(UniqueDialog): return win def __call__(self, question, parent, visibility=True): - response = super(AskDialog, self).__call__(question, parent, visibility) + if self.running: + return + + dialog = self.build_dialog(question, parent, + visibility=visibility) + dialog.set_icon(TRYTON_ICON) + self.running = True + dialog.show_all() + response = dialog.run() + result = None if response == gtk.RESPONSE_OK: - return self.entry.get_text() - else: - return None + result = self.entry.get_text() + parent.present() + dialog.destroy() + self.running = False + return result ask = AskDialog()