add shortcuts for filter/sort, fix bug in hiding separators

This commit is contained in:
Damien Elmes 2009-05-09 06:35:56 +09:00
parent 41b98051b8
commit aa4621c66c
4 changed files with 40 additions and 1 deletions

View file

@ -394,10 +394,10 @@ class EditDeck(QMainWindow):
icon = QIcon(":/icons/" + icon)
for t in sortedtags:
self.dialog.tagList.addItem(icon, t.replace("_", " "))
alltags.append(None)
if sortedtags:
self.dialog.tagList.insertSeparator(
self.dialog.tagList.count())
alltags.append(None)
# fact tags
alluser = sorted(self.deck.allTags())
for tag in alltags:
@ -623,6 +623,8 @@ class EditDeck(QMainWindow):
self.connect(self.dialog.actionNextCard, SIGNAL("triggered()"), self.onNextCard)
self.connect(self.dialog.actionFind, SIGNAL("triggered()"), self.onFind)
self.connect(self.dialog.actionFact, SIGNAL("triggered()"), self.onFact)
self.connect(self.dialog.actionTags, SIGNAL("triggered()"), self.onTags)
self.connect(self.dialog.actionSort, SIGNAL("triggered()"), self.onSort)
# help
self.connect(self.dialog.actionGuide, SIGNAL("triggered()"), self.onHelp)
runHook('editor.setupMenus', self)
@ -1054,6 +1056,12 @@ where id in %s""" % ids2str(sf))
def onFact(self):
self.editor.focusFirst()
def onTags(self):
self.dialog.tagList.setFocus()
def onSort(self):
self.dialog.sortBox.setFocus()
# Help
######################################################################

View file

@ -209,12 +209,15 @@
<string>&amp;Go</string>
</property>
<addaction name="actionFind" />
<addaction name="actionTags" />
<addaction name="actionSort" />
<addaction name="actionFact" />
<addaction name="separator" />
<addaction name="actionFirstCard" />
<addaction name="actionPreviousCard" />
<addaction name="actionNextCard" />
<addaction name="actionLastCard" />
<addaction name="separator" />
</widget>
<widget class="QMenu" name="menu_Help" >
<property name="title" >
@ -391,6 +394,9 @@
<property name="text" >
<string>&amp;Guide...</string>
</property>
<property name="shortcut" >
<string>F1</string>
</property>
</action>
<action name="actionChangeModel" >
<property name="icon" >
@ -443,6 +449,30 @@
<string>&amp;Unsuspend</string>
</property>
</action>
<action name="actionTags" >
<property name="icon" >
<iconset resource="../icons.qrc" >
<normaloff>:/icons/anki-tag.png</normaloff>:/icons/anki-tag.png</iconset>
</property>
<property name="text" >
<string>Fil&amp;ters</string>
</property>
<property name="shortcut" >
<string>Ctrl+T</string>
</property>
</action>
<action name="actionSort" >
<property name="icon" >
<iconset resource="../icons.qrc" >
<normaloff>:/icons/view-sort-ascending.png</normaloff>:/icons/view-sort-ascending.png</iconset>
</property>
<property name="text" >
<string>&amp;Sort</string>
</property>
<property name="shortcut" >
<string>Ctrl+Shift+S</string>
</property>
</action>
</widget>
<resources>
<include location="../icons.qrc" />

View file

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/" >
<file>icons/view-sort-ascending.png</file>
<file>icons/media-playback-start2.png</file>
<file>icons/anki-logo-thin.png</file>
<file>icons/anki-logo.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB