1

Updating UI for preference dialog

Former-commit-id: d5e16b08b55ef474e94fa5d94f5f1f486befc418
This commit is contained in:
Alex Yatskov 2013-11-11 15:16:41 -08:00
parent d279b2bf28
commit 6b63422efb
6 changed files with 108 additions and 73 deletions

View File

@ -23,7 +23,7 @@
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QFormLayout" name="formLayout_2">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="checkLoadRecentFile">
<property name="text">
@ -46,13 +46,33 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Max search results</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="spinMaxResults">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Text scan length</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QSpinBox" name="spinScanLength">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -136,6 +156,47 @@
<string>Anki</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Profile</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonVocab">
<property name="text">
<string>Vocabulary</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonKanji">
<property name="text">
<string>Kanji</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
@ -202,47 +263,6 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Profile</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonVocab">
<property name="text">
<string>Vocabulary</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonKanji">
<property name="text">
<string>Kanji</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui/about.ui'
#
# Created: Sun Nov 10 17:56:51 2013
# Created: Mon Nov 11 15:13:30 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui/preferences.ui'
#
# Created: Sun Nov 10 17:56:51 2013
# Created: Mon Nov 11 15:13:30 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
@ -33,20 +33,32 @@ class Ui_DialogPreferences(object):
self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
self.tabGeneral = QtGui.QWidget()
self.tabGeneral.setObjectName(_fromUtf8("tabGeneral"))
self.formLayout_2 = QtGui.QFormLayout(self.tabGeneral)
self.formLayout_2.setObjectName(_fromUtf8("formLayout_2"))
self.formLayout = QtGui.QFormLayout(self.tabGeneral)
self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.checkLoadRecentFile = QtGui.QCheckBox(self.tabGeneral)
self.checkLoadRecentFile.setObjectName(_fromUtf8("checkLoadRecentFile"))
self.formLayout_2.setWidget(0, QtGui.QFormLayout.SpanningRole, self.checkLoadRecentFile)
self.formLayout.setWidget(0, QtGui.QFormLayout.SpanningRole, self.checkLoadRecentFile)
self.checkStripReadings = QtGui.QCheckBox(self.tabGeneral)
self.checkStripReadings.setObjectName(_fromUtf8("checkStripReadings"))
self.formLayout_2.setWidget(1, QtGui.QFormLayout.SpanningRole, self.checkStripReadings)
self.formLayout.setWidget(1, QtGui.QFormLayout.SpanningRole, self.checkStripReadings)
self.checkCheckForUpdates = QtGui.QCheckBox(self.tabGeneral)
self.checkCheckForUpdates.setObjectName(_fromUtf8("checkCheckForUpdates"))
self.formLayout_2.setWidget(2, QtGui.QFormLayout.SpanningRole, self.checkCheckForUpdates)
self.formLayout.setWidget(2, QtGui.QFormLayout.SpanningRole, self.checkCheckForUpdates)
self.label_2 = QtGui.QLabel(self.tabGeneral)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_2)
self.spinMaxResults = QtGui.QSpinBox(self.tabGeneral)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.spinMaxResults.sizePolicy().hasHeightForWidth())
self.spinMaxResults.setSizePolicy(sizePolicy)
self.spinMaxResults.setMinimum(1)
self.spinMaxResults.setObjectName(_fromUtf8("spinMaxResults"))
self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.spinMaxResults)
self.label_14 = QtGui.QLabel(self.tabGeneral)
self.label_14.setObjectName(_fromUtf8("label_14"))
self.formLayout_2.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_14)
self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.label_14)
self.spinScanLength = QtGui.QSpinBox(self.tabGeneral)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@ -55,7 +67,7 @@ class Ui_DialogPreferences(object):
self.spinScanLength.setSizePolicy(sizePolicy)
self.spinScanLength.setMinimum(1)
self.spinScanLength.setObjectName(_fromUtf8("spinScanLength"))
self.formLayout_2.setWidget(3, QtGui.QFormLayout.FieldRole, self.spinScanLength)
self.formLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.spinScanLength)
self.tabWidget.addTab(self.tabGeneral, _fromUtf8(""))
self.tabAppearance = QtGui.QWidget()
self.tabAppearance.setObjectName(_fromUtf8("tabAppearance"))
@ -98,6 +110,21 @@ class Ui_DialogPreferences(object):
self.tabAnki.setObjectName(_fromUtf8("tabAnki"))
self.verticalLayout_2 = QtGui.QVBoxLayout(self.tabAnki)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.label = QtGui.QLabel(self.tabAnki)
self.label.setObjectName(_fromUtf8("label"))
self.horizontalLayout_2.addWidget(self.label)
self.radioButtonVocab = QtGui.QRadioButton(self.tabAnki)
self.radioButtonVocab.setChecked(True)
self.radioButtonVocab.setObjectName(_fromUtf8("radioButtonVocab"))
self.horizontalLayout_2.addWidget(self.radioButtonVocab)
self.radioButtonKanji = QtGui.QRadioButton(self.tabAnki)
self.radioButtonKanji.setObjectName(_fromUtf8("radioButtonKanji"))
self.horizontalLayout_2.addWidget(self.radioButtonKanji)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
self.label_13 = QtGui.QLabel(self.tabAnki)
@ -139,21 +166,6 @@ class Ui_DialogPreferences(object):
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)
self.label.setObjectName(_fromUtf8("label"))
self.horizontalLayout_2.addWidget(self.label)
self.radioButtonVocab = QtGui.QRadioButton(self.tabAnki)
self.radioButtonVocab.setChecked(True)
self.radioButtonVocab.setObjectName(_fromUtf8("radioButtonVocab"))
self.horizontalLayout_2.addWidget(self.radioButtonVocab)
self.radioButtonKanji = QtGui.QRadioButton(self.tabAnki)
self.radioButtonKanji.setObjectName(_fromUtf8("radioButtonKanji"))
self.horizontalLayout_2.addWidget(self.radioButtonKanji)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
self.tabWidget.addTab(self.tabAnki, _fromUtf8(""))
self.verticalLayout.addWidget(self.tabWidget)
self.buttonBox = QtGui.QDialogButtonBox(DialogPreferences)
@ -173,12 +185,16 @@ class Ui_DialogPreferences(object):
self.checkLoadRecentFile.setText(_translate("DialogPreferences", "Load most recent file", None))
self.checkStripReadings.setText(_translate("DialogPreferences", "Strip readings from files", None))
self.checkCheckForUpdates.setText(_translate("DialogPreferences", "Check for updates", None))
self.label_2.setText(_translate("DialogPreferences", "Max search results", None))
self.label_14.setText(_translate("DialogPreferences", "Text scan length", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabGeneral), _translate("DialogPreferences", "General", None))
self.buttonColorFg.setText(_translate("DialogPreferences", "Foreground...", None))
self.buttonColorBg.setText(_translate("DialogPreferences", "Background...", None))
self.textSample.setPlainText(_translate("DialogPreferences", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam accumsan nisi a leo faucibus ut varius velit fringilla. Cras hendrerit eleifend porttitor. Quisque eu elit quis tellus hendrerit ornare et ac tellus. Nunc id felis ut sapien blandit viverra vel ac est. Ut erat lorem, rutrum at scelerisque sollicitudin, lacinia quis diam. Suspendisse potenti. Integer id justo ac ligula aliquet mattis. Etiam malesuada faucibus risus, vel hendrerit elit consectetur quis. Etiam consectetur ipsum ut odio feugiat suscipit. Etiam a tellus metus. ", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabAppearance), _translate("DialogPreferences", "Appearance", None))
self.label.setText(_translate("DialogPreferences", "Profile", None))
self.radioButtonVocab.setText(_translate("DialogPreferences", "Vocabulary", None))
self.radioButtonKanji.setText(_translate("DialogPreferences", "Kanji", 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", None))
@ -186,9 +202,6 @@ class Ui_DialogPreferences(object):
item.setText(_translate("DialogPreferences", "Field", None))
item = self.tableFields.horizontalHeaderItem(1)
item.setText(_translate("DialogPreferences", "Value", None))
self.label.setText(_translate("DialogPreferences", "Profile", None))
self.radioButtonVocab.setText(_translate("DialogPreferences", "Vocabulary", None))
self.radioButtonKanji.setText(_translate("DialogPreferences", "Kanji", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabAnki), _translate("DialogPreferences", "Anki", None))
import resources_rc

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui/reader.ui'
#
# Created: Sun Nov 10 17:56:51 2013
# Created: Mon Nov 11 15:13:30 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Resource object code
#
# Created: Sun Nov 10 17:56:51 2013
# Created: Mon Nov 11 15:13:30 2013
# by: The Resource Compiler for PyQt (Qt v4.8.4)
#
# WARNING! All changes made in this file will be lost!

View File

@ -47,6 +47,7 @@ class DialogPreferences(QtGui.QDialog, gen.preferences_ui.Ui_DialogPreferences):
self.checkCheckForUpdates.setChecked(self.preferences['checkForUpdates'])
self.checkLoadRecentFile.setChecked(self.preferences['loadRecentFile'])
self.checkStripReadings.setChecked(self.preferences['stripReadings'])
self.spinMaxResults.setValue(self.preferences['maxResults'])
self.spinScanLength.setValue(self.preferences['scanLength'])
self.updateSampleText()
@ -63,6 +64,7 @@ class DialogPreferences(QtGui.QDialog, gen.preferences_ui.Ui_DialogPreferences):
def dialogToData(self):
self.preferences['checkForUpdates'] = self.checkCheckForUpdates.isChecked()
self.preferences['loadRecentFile'] = self.checkLoadRecentFile.isChecked()
self.preferences['maxResults'] = self.spinMaxResults.value()
self.preferences['scanLength'] = self.spinScanLength.value()
self.preferences['stripReadings'] = self.checkStripReadings.isChecked()
@ -103,7 +105,7 @@ class DialogPreferences(QtGui.QDialog, gen.preferences_ui.Ui_DialogPreferences):
}[name]
allowedTags = map(lambda t: '<strong>{' + t + '}<strong>', allowedTags)
self.labelTags.setText('Allowed tags: {0}'.format(', '.join(allowedTags)))
self.labelTags.setText('Allowed tags are {0}'.format(', '.join(allowedTags)))
self.updateAnkiFields()