mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
only trigger on keyboard focus
This commit is contained in:
parent
462b63576a
commit
8f2f01340a
1 changed files with 3 additions and 2 deletions
|
@ -15,7 +15,8 @@ from anki.sound import clearAudioQueue
|
||||||
|
|
||||||
class FocusButton(QPushButton):
|
class FocusButton(QPushButton):
|
||||||
def focusInEvent(self, evt):
|
def focusInEvent(self, evt):
|
||||||
self.emit(SIGNAL("focusIn"))
|
if evt.reason() == Qt.TabFocusReason:
|
||||||
|
self.emit(SIGNAL("tabIn"))
|
||||||
QPushButton.focusInEvent(self, evt)
|
QPushButton.focusInEvent(self, evt)
|
||||||
|
|
||||||
class AddCards(QDialog):
|
class AddCards(QDialog):
|
||||||
|
@ -65,7 +66,7 @@ class AddCards(QDialog):
|
||||||
s = QShortcut(QKeySequence(_("Ctrl+Enter")), self)
|
s = QShortcut(QKeySequence(_("Ctrl+Enter")), self)
|
||||||
s.connect(s, SIGNAL("activated()"), self.addButton, SLOT("click()"))
|
s.connect(s, SIGNAL("activated()"), self.addButton, SLOT("click()"))
|
||||||
self.connect(self.addButton, SIGNAL("clicked()"), self.addCards)
|
self.connect(self.addButton, SIGNAL("clicked()"), self.addCards)
|
||||||
self.connect(self.addButton, SIGNAL("focusIn"), self.maybeAddCards)
|
self.connect(self.addButton, SIGNAL("tabIn"), self.maybeAddCards)
|
||||||
self.closeButton = QPushButton(_("Close"))
|
self.closeButton = QPushButton(_("Close"))
|
||||||
self.closeButton.setAutoDefault(False)
|
self.closeButton.setAutoDefault(False)
|
||||||
self.dialog.buttonBox.addButton(self.closeButton,
|
self.dialog.buttonBox.addButton(self.closeButton,
|
||||||
|
|
Loading…
Reference in a new issue