mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
remove inactive tags from dialogs
This commit is contained in:
parent
cbb538c741
commit
d2e454930d
3 changed files with 7 additions and 65 deletions
|
@ -9,12 +9,11 @@ from ankiqt.ui.utils import saveGeom, restoreGeom
|
|||
|
||||
class ActiveTagsChooser(QDialog):
|
||||
|
||||
def __init__(self, parent, active, inactive):
|
||||
def __init__(self, parent, active):
|
||||
QDialog.__init__(self, parent, Qt.Window)
|
||||
self.parent = parent
|
||||
self.deck = self.parent.deck
|
||||
self.active = active
|
||||
self.inactive = inactive
|
||||
self.dialog = ankiqt.forms.activetags.Ui_Dialog()
|
||||
self.dialog.setupUi(self)
|
||||
self.connect(self.dialog.buttonBox, SIGNAL("helpRequested()"),
|
||||
|
@ -27,13 +26,9 @@ class ActiveTagsChooser(QDialog):
|
|||
self.items = []
|
||||
self.suspended = {}
|
||||
yes = parseTags(self.deck.getVar(self.active))
|
||||
no = parseTags(self.deck.getVar(self.inactive))
|
||||
yesHash = {}
|
||||
noHash = {}
|
||||
for y in yes:
|
||||
yesHash[y] = True
|
||||
for n in no:
|
||||
noHash[n] = True
|
||||
groupedTags = []
|
||||
usertags.sort()
|
||||
# render models and templates
|
||||
|
@ -70,16 +65,6 @@ class ActiveTagsChooser(QDialog):
|
|||
mode = QItemSelectionModel.Deselect
|
||||
idx = self.dialog.activeList.indexFromItem(item)
|
||||
self.dialog.activeList.selectionModel().select(idx, mode)
|
||||
# inactive
|
||||
item = QListWidgetItem(icon, t.replace("_", " "))
|
||||
self.dialog.inactiveList.addItem(item)
|
||||
if t in noHash:
|
||||
mode = QItemSelectionModel.Select
|
||||
self.dialog.inactiveCheck.setChecked(True)
|
||||
else:
|
||||
mode = QItemSelectionModel.Deselect
|
||||
idx = self.dialog.inactiveList.indexFromItem(item)
|
||||
self.dialog.inactiveList.selectionModel().select(idx, mode)
|
||||
|
||||
def accept(self):
|
||||
self.hide()
|
||||
|
@ -92,20 +77,10 @@ class ActiveTagsChooser(QDialog):
|
|||
idx = self.dialog.activeList.indexFromItem(item)
|
||||
if self.dialog.activeList.selectionModel().isSelected(idx):
|
||||
yes.append(self.tags[c])
|
||||
# inactive
|
||||
item = self.dialog.inactiveList.item(c)
|
||||
idx = self.dialog.inactiveList.indexFromItem(item)
|
||||
if self.dialog.inactiveList.selectionModel().isSelected(idx):
|
||||
no.append(self.tags[c])
|
||||
|
||||
if self.dialog.activeCheck.isChecked():
|
||||
self.deck.setVar(self.active, joinTags(yes))
|
||||
else:
|
||||
self.deck.setVar(self.active, "")
|
||||
if self.dialog.inactiveCheck.isChecked():
|
||||
self.deck.setVar(self.inactive, joinTags(no))
|
||||
else:
|
||||
self.deck.setVar(self.inactive, "")
|
||||
self.parent.reset()
|
||||
saveGeom(self, "activeTags")
|
||||
QDialog.accept(self)
|
||||
|
@ -114,6 +89,6 @@ class ActiveTagsChooser(QDialog):
|
|||
QDesktopServices.openUrl(QUrl(ankiqt.appWiki +
|
||||
"ActiveTags"))
|
||||
|
||||
def show(parent, active, inactive):
|
||||
at = ActiveTagsChooser(parent, active, inactive)
|
||||
def show(parent, active):
|
||||
at = ActiveTagsChooser(parent, active)
|
||||
at.exec_()
|
||||
|
|
|
@ -1488,10 +1488,10 @@ later by using File>Close.
|
|||
self.mainWin.tabWidget.setCurrentIndex(self.config['studyOptionsScreen'])
|
||||
|
||||
def onNewCategoriesClicked(self):
|
||||
ui.activetags.show(self, "newActive", "newInactive")
|
||||
ui.activetags.show(self, "newActive")
|
||||
|
||||
def onRevCategoriesClicked(self):
|
||||
ui.activetags.show(self, "revActive", "revInactive")
|
||||
ui.activetags.show(self, "revActive")
|
||||
|
||||
def onFailedMaxChanged(self):
|
||||
try:
|
||||
|
@ -1569,12 +1569,12 @@ later by using File>Close.
|
|||
u"Show All Due Cards",
|
||||
u"Show Chosen Categories"
|
||||
]
|
||||
if self.deck.getVar("newActive") or self.deck.getVar("newInactive"):
|
||||
if self.deck.getVar("newActive"):
|
||||
new = labels[1]
|
||||
else:
|
||||
new = labels[0]
|
||||
self.mainWin.newCategoryLabel.setText(new)
|
||||
if self.deck.getVar("revActive") or self.deck.getVar("revInactive"):
|
||||
if self.deck.getVar("revActive"):
|
||||
rev = labels[1]
|
||||
else:
|
||||
rev = labels[0]
|
||||
|
|
|
@ -35,23 +35,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="inactiveCheck">
|
||||
<property name="text">
|
||||
<string>Hide cards with these tags:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="inactiveList">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -118,21 +101,5 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>inactiveCheck</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>inactiveList</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>146</x>
|
||||
<y>213</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>68</x>
|
||||
<y>276</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
Loading…
Reference in a new issue