add invert selection, add cards->generate cards

This commit is contained in:
Damien Elmes 2009-01-04 12:49:17 +09:00
parent 06d72e5b0f
commit bb5ff4eb7c
2 changed files with 14 additions and 1 deletions

View file

@ -402,6 +402,7 @@ class EditDeck(QMainWindow):
self.connect(self.dialog.actionAddCards, SIGNAL("triggered()"), self.addCards)
self.connect(self.dialog.actionResetProgress, SIGNAL("triggered()"), self.resetProgress)
self.connect(self.dialog.actionSelectFacts, SIGNAL("triggered()"), self.selectFacts)
self.connect(self.dialog.actionInvertSelection, SIGNAL("triggered()"), self.invertSelection)
self.connect(self.dialog.actionUndo, SIGNAL("triggered()"), self.onUndo)
self.connect(self.dialog.actionRedo, SIGNAL("triggered()"), self.onRedo)
runHook('editor.setupMenus', self)
@ -580,6 +581,12 @@ where id in (%s)""" % ",".join([
sm.select(self.model.index(i, 0),
QItemSelectionModel.Select | QItemSelectionModel.Rows)
def invertSelection(self):
sm = self.dialog.tableView.selectionModel()
items = sm.selection()
self.dialog.tableView.selectAll()
sm.select(items, QItemSelectionModel.Deselect | QItemSelectionModel.Rows)
# Undo/Redo
######################################################################

View file

@ -182,6 +182,7 @@
<addaction name="separator" />
<addaction name="actionSelectAll" />
<addaction name="actionSelectFacts" />
<addaction name="actionInvertSelection" />
</widget>
<widget class="QMenu" name="menuActions" >
<property name="title" >
@ -234,7 +235,7 @@
<normaloff>:/icons/Anki_Card.png</normaloff>:/icons/Anki_Card.png</iconset>
</property>
<property name="text" >
<string>Add &amp;Cards...</string>
<string>Generate &amp;Cards...</string>
</property>
</action>
<action name="actionResetProgress" >
@ -274,6 +275,11 @@
<string>&amp;Redo</string>
</property>
</action>
<action name="actionInvertSelection" >
<property name="text" >
<string>&amp;Invert Selection</string>
</property>
</action>
</widget>
<resources>
<include location="../icons.qrc" />