-
diff --git a/yomi_base/gen/about_ui.py b/yomi_base/gen/about_ui.py
index eabb966..acd8f31 100644
--- a/yomi_base/gen/about_ui.py
+++ b/yomi_base/gen/about_ui.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui/about.ui'
#
-# Created: Sun Nov 10 12:44:02 2013
+# Created: Sun Nov 10 15:33:42 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
diff --git a/yomi_base/gen/preferences_ui.py b/yomi_base/gen/preferences_ui.py
index d9b3be1..2299c65 100644
--- a/yomi_base/gen/preferences_ui.py
+++ b/yomi_base/gen/preferences_ui.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui/preferences.ui'
#
-# Created: Sun Nov 10 12:44:02 2013
+# Created: Sun Nov 10 15:33:42 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
@@ -135,6 +135,10 @@ class Ui_DialogPreferences(object):
item = QtGui.QTableWidgetItem()
self.tableFields.setHorizontalHeaderItem(1, item)
self.verticalLayout_2.addWidget(self.tableFields)
+ self.labelTags = QtGui.QLabel(self.tabAnki)
+ self.labelTags.setText(_fromUtf8(""))
+ self.labelTags.setObjectName(_fromUtf8("labelTags"))
+ self.verticalLayout_2.addWidget(self.labelTags)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.label = QtGui.QLabel(self.tabAnki)
@@ -177,7 +181,7 @@ class Ui_DialogPreferences(object):
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabAppearance), _translate("DialogPreferences", "Appearance", None))
self.label_13.setText(_translate("DialogPreferences", "Deck", None))
self.label_12.setText(_translate("DialogPreferences", "Model", None))
- self.label_11.setText(_translate("DialogPreferences", "
Specify how your model fields are populated when adding facts.
Allowed tags: {expression}, {reading}, {glossary} and {sentence}
", None))
+ self.label_11.setText(_translate("DialogPreferences", "Specify how your model fields are populated when adding facts", None))
item = self.tableFields.horizontalHeaderItem(0)
item.setText(_translate("DialogPreferences", "Field", None))
item = self.tableFields.horizontalHeaderItem(1)
diff --git a/yomi_base/gen/reader_ui.py b/yomi_base/gen/reader_ui.py
index f801380..97b9017 100644
--- a/yomi_base/gen/reader_ui.py
+++ b/yomi_base/gen/reader_ui.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui/reader.ui'
#
-# Created: Sun Nov 10 12:44:02 2013
+# Created: Sun Nov 10 15:33:42 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
diff --git a/yomi_base/gen/resources_rc.py b/yomi_base/gen/resources_rc.py
index 5133f26..173fb69 100644
--- a/yomi_base/gen/resources_rc.py
+++ b/yomi_base/gen/resources_rc.py
@@ -2,7 +2,7 @@
# Resource object code
#
-# Created: Sun Nov 10 12:44:02 2013
+# Created: Sun Nov 10 15:33:42 2013
# by: The Resource Compiler for PyQt (Qt v4.8.4)
#
# WARNING! All changes made in this file will be lost!
diff --git a/yomi_base/preferences.py b/yomi_base/preferences.py
index d782bce..a41fe37 100644
--- a/yomi_base/preferences.py
+++ b/yomi_base/preferences.py
@@ -80,7 +80,7 @@ class DialogPreferences(QtGui.QDialog, gen.preferences_ui.Ui_DialogPreferences):
def profileToDialog(self):
- profile = self.activeProfile()
+ profile, name = self.activeProfile()
deck = str() if profile is None else profile['deck']
model = str() if profile is None else profile['model']
@@ -97,6 +97,14 @@ class DialogPreferences(QtGui.QDialog, gen.preferences_ui.Ui_DialogPreferences):
self.comboBoxModel.setCurrentIndex(self.comboBoxModel.findText(model))
self.comboBoxModel.blockSignals(False)
+ allowedTags = {
+ 'vocab': ['expression', 'reading', 'glossary', 'sentence'],
+ 'kanji': ['character', 'onyomi', 'kunyomi', 'glossary'],
+ }[name]
+
+ allowedTags = map(lambda t: '{' + t + '}', allowedTags)
+ self.labelTags.setText('Allowed tags: {0}'.format(', '.join(allowedTags)))
+
self.updateAnkiFields()
@@ -178,7 +186,7 @@ class DialogPreferences(QtGui.QDialog, gen.preferences_ui.Ui_DialogPreferences):
self.updateAnkiFields()
self.dialogToProfile()
-
+
def onDeckChanged(self, index):
self.dialogToProfile()
@@ -195,17 +203,17 @@ class DialogPreferences(QtGui.QDialog, gen.preferences_ui.Ui_DialogPreferences):
modelName = self.comboBoxModel.currentText()
fieldNames = self.anki.modelFieldNames(modelName) or list()
- profile = self.activeProfile()
+ profile, name = self.activeProfile()
fields = dict() if profile is None else profile['fields']
self.setAnkiFields(fieldNames, fields)
def activeProfile(self):
- key = 'vocab' if self.radioButtonVocab.isChecked() else 'kanji'
- return self.profiles.get(key)
+ name = 'vocab' if self.radioButtonVocab.isChecked() else 'kanji'
+ return self.profiles.get(name), name
def setActiveProfile(self, profile):
- key = 'vocab' if self.radioButtonVocab.isChecked() else 'kanji'
- self.profiles[key] = profile
+ name = 'vocab' if self.radioButtonVocab.isChecked() else 'kanji'
+ self.profiles[name] = profile