add select facts back, change 'generate cards' shortcut

This commit is contained in:
Damien Elmes 2009-02-09 21:52:59 +09:00
parent b5358c1264
commit 049f38999b
2 changed files with 17 additions and 6 deletions

View file

@ -493,6 +493,7 @@ class EditDeck(QMainWindow):
self.connect(self.dialog.actionRedo, SIGNAL("triggered()"), self.onRedo)
self.connect(self.dialog.actionInvertSelection, SIGNAL("triggered()"), self.invertSelection)
self.connect(self.dialog.actionReverseOrder, SIGNAL("triggered()"), self.reverseOrder)
self.connect(self.dialog.actionSelectFacts, SIGNAL("triggered()"), self.selectFacts)
# jumps
self.connect(self.dialog.actionFirstCard, SIGNAL("triggered()"), self.onFirstCard)
self.connect(self.dialog.actionLastCard, SIGNAL("triggered()"), self.onLastCard)
@ -723,6 +724,15 @@ where id in %s""" % ids2str(sf))
# Edit: selection
######################################################################
def selectFacts(self):
sm = self.dialog.tableView.selectionModel()
cardIds = dict([(x, 1) for x in self.selectedFactsAsCards()])
for i, card in enumerate(self.model.cards):
if card.id in cardIds:
sm.select(self.model.index(i, 0),
QItemSelectionModel.Select | QItemSelectionModel.Rows)
def invertSelection(self):
sm = self.dialog.tableView.selectionModel()
items = sm.selection()

View file

@ -181,6 +181,7 @@
<addaction name="actionRedo" />
<addaction name="separator" />
<addaction name="actionSelectAll" />
<addaction name="actionSelectFacts" />
<addaction name="actionInvertSelection" />
<addaction name="separator" />
<addaction name="actionReverseOrder" />
@ -258,7 +259,7 @@
<normaloff>:/icons/Anki_Card.png</normaloff>:/icons/Anki_Card.png</iconset>
</property>
<property name="text" >
<string>Generate &amp;Cards...</string>
<string>&amp;Generate Cards...</string>
</property>
</action>
<action name="actionReschedule" >
@ -275,11 +276,6 @@
<string>Select &amp;All</string>
</property>
</action>
<action name="actionSelectFacts" >
<property name="text" >
<string>Select &amp;Facts</string>
</property>
</action>
<action name="actionUndo" >
<property name="icon" >
<iconset resource="../icons.qrc" >
@ -401,6 +397,11 @@
<string>Change &amp;Model...</string>
</property>
</action>
<action name="actionSelectFacts" >
<property name="text" >
<string>Select &amp;Facts</string>
</property>
</action>
</widget>
<resources>
<include location="../icons.qrc" />