mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
add home+end shortcuts
This commit is contained in:
parent
0a0190103f
commit
e2ed5b54c8
2 changed files with 38 additions and 2 deletions
|
@ -354,6 +354,8 @@ class Browser(QMainWindow):
|
||||||
# jumps
|
# jumps
|
||||||
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.actionFirstCard, s, self.onFirstCard)
|
||||||
|
c(f.actionLastCard, s, self.onLastCard)
|
||||||
c(f.actionFind, s, self.onFind)
|
c(f.actionFind, s, self.onFind)
|
||||||
c(f.actionNote, s, self.onNote)
|
c(f.actionNote, s, self.onNote)
|
||||||
c(f.actionTags, s, self.onTags)
|
c(f.actionTags, s, self.onTags)
|
||||||
|
@ -1208,12 +1210,13 @@ select fm.id, fm.name from fieldmodels fm""")
|
||||||
# Jumping
|
# Jumping
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
def _moveCur(self, dir):
|
def _moveCur(self, dir=None, idx=None):
|
||||||
if not self.model.cards:
|
if not self.model.cards:
|
||||||
return
|
return
|
||||||
self.editor.saveNow()
|
self.editor.saveNow()
|
||||||
tv = self.form.tableView
|
tv = self.form.tableView
|
||||||
idx = tv.moveCursor(dir, Qt.NoModifier)
|
if idx is None:
|
||||||
|
idx = tv.moveCursor(dir, self.mw.app.keyboardModifiers())
|
||||||
tv.selectionModel().clear()
|
tv.selectionModel().clear()
|
||||||
tv.setCurrentIndex(idx)
|
tv.setCurrentIndex(idx)
|
||||||
|
|
||||||
|
@ -1225,6 +1228,13 @@ select fm.id, fm.name from fieldmodels fm""")
|
||||||
self._moveCur(QAbstractItemView.MoveDown)
|
self._moveCur(QAbstractItemView.MoveDown)
|
||||||
self.editor.web.setFocus()
|
self.editor.web.setFocus()
|
||||||
|
|
||||||
|
def onFirstCard(self):
|
||||||
|
self._moveCur(None, self.model.index(0, 0))
|
||||||
|
|
||||||
|
def onLastCard(self):
|
||||||
|
self._moveCur(
|
||||||
|
None, self.model.index(len(self.model.cards) - 1, 0))
|
||||||
|
|
||||||
def onFind(self):
|
def onFind(self):
|
||||||
self.form.searchEdit.setFocus()
|
self.form.searchEdit.setFocus()
|
||||||
self.form.searchEdit.lineEdit().selectAll()
|
self.form.searchEdit.lineEdit().selectAll()
|
||||||
|
|
|
@ -260,8 +260,10 @@
|
||||||
<addaction name="actionNote"/>
|
<addaction name="actionNote"/>
|
||||||
<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">
|
||||||
|
@ -455,6 +457,30 @@
|
||||||
<string>Reposition...</string>
|
<string>Reposition...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionFirstCard">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="icons.qrc">
|
||||||
|
<normaloff>:/icons/arrow-up.png</normaloff>:/icons/arrow-up.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>First Card</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Home</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionLastCard">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="icons.qrc">
|
||||||
|
<normaloff>:/icons/arrow-down.png</normaloff>:/icons/arrow-down.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Last Card</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>End</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="icons.qrc"/>
|
<include location="icons.qrc"/>
|
||||||
|
|
Loading…
Reference in a new issue