From b6efe5393dba68b1700e7a94a0016498e1549603 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 20 Feb 2013 08:27:51 +0100 Subject: [PATCH] do not react on ESC/Enter/Return event when closing the dialog --- openlp/core/ui/shortcutlistform.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index c2fbc61fc..718b7193e 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -56,6 +56,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): self.setupUi(self) self.changedActions = {} self.action_list = ActionList.get_instance() + self.dialog_was_shown = False QtCore.QObject.connect(self.primaryPushButton, QtCore.SIGNAL(u'toggled(bool)'), self.onPrimaryPushButtonClicked) QtCore.QObject.connect(self.alternatePushButton, QtCore.SIGNAL(u'toggled(bool)'), self.onAlternatePushButtonClicked) @@ -91,6 +92,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): """ if not self.primaryPushButton.isChecked() and not self.alternatePushButton.isChecked(): return + # Do not continue, as the event is for the dialog (close it). + if self.dialog_was_shown and event.key() in (QtCore.Qt.Key_Escape, QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return): + self.dialog_was_shown = False + return key = event.key() if key == QtCore.Qt.Key_Shift or key == QtCore.Qt.Key_Control or \ key == QtCore.Qt.Key_Meta or key == QtCore.Qt.Key_Alt: @@ -425,6 +430,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): 'The shortcut "%s" is already assigned to another action, please use a different shortcut.') % key_sequence.toString() ) + self.dialog_was_shown = True return is_valid def _actionShortcuts(self, action):