mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
improve selective study screen
This commit is contained in:
parent
3df8411626
commit
0d72810034
3 changed files with 117 additions and 58 deletions
|
@ -9,15 +9,25 @@ from ankiqt.ui.utils import saveGeom, restoreGeom
|
|||
|
||||
class ActiveTagsChooser(QDialog):
|
||||
|
||||
def __init__(self, parent, active, inactive, title):
|
||||
def __init__(self, parent, type):
|
||||
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.setWindowTitle(title)
|
||||
if type == "new":
|
||||
self.active = "newActive"
|
||||
self.inactive = "newInactive"
|
||||
else:
|
||||
self.active = "revActive"
|
||||
self.inactive = "revInactive"
|
||||
if (self.deck.getVar("newActive") == self.deck.getVar("revActive") and
|
||||
self.deck.getVar("newInactive") == self.deck.getVar("revInactive")):
|
||||
self.dialog.bothButton.click()
|
||||
elif type == "new":
|
||||
self.dialog.newButton.click()
|
||||
else:
|
||||
self.dialog.revButton.click()
|
||||
self.connect(self.dialog.buttonBox, SIGNAL("helpRequested()"),
|
||||
self.onHelp)
|
||||
self.rebuildTagList()
|
||||
|
@ -98,15 +108,22 @@ class ActiveTagsChooser(QDialog):
|
|||
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, "")
|
||||
types = []
|
||||
if (self.dialog.newButton.isChecked() or
|
||||
self.dialog.bothButton.isChecked()):
|
||||
types.append(["newActive", "newInactive"])
|
||||
if (self.dialog.revButton.isChecked() or
|
||||
self.dialog.bothButton.isChecked()):
|
||||
types.append(["revActive", "revInactive"])
|
||||
for (active, inactive) in types:
|
||||
if self.dialog.activeCheck.isChecked():
|
||||
self.deck.setVar(active, joinTags(yes))
|
||||
else:
|
||||
self.deck.setVar(active, "")
|
||||
if self.dialog.inactiveCheck.isChecked():
|
||||
self.deck.setVar(inactive, joinTags(no))
|
||||
else:
|
||||
self.deck.setVar(inactive, "")
|
||||
self.parent.reset()
|
||||
saveGeom(self, "activeTags")
|
||||
QDialog.accept(self)
|
||||
|
@ -115,6 +132,6 @@ class ActiveTagsChooser(QDialog):
|
|||
QDesktopServices.openUrl(QUrl(ankiqt.appWiki +
|
||||
"SelectiveStudy"))
|
||||
|
||||
def show(parent, active, inactive, title):
|
||||
at = ActiveTagsChooser(parent, active, inactive, title)
|
||||
def show(parent, type):
|
||||
at = ActiveTagsChooser(parent, type)
|
||||
at.exec_()
|
||||
|
|
|
@ -1569,12 +1569,10 @@ not be touched.""") %
|
|||
self.mainWin.tabWidget.setCurrentIndex(self.config['studyOptionsScreen'])
|
||||
|
||||
def onNewCategoriesClicked(self):
|
||||
ui.activetags.show(self, "newActive", "newInactive",
|
||||
_("Limit New Cards"))
|
||||
ui.activetags.show(self, "new")
|
||||
|
||||
def onRevCategoriesClicked(self):
|
||||
ui.activetags.show(self, "revActive", "revInactive",
|
||||
_("Limit Reviews"))
|
||||
ui.activetags.show(self, "rev")
|
||||
|
||||
def onFailedMaxChanged(self):
|
||||
try:
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>387</width>
|
||||
<height>396</height>
|
||||
<width>341</width>
|
||||
<height>348</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -15,44 +15,88 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<widget class="QCheckBox" name="activeCheck">
|
||||
<property name="text">
|
||||
<string>Show only cards with any of these tags:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="activeList">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>2</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="inactiveCheck">
|
||||
<property name="text">
|
||||
<string>Hide cards with any of these tags:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="inactiveList">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>2</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="activeCheck">
|
||||
<property name="text">
|
||||
<string>Show only cards with any of these tags:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="activeList">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</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>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Change settings for:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="newButton">
|
||||
<property name="text">
|
||||
<string>New Cards</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="revButton">
|
||||
<property name="text">
|
||||
<string>Reviews</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="bothButton">
|
||||
<property name="text">
|
||||
<string>Both</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
|
|
Loading…
Reference in a new issue