diff --git a/aqt/main.py b/aqt/main.py index 1bba2d99a..254514c1d 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -695,6 +695,10 @@ and check the statistics for a home deck instead.""")) import aqt.preferences aqt.preferences.Preferences(self) + def onNoteTypes(self): + import aqt.models + aqt.models.Models(self, self, fromMain=True) + def onAbout(self): import aqt.about aqt.about.show(self) @@ -760,6 +764,7 @@ and check the statistics for a home deck instead.""")) self.connect(m.actionStudyDeck, s, self.onStudyDeck) self.connect(m.actionCreateFiltered, s, self.onCram) self.connect(m.actionEmptyCards, s, self.onEmptyCards) + self.connect(m.actionNoteTypes, s, self.onNoteTypes) def updateTitleBar(self): self.setWindowTitle("Anki") diff --git a/aqt/models.py b/aqt/models.py index 74ac700b4..63f7a730e 100644 --- a/aqt/models.py +++ b/aqt/models.py @@ -9,9 +9,10 @@ from anki import stdmodels from aqt.utils import saveGeom, restoreGeom class Models(QDialog): - def __init__(self, mw, parent=None): + def __init__(self, mw, parent=None, fromMain=False): self.mw = mw self.parent = parent or mw + self.fromMain = fromMain QDialog.__init__(self, self.parent, Qt.Window) self.col = mw.col self.mm = self.col.models @@ -38,6 +39,11 @@ class Models(QDialog): c(b, s, self.onRename) b = box.addButton(_("Delete"), t) c(b, s, self.onDelete) + if self.fromMain: + b = box.addButton(_("Fields..."), t) + c(b, s, self.onFields) + b = box.addButton(_("Cards..."), t) + c(b, s, self.onCards) b = box.addButton(_("Options..."), t) c(b, s, self.onAdvanced) c(f.modelsList, SIGNAL("currentRowChanged(int)"), self.modelChanged) @@ -115,6 +121,25 @@ class Models(QDialog): def saveModel(self): self.mm.save(self.model) + def _tmpNote(self): + self.mm.setCurrent(self.model) + n = self.col.newNote() + for name in n.keys(): + n[name] = "("+name+")" + if "{{cloze:Text}}" in self.model['tmpls'][0]['qfmt']: + n['Text'] = _("This is a {{c1::sample}} cloze deletion.") + return n + + def onFields(self): + from aqt.fields import FieldDialog + n = self._tmpNote() + FieldDialog(self.mw, n, parent=self) + + def onCards(self): + from aqt.clayout import CardLayout + n = self._tmpNote() + CardLayout(self.mw, n, ord=0, parent=self, addMode=True) + # Cleanup ########################################################################## diff --git a/designer/main.ui b/designer/main.ui index 22bb1b21a..8c4baac1d 100644 --- a/designer/main.ui +++ b/designer/main.ui @@ -110,6 +110,7 @@ + @@ -257,6 +258,11 @@ F + + + Note Types... + +