Updating tags display on preferences
Former-commit-id: ac5a42791baf4758e9805725582f3c2442d5f62c
This commit is contained in:
parent
d9c6a5667d
commit
c4da3eb9c4
@ -177,7 +177,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_11">
|
<widget class="QLabel" name="label_11">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p>Specify how your model fields are populated when adding facts.<br />Allowed tags: <strong>{expression}</strong>, <strong>{reading}</strong>, <strong>{glossary}</strong> and <strong>{sentence}</p></body></html></string>
|
<string>Specify how your model fields are populated when adding facts</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -195,6 +195,13 @@
|
|||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelTags">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'ui/about.ui'
|
# 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
|
# by: PyQt4 UI code generator 4.10
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'ui/preferences.ui'
|
# 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
|
# by: PyQt4 UI code generator 4.10
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
@ -135,6 +135,10 @@ class Ui_DialogPreferences(object):
|
|||||||
item = QtGui.QTableWidgetItem()
|
item = QtGui.QTableWidgetItem()
|
||||||
self.tableFields.setHorizontalHeaderItem(1, item)
|
self.tableFields.setHorizontalHeaderItem(1, item)
|
||||||
self.verticalLayout_2.addWidget(self.tableFields)
|
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 = QtGui.QHBoxLayout()
|
||||||
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
|
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
|
||||||
self.label = QtGui.QLabel(self.tabAnki)
|
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.tabWidget.setTabText(self.tabWidget.indexOf(self.tabAppearance), _translate("DialogPreferences", "Appearance", None))
|
||||||
self.label_13.setText(_translate("DialogPreferences", "Deck", None))
|
self.label_13.setText(_translate("DialogPreferences", "Deck", None))
|
||||||
self.label_12.setText(_translate("DialogPreferences", "Model", None))
|
self.label_12.setText(_translate("DialogPreferences", "Model", None))
|
||||||
self.label_11.setText(_translate("DialogPreferences", "<html><head/><body><p>Specify how your model fields are populated when adding facts.<br />Allowed tags: <strong>{expression}</strong>, <strong>{reading}</strong>, <strong>{glossary}</strong> and <strong>{sentence}</p></body></html>", None))
|
self.label_11.setText(_translate("DialogPreferences", "Specify how your model fields are populated when adding facts", None))
|
||||||
item = self.tableFields.horizontalHeaderItem(0)
|
item = self.tableFields.horizontalHeaderItem(0)
|
||||||
item.setText(_translate("DialogPreferences", "Field", None))
|
item.setText(_translate("DialogPreferences", "Field", None))
|
||||||
item = self.tableFields.horizontalHeaderItem(1)
|
item = self.tableFields.horizontalHeaderItem(1)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'ui/reader.ui'
|
# 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
|
# by: PyQt4 UI code generator 4.10
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Resource object code
|
# 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)
|
# by: The Resource Compiler for PyQt (Qt v4.8.4)
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
@ -80,7 +80,7 @@ class DialogPreferences(QtGui.QDialog, gen.preferences_ui.Ui_DialogPreferences):
|
|||||||
|
|
||||||
|
|
||||||
def profileToDialog(self):
|
def profileToDialog(self):
|
||||||
profile = self.activeProfile()
|
profile, name = self.activeProfile()
|
||||||
|
|
||||||
deck = str() if profile is None else profile['deck']
|
deck = str() if profile is None else profile['deck']
|
||||||
model = str() if profile is None else profile['model']
|
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.setCurrentIndex(self.comboBoxModel.findText(model))
|
||||||
self.comboBoxModel.blockSignals(False)
|
self.comboBoxModel.blockSignals(False)
|
||||||
|
|
||||||
|
allowedTags = {
|
||||||
|
'vocab': ['expression', 'reading', 'glossary', 'sentence'],
|
||||||
|
'kanji': ['character', 'onyomi', 'kunyomi', 'glossary'],
|
||||||
|
}[name]
|
||||||
|
|
||||||
|
allowedTags = map(lambda t: '<strong>{' + t + '}<strong>', allowedTags)
|
||||||
|
self.labelTags.setText('Allowed tags: {0}'.format(', '.join(allowedTags)))
|
||||||
|
|
||||||
self.updateAnkiFields()
|
self.updateAnkiFields()
|
||||||
|
|
||||||
|
|
||||||
@ -195,17 +203,17 @@ class DialogPreferences(QtGui.QDialog, gen.preferences_ui.Ui_DialogPreferences):
|
|||||||
modelName = self.comboBoxModel.currentText()
|
modelName = self.comboBoxModel.currentText()
|
||||||
fieldNames = self.anki.modelFieldNames(modelName) or list()
|
fieldNames = self.anki.modelFieldNames(modelName) or list()
|
||||||
|
|
||||||
profile = self.activeProfile()
|
profile, name = self.activeProfile()
|
||||||
fields = dict() if profile is None else profile['fields']
|
fields = dict() if profile is None else profile['fields']
|
||||||
|
|
||||||
self.setAnkiFields(fieldNames, fields)
|
self.setAnkiFields(fieldNames, fields)
|
||||||
|
|
||||||
|
|
||||||
def activeProfile(self):
|
def activeProfile(self):
|
||||||
key = 'vocab' if self.radioButtonVocab.isChecked() else 'kanji'
|
name = 'vocab' if self.radioButtonVocab.isChecked() else 'kanji'
|
||||||
return self.profiles.get(key)
|
return self.profiles.get(name), name
|
||||||
|
|
||||||
|
|
||||||
def setActiveProfile(self, profile):
|
def setActiveProfile(self, profile):
|
||||||
key = 'vocab' if self.radioButtonVocab.isChecked() else 'kanji'
|
name = 'vocab' if self.radioButtonVocab.isChecked() else 'kanji'
|
||||||
self.profiles[key] = profile
|
self.profiles[name] = profile
|
||||||
|
Loading…
Reference in New Issue
Block a user