mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
add group field; instead of silently changing sort criteria, warn user
This commit is contained in:
parent
8f1e436c9a
commit
f110ffbb5f
2 changed files with 25 additions and 3 deletions
|
@ -217,6 +217,8 @@ class DeckModel(QAbstractTableModel):
|
||||||
if c.type == 0:
|
if c.type == 0:
|
||||||
return _("(new)")
|
return _("(new)")
|
||||||
return "%d%%" % (c.factor/10)
|
return "%d%%" % (c.factor/10)
|
||||||
|
elif type == "group":
|
||||||
|
return self.browser.mw.deck.groupName(c.gid)
|
||||||
|
|
||||||
# def limitContent(self, txt):
|
# def limitContent(self, txt):
|
||||||
# if "<c>" in txt:
|
# if "<c>" in txt:
|
||||||
|
@ -325,6 +327,7 @@ class Browser(QMainWindow):
|
||||||
c = self.connect; f = self.form; s = SIGNAL("triggered()")
|
c = self.connect; f = self.form; s = SIGNAL("triggered()")
|
||||||
c(f.actionAddItems, s, self.mw.onAddCard)
|
c(f.actionAddItems, s, self.mw.onAddCard)
|
||||||
c(f.actionDelete, s, self.deleteCards)
|
c(f.actionDelete, s, self.deleteCards)
|
||||||
|
c(f.actionChangeGroup, s, self.changeGroup)
|
||||||
c(f.actionAddTag, s, self.addTags)
|
c(f.actionAddTag, s, self.addTags)
|
||||||
c(f.actionDeleteTag, s, self.deleteTags)
|
c(f.actionDeleteTag, s, self.deleteTags)
|
||||||
c(f.actionReschedule, s, self.reschedule)
|
c(f.actionReschedule, s, self.reschedule)
|
||||||
|
@ -390,6 +393,7 @@ class Browser(QMainWindow):
|
||||||
('question', _("Question")),
|
('question', _("Question")),
|
||||||
('answer', _("Answer")),
|
('answer', _("Answer")),
|
||||||
('template', _("Card")),
|
('template', _("Card")),
|
||||||
|
('group', _("Group")),
|
||||||
('factFld', _("Sort Field")),
|
('factFld', _("Sort Field")),
|
||||||
('factCrt', _("Created")),
|
('factCrt', _("Created")),
|
||||||
('factMod', _("Edited")),
|
('factMod', _("Edited")),
|
||||||
|
@ -494,12 +498,14 @@ class Browser(QMainWindow):
|
||||||
|
|
||||||
def onSortChanged(self, idx, ord):
|
def onSortChanged(self, idx, ord):
|
||||||
type = self.model.activeCols[idx]
|
type = self.model.activeCols[idx]
|
||||||
if type in ("question", "answer", "template"):
|
noSort = ("question", "answer", "template", "group")
|
||||||
type = "factFld"
|
if type in noSort:
|
||||||
|
showInfo(_("Please choose a different column to sort on."))
|
||||||
|
type = self.deck.conf['sortType']
|
||||||
if self.deck.conf['sortType'] != type:
|
if self.deck.conf['sortType'] != type:
|
||||||
self.deck.conf['sortType'] = type
|
self.deck.conf['sortType'] = type
|
||||||
# default to descending for non-text fields
|
# default to descending for non-text fields
|
||||||
if type not in ("question", "answer", "factFld"):
|
if type == "factFld":
|
||||||
ord = not ord
|
ord = not ord
|
||||||
self.deck.conf['sortBackwards'] = ord
|
self.deck.conf['sortBackwards'] = ord
|
||||||
self.onSearch()
|
self.onSearch()
|
||||||
|
@ -755,6 +761,12 @@ where id in %s""" % ids2str(sf))
|
||||||
self.model.endReset()
|
self.model.endReset()
|
||||||
self.mw.requireReset()
|
self.mw.requireReset()
|
||||||
|
|
||||||
|
# Group change
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
def changeGroup(self):
|
||||||
|
pass
|
||||||
|
|
||||||
# Tags
|
# Tags
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
|
|
@ -268,6 +268,7 @@
|
||||||
<addaction name="actionAddItems"/>
|
<addaction name="actionAddItems"/>
|
||||||
<addaction name="actionAddCards"/>
|
<addaction name="actionAddCards"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionChangeGroup"/>
|
||||||
<addaction name="actionAddTag"/>
|
<addaction name="actionAddTag"/>
|
||||||
<addaction name="actionDeleteTag"/>
|
<addaction name="actionDeleteTag"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
@ -570,6 +571,15 @@
|
||||||
<string>Find &Duplicates...</string>
|
<string>Find &Duplicates...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionChangeGroup">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="icons.qrc">
|
||||||
|
<normaloff>:/icons/stock_group.png</normaloff>:/icons/stock_group.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Change Group</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="icons.qrc"/>
|
<include location="icons.qrc"/>
|
||||||
|
|
Loading…
Reference in a new issue