mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
drop useless start/end navigation keys; fix other keys to select properly
This commit is contained in:
parent
a51d51bca6
commit
270bfab5a7
2 changed files with 7 additions and 54 deletions
|
@ -344,8 +344,6 @@ class Browser(QMainWindow):
|
||||||
c(f.actionFindReplace, s, self.onFindReplace)
|
c(f.actionFindReplace, s, self.onFindReplace)
|
||||||
c(f.actionFindDuplicates, s, self.onFindDupes)
|
c(f.actionFindDuplicates, s, self.onFindDupes)
|
||||||
# jumps
|
# jumps
|
||||||
c(f.actionFirstCard, s, self.onFirstCard)
|
|
||||||
c(f.actionLastCard, s, self.onLastCard)
|
|
||||||
c(f.actionPreviousCard, s, self.onPreviousCard)
|
c(f.actionPreviousCard, s, self.onPreviousCard)
|
||||||
c(f.actionNextCard, s, self.onNextCard)
|
c(f.actionNextCard, s, self.onNextCard)
|
||||||
c(f.actionFind, s, self.onFind)
|
c(f.actionFind, s, self.onFind)
|
||||||
|
@ -1048,39 +1046,20 @@ select fm.id, fm.name from fieldmodels fm""")
|
||||||
# Jumping
|
# Jumping
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
def onFirstCard(self):
|
def _moveCur(self, dir):
|
||||||
if not self.model.cards:
|
if not self.model.cards:
|
||||||
return
|
return
|
||||||
self.editor.saveNow()
|
self.editor.saveNow()
|
||||||
self.form.tableView.selectionModel().clear()
|
tv = self.form.tableView
|
||||||
self.form.tableView.selectRow(0)
|
idx = tv.moveCursor(dir, Qt.NoModifier)
|
||||||
|
tv.selectionModel().clear()
|
||||||
def onLastCard(self):
|
tv.setCurrentIndex(idx)
|
||||||
if not self.model.cards:
|
|
||||||
return
|
|
||||||
self.editor.saveNow()
|
|
||||||
self.form.tableView.selectionModel().clear()
|
|
||||||
self.form.tableView.selectRow(len(self.model.cards) - 1)
|
|
||||||
|
|
||||||
def onPreviousCard(self):
|
def onPreviousCard(self):
|
||||||
if not self.model.cards:
|
self._moveCur(QAbstractItemView.MoveUp)
|
||||||
return
|
|
||||||
self.editor.saveNow()
|
|
||||||
row = self.form.tableView.currentIndex().row()
|
|
||||||
row = max(0, row - 1)
|
|
||||||
self.form.tableView.selectionModel().clear()
|
|
||||||
self.form.tableView.selectRow(row)
|
|
||||||
self.onFact()
|
|
||||||
|
|
||||||
def onNextCard(self):
|
def onNextCard(self):
|
||||||
if not self.model.cards:
|
self._moveCur(QAbstractItemView.MoveDown)
|
||||||
return
|
|
||||||
self.editor.saveNow()
|
|
||||||
row = self.form.tableView.currentIndex().row()
|
|
||||||
row = min(len(self.model.cards) - 1, row + 1)
|
|
||||||
self.form.tableView.selectionModel().clear()
|
|
||||||
self.form.tableView.selectRow(row)
|
|
||||||
self.onFact()
|
|
||||||
|
|
||||||
def onFind(self):
|
def onFind(self):
|
||||||
self.form.searchEdit.setFocus()
|
self.form.searchEdit.setFocus()
|
||||||
|
|
|
@ -233,10 +233,8 @@
|
||||||
<addaction name="actionFact"/>
|
<addaction name="actionFact"/>
|
||||||
<addaction name="actionCardList"/>
|
<addaction name="actionCardList"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionFirstCard"/>
|
|
||||||
<addaction name="actionPreviousCard"/>
|
<addaction name="actionPreviousCard"/>
|
||||||
<addaction name="actionNextCard"/>
|
<addaction name="actionNextCard"/>
|
||||||
<addaction name="actionLastCard"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_Help">
|
<widget class="QMenu" name="menu_Help">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -401,30 +399,6 @@
|
||||||
<string>Ctrl+P</string>
|
<string>Ctrl+P</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionFirstCard">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="icons.qrc">
|
|
||||||
<normaloff>:/icons/go-first.png</normaloff>:/icons/go-first.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>F&irst Card</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+Home</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionLastCard">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="icons.qrc">
|
|
||||||
<normaloff>:/icons/go-last.png</normaloff>:/icons/go-last.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Last Card</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+End</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionGuide">
|
<action name="actionGuide">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="icons.qrc">
|
||||||
|
|
Loading…
Reference in a new issue