Metadata downloaded dialog: Prevent pressing the Enter/Spacebar keys from closing the dialog. Fixes #1382795 [Feature Request - Metadata download without "Download complete" dialog](https://bugs.launchpad.net/calibre/+bug/1382795)

This commit is contained in:
Kovid Goyal 2014-10-19 09:57:27 +05:30
parent af6c66106d
commit 12838cfe84

View File

@ -76,6 +76,15 @@ class ProceedQuestion(QDialog):
self.ask_question.connect(self.do_ask_question,
type=Qt.QueuedConnection)
for button in self.bb.buttons():
button.installEventFilter(self)
self.installEventFilter(self) # For Return key presses that close the dialog
def eventFilter(self, obj, ev):
if ev.type() in (ev.KeyPress, ev.KeyRelease) and ev.key() in (Qt.Key_Enter, Qt.Key_Space, Qt.Key_Return):
ev.ignore()
return True
return False
def copy_to_clipboard(self, *args):
QApplication.clipboard().setText(