1

Making bracket keys move cursor around

Former-commit-id: 1809d22b10c4f391ce01736f1886942a55d9f0d0
This commit is contained in:
Alex Yatskov 2013-12-27 11:38:25 -08:00
parent bff7b14bc3
commit d2431f2cef

View File

@ -139,7 +139,6 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
index = event.key() - ord('0') - 1 index = event.key() - ord('0') - 1
if index < 0: if index < 0:
index = 9 index = 9
if event.modifiers() & QtCore.Qt.ShiftModifier: if event.modifiers() & QtCore.Qt.ShiftModifier:
if event.modifiers() & QtCore.Qt.ControlModifier: if event.modifiers() & QtCore.Qt.ControlModifier:
self.executeKanjiCommand('addKanji', index) self.executeKanjiCommand('addKanji', index)
@ -148,6 +147,12 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
self.executeVocabCommand('addVocabExp', index) self.executeVocabCommand('addVocabExp', index)
if event.modifiers() & QtCore.Qt.AltModifier: if event.modifiers() & QtCore.Qt.AltModifier:
self.executeVocabCommand('addVocabReading', index) self.executeVocabCommand('addVocabReading', index)
elif event.key() == ord('[') and self.state.scanPosition > 0:
self.state.scanPosition -= 1
self.updateSampleFromPosition()
elif event.key() == ord(']') and self.state.scanPosition < len(self.textContent.toPlainText()) - 1:
self.state.scanPosition += 1
self.updateSampleFromPosition()
def dragEnterEvent(self, event): def dragEnterEvent(self, event):