From 9a853aea8dff7ec96af00a351ae78bda1cc44a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 23 Mar 2011 15:03:09 +0100 Subject: [PATCH] Disallow to close wizard with Esc and remove close button also on windows We must force the user to follow the flow of the wizard --- tryton/wizard/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tryton/wizard/main.py b/tryton/wizard/main.py index 2a51421478..450ad15cfd 100644 --- a/tryton/wizard/main.py +++ b/tryton/wizard/main.py @@ -25,8 +25,9 @@ class Dialog(object): self.dia = gtk.Dialog(_('Wizard'), parent, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) self.dia.set_position(gtk.WIN_POS_CENTER_ON_PARENT) - if hasattr(self.dia, 'set_deletable') and os.name != 'nt': + if hasattr(self.dia, 'set_deletable'): self.dia.set_deletable(False) + self.dia.connect('close', self.close) self.accel_group = gtk.AccelGroup() self.dia.add_accel_group(self.accel_group) @@ -145,6 +146,10 @@ class Dialog(object): self.parent.present() return False + def close(self, widget, event=None): + widget.emit_stop_by_name('close') + return True + def destroy(self): self.dia.destroy()