1

Minor fixups

Former-commit-id: 7e6057db62be3251f7f8ffffbbc7d054e92eb1b6
This commit is contained in:
Alex Yatskov 2015-02-15 13:25:45 +09:00
parent fed32e4de9
commit a7813b9acd
2 changed files with 8 additions and 7 deletions

View File

@ -4,12 +4,12 @@
"fgColor": 4278190080,
"fontFamily": "Arial",
"fontSize": 12,
"rememberTextBoxContent": true,
"rememberTextContent": false,
"loadRecentFile": false,
"maxResults": 20,
"profiles": {},
"recentFiles": [],
"textBoxContent": "",
"textContent": "",
"scanLength": 16,
"stripReadings": false,
"tags": [],

View File

@ -60,10 +60,10 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
self.updateVocabDefs()
self.updateKanjiDefs()
if self.preferences['rememberTextBoxContent']:
self.textContent.setPlainText(self.preferences['textBoxContent'])
elif filename is not None:
if filename is not None:
self.openFile(filename)
elif self.preferences['rememberTextContent']:
self.textContent.setPlainText(self.preferences['textContent'])
elif self.preferences['loadRecentFile']:
filenames = self.preferences.recentFiles()
if len(filenames) > 0 and os.path.isfile(filenames[0]):
@ -135,8 +135,6 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
def closeEvent(self, event):
if self.preferences['rememberTextBoxContent']: # Before closeFile() because that clears the window
self.preferences['textBoxContent'] = unicode(self.textContent.toPlainText())
self.closeFile()
self.preferences['windowState'] = str(self.saveState().toBase64())
self.preferences.save()
@ -381,6 +379,9 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
def closeFile(self):
if self.preferences['rememberTextContent']:
self.preferences['textContent'] = unicode(self.textContent.toPlainText())
self.setWindowTitle('Yomichan')
self.textContent.setPlainText(unicode())
self.updateRecentFile(False)