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:
1 parent
1d94c23bae
commit
7f8b0bb295
1 file changed
+15
-4
+15
-4
@@ -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()
|
||||
|
||||
|
||||
Reference in new issue
Block a user