1

Add checkbox to allow editing the main text area

Former-commit-id: 67061d862173e3acd4c5b7eea9a5a62d84b1b6ba
This commit is contained in:
Alex Yatskov 2015-01-30 18:38:01 +09:00
parent 2173e809a1
commit 63ba3bb6d4
8 changed files with 22 additions and 5 deletions

View File

@ -146,6 +146,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkAllowEditing">
<property name="text">
<string>Allow editing</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabAnki">

View File

@ -11,5 +11,6 @@
"scanLength": 16,
"stripReadings": false,
"tags": [],
"wordWrap": false
"wordWrap": false,
"allowEditing": false
}

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui/about.ui'
#
# Created: Wed Dec 24 17:04:45 2014
# Created: Fri Jan 30 18:21:34 2015
# by: PyQt4 UI code generator 4.10.4
#
# 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: Wed Dec 24 17:04:45 2014
# Created: Fri Jan 30 18:21:34 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
@ -104,6 +104,9 @@ class Ui_DialogPreferences(object):
self.textSample = QtGui.QPlainTextEdit(self.tabAppearance)
self.textSample.setObjectName(_fromUtf8("textSample"))
self.verticalLayout_3.addWidget(self.textSample)
self.checkAllowEditing = QtGui.QCheckBox(self.tabAppearance)
self.checkAllowEditing.setObjectName(_fromUtf8("checkAllowEditing"))
self.verticalLayout_3.addWidget(self.checkAllowEditing)
self.tabWidget.addTab(self.tabAppearance, _fromUtf8(""))
self.tabAnki = QtGui.QWidget()
self.tabAnki.setEnabled(False)
@ -191,6 +194,7 @@ class Ui_DialogPreferences(object):
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.checkAllowEditing.setText(_translate("DialogPreferences", "Allow editing", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabAppearance), _translate("DialogPreferences", "Appearance", None))
self.label.setText(_translate("DialogPreferences", "Displayed profile", None))
self.radioButtonVocab.setText(_translate("DialogPreferences", "Vocabulary", None))

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui/reader.ui'
#
# Created: Wed Dec 24 17:04:45 2014
# Created: Fri Jan 30 18:21:34 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Resource object code
#
# Created: Wed Dec 24 17:04:45 2014
# Created: Fri Jan 30 18:21:34 2015
# by: The Resource Compiler for PyQt (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!

View File

@ -45,6 +45,7 @@ class DialogPreferences(QtGui.QDialog, gen.preferences_ui.Ui_DialogPreferences):
def dataToDialog(self):
self.checkCheckForUpdates.setChecked(self.preferences['checkForUpdates'])
self.checkAllowEditing.setChecked(self.preferences['allowEditing'])
self.checkLoadRecentFile.setChecked(self.preferences['loadRecentFile'])
self.checkStripReadings.setChecked(self.preferences['stripReadings'])
self.spinMaxResults.setValue(self.preferences['maxResults'])
@ -63,6 +64,7 @@ class DialogPreferences(QtGui.QDialog, gen.preferences_ui.Ui_DialogPreferences):
def dialogToData(self):
self.preferences['checkForUpdates'] = self.checkCheckForUpdates.isChecked()
self.preferences['allowEditing'] = self.checkAllowEditing.isChecked()
self.preferences['loadRecentFile'] = self.checkLoadRecentFile.isChecked()
self.preferences['maxResults'] = self.spinMaxResults.value()
self.preferences['scanLength'] = self.spinScanLength.value()

View File

@ -112,6 +112,9 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
palette.setColor(QtGui.QPalette.Text, QtGui.QColor(self.preferences['fgColor']))
self.textContent.setPalette(palette)
self.textContent.setReadOnly(not self.preferences['allowEditing'])
self.textContent.setAttribute(QtCore.Qt.WA_InputMethodEnabled)
font = self.textContent.font()
font.setFamily(self.preferences['fontFamily'])
font.setPointSize(self.preferences['fontSize'] + self.zoom)