Ensure toplevel window is actually a WINDOW_TOPLEVEL type

The window_list_toplevels may return also WINDOW_POPUP which is not usable to
be set as parent. This happens when a toplevel window is searched from the
activate event of a popup menu.

issue7061
review43901002
This commit is contained in:
Cédric Krier committed 2018-01-19 22:06:06 +01:00
1 parent a2ccd96770
commit e2ef26cf83
1 file changed
+1 -1
+1 -1
View File
@@ -300,7 +300,7 @@ def request_server(server_widget):
def get_toplevel_window():
for window in gtk.window_list_toplevels():
if window.is_active():
if window.is_active() and window.props.type == gtk.WINDOW_TOPLEVEL:
return window
from tryton.gui.main import Main
return Main.get_main().window