mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
add select all/none/invert buttons to active tags dialog
This commit is contained in:
parent
bb876ce3ed
commit
39dbbe4489
2 changed files with 46 additions and 18 deletions
|
@ -14,11 +14,35 @@ class ActiveTagsChooser(QDialog):
|
|||
self.parent = parent
|
||||
self.dialog = ankiqt.forms.activetags.Ui_Dialog()
|
||||
self.dialog.setupUi(self)
|
||||
self.selectAll = QPushButton(_("Select All"))
|
||||
self.connect(self.selectAll, SIGNAL("clicked()"), self.onSelectAll)
|
||||
self.dialog.buttonBox.addButton(self.selectAll,
|
||||
QDialogButtonBox.ActionRole)
|
||||
self.selectNone = QPushButton(_("Select None"))
|
||||
self.connect(self.selectNone, SIGNAL("clicked()"), self.onSelectNone)
|
||||
self.dialog.buttonBox.addButton(self.selectNone,
|
||||
QDialogButtonBox.ActionRole)
|
||||
self.invert = QPushButton(_("Invert"))
|
||||
self.connect(self.invert, SIGNAL("clicked()"), self.onInvert)
|
||||
self.dialog.buttonBox.addButton(self.invert,
|
||||
QDialogButtonBox.ActionRole)
|
||||
self.connect(self.dialog.buttonBox, SIGNAL("helpRequested()"),
|
||||
self.onHelp)
|
||||
self.rebuildTagList()
|
||||
restoreGeom(self, "activeTags")
|
||||
|
||||
def onSelectAll(self):
|
||||
self.dialog.list.selectAll()
|
||||
|
||||
def onSelectNone(self):
|
||||
self.dialog.list.clearSelection()
|
||||
|
||||
def onInvert(self):
|
||||
sm = self.dialog.list.selectionModel()
|
||||
sel = sm.selection()
|
||||
self.dialog.list.selectAll()
|
||||
sm.select(sel, QItemSelectionModel.Deselect)
|
||||
|
||||
def rebuildTagList(self):
|
||||
self.tags = self.parent.deck.allTags()
|
||||
self.items = []
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>248</width>
|
||||
<height>268</height>
|
||||
<width>369</width>
|
||||
<height>393</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
|
@ -16,26 +16,30 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string><h1>Select tags to suspend</h1></string>
|
||||
<string>Select tags to suspend. Deselect to unsuspend.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="list" >
|
||||
<property name="selectionMode" >
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||
<item>
|
||||
<widget class="QListWidget" name="list" >
|
||||
<property name="selectionMode" >
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in a new issue