mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -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:
|
||||
return _("(new)")
|
||||
return "%d%%" % (c.factor/10)
|
||||
elif type == "group":
|
||||
return self.browser.mw.deck.groupName(c.gid)
|
||||
|
||||
# def limitContent(self, txt):
|
||||
# if "<c>" in txt:
|
||||
|
@ -325,6 +327,7 @@ class Browser(QMainWindow):
|
|||
c = self.connect; f = self.form; s = SIGNAL("triggered()")
|
||||
c(f.actionAddItems, s, self.mw.onAddCard)
|
||||
c(f.actionDelete, s, self.deleteCards)
|
||||
c(f.actionChangeGroup, s, self.changeGroup)
|
||||
c(f.actionAddTag, s, self.addTags)
|
||||
c(f.actionDeleteTag, s, self.deleteTags)
|
||||
c(f.actionReschedule, s, self.reschedule)
|
||||
|
@ -390,6 +393,7 @@ class Browser(QMainWindow):
|
|||
('question', _("Question")),
|
||||
('answer', _("Answer")),
|
||||
('template', _("Card")),
|
||||
('group', _("Group")),
|
||||
('factFld', _("Sort Field")),
|
||||
('factCrt', _("Created")),
|
||||
('factMod', _("Edited")),
|
||||
|
@ -494,12 +498,14 @@ class Browser(QMainWindow):
|
|||
|
||||
def onSortChanged(self, idx, ord):
|
||||
type = self.model.activeCols[idx]
|
||||
if type in ("question", "answer", "template"):
|
||||
type = "factFld"
|
||||
noSort = ("question", "answer", "template", "group")
|
||||
if type in noSort:
|
||||
showInfo(_("Please choose a different column to sort on."))
|
||||
type = self.deck.conf['sortType']
|
||||
if self.deck.conf['sortType'] != type:
|
||||
self.deck.conf['sortType'] = type
|
||||
# default to descending for non-text fields
|
||||
if type not in ("question", "answer", "factFld"):
|
||||
if type == "factFld":
|
||||
ord = not ord
|
||||
self.deck.conf['sortBackwards'] = ord
|
||||
self.onSearch()
|
||||
|
@ -755,6 +761,12 @@ where id in %s""" % ids2str(sf))
|
|||
self.model.endReset()
|
||||
self.mw.requireReset()
|
||||
|
||||
# Group change
|
||||
######################################################################
|
||||
|
||||
def changeGroup(self):
|
||||
pass
|
||||
|
||||
# Tags
|
||||
######################################################################
|
||||
|
||||
|
|
|
@ -268,6 +268,7 @@
|
|||
<addaction name="actionAddItems"/>
|
||||
<addaction name="actionAddCards"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionChangeGroup"/>
|
||||
<addaction name="actionAddTag"/>
|
||||
<addaction name="actionDeleteTag"/>
|
||||
<addaction name="separator"/>
|
||||
|
@ -570,6 +571,15 @@
|
|||
<string>Find &Duplicates...</string>
|
||||
</property>
|
||||
</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>
|
||||
<resources>
|
||||
<include location="icons.qrc"/>
|
||||
|
|
Loading…
Reference in a new issue