diff --git a/ankiqt/ui/activetags.py b/ankiqt/ui/activetags.py
index 85d3615e8..12e6a9745 100644
--- a/ankiqt/ui/activetags.py
+++ b/ankiqt/ui/activetags.py
@@ -9,11 +9,12 @@ from ankiqt.ui.utils import saveGeom, restoreGeom
class ActiveTagsChooser(QDialog):
- def __init__(self, parent, active):
+ def __init__(self, parent, active, inactive):
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()"),
@@ -26,9 +27,13 @@ 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
@@ -65,6 +70,16 @@ 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()
@@ -77,10 +92,20 @@ 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)
@@ -89,6 +114,6 @@ class ActiveTagsChooser(QDialog):
QDesktopServices.openUrl(QUrl(ankiqt.appWiki +
"ActiveTags"))
-def show(parent, active):
- at = ActiveTagsChooser(parent, active)
+def show(parent, active, inactive):
+ at = ActiveTagsChooser(parent, active, inactive)
at.exec_()
diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py
index a939b9b63..037b74288 100755
--- a/ankiqt/ui/main.py
+++ b/ankiqt/ui/main.py
@@ -1488,10 +1488,10 @@ later by using File>Close.
self.mainWin.tabWidget.setCurrentIndex(self.config['studyOptionsScreen'])
def onNewCategoriesClicked(self):
- ui.activetags.show(self, "newActive")
+ ui.activetags.show(self, "newActive", "newInactive")
def onRevCategoriesClicked(self):
- ui.activetags.show(self, "revActive")
+ ui.activetags.show(self, "revActive", "revInactive")
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"):
+ if self.deck.getVar("newActive") or self.deck.getVar("newInactive"):
new = labels[1]
else:
new = labels[0]
self.mainWin.newCategoryLabel.setText(new)
- if self.deck.getVar("revActive"):
+ if self.deck.getVar("revActive") or self.deck.getVar("revInactive"):
rev = labels[1]
else:
rev = labels[0]
diff --git a/designer/activetags.ui b/designer/activetags.ui
index d283f49c6..616665de9 100644
--- a/designer/activetags.ui
+++ b/designer/activetags.ui
@@ -35,6 +35,23 @@
+ -
+
+
+ Hide cards with these tags:
+
+
+
+ -
+
+
+ false
+
+
+ QAbstractItemView::MultiSelection
+
+
+
-
@@ -101,5 +118,21 @@
+
+ inactiveCheck
+ toggled(bool)
+ inactiveList
+ setEnabled(bool)
+
+
+ 146
+ 213
+
+
+ 68
+ 276
+
+
+