Don't destroy dialog in AskDialog before reading value

The Entry value is lost if the dialog is destroyed before getting the value
This commit is contained in:
Cédric Krier committed 2011-04-09 14:29:54 +02:00
1 parent 1d94c23bae
commit 7f8b0bb295
1 file changed
+15 -4
+15 -4
View File
@@ -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()