Don't present parent window if it is already destroyed

When creating a new record from the search dialog, the callback destroys the
search dialog before the form dialog is destroyed.
This commit is contained in:
Cédric Krier committed 2012-03-18 21:08:00 +01:00
1 parent 5846e81922
commit 6dcb51a3da
1 file changed
+5
+5
View File
@@ -1,5 +1,7 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import gtk
from tryton.gui.main import Main
import tryton.common as common
@@ -22,6 +24,9 @@ class NoModal(object):
def destroy(self):
self.page.dialogs.remove(self)
# Test if the parent is not already destroyed
if self.parent not in gtk.window_list_toplevels():
return
self.parent.present()
self.sensible_widget.props.sensitive = True
if self.parent_focus: