all options are saved to and loaded from settings.ini

This commit is contained in:
Maximilian Siess 2017-04-20 19:48:51 +02:00
parent a170996259
commit ca789ce766
1 changed files with 23 additions and 5 deletions

28
main.py
View File

@ -68,16 +68,30 @@ class Main(QtCore.QObject):
window.groupBox_settings.setTitle("Settings")
window.groupBox_preview.setTitle("Preview")
window.alignmentComboBox.addItem("Left");
window.alignmentComboBox.addItem("Middle");
window.alignmentComboBox.addItem("Right");
window.textXSpinBox.setValue(70);
window.textYSpinBox.setValue(375);
window.alignmentComboBox.addItem("Left")
window.alignmentComboBox.addItem("Middle"
window.alignmentComboBox.addItem("Right")
window.fontsizeSpinBox.setValue(35)
window.textXSpinBox.setValue(70)
window.textYSpinBox.setValue(375)
titleFont = self.settings.value("titleFont")
if not titleFont == None:
window.fontComboBox.setCurrentFont(QFont(titleFont))
alignment = self.settings.value("alignment")
if not alignment == None:
window.alignmentComboBox.setCurrentIndex(int(alignment))
fontSize = self.settings.value("fontSize")
if not fontSize == None:
window.fontsizeSpinBox.setValue(int(fontSize))
xPosition = self.settings.value("xPosition")
if not xPosition == None:
window.textXSpinBox.setValue(int(xPosition))
yPosition = self.settings.value("yPosition")
if not yPosition == None:
window.textYSpinBox.setValue(int(yPosition))
self.drawPreview()
window.show()
@ -88,6 +102,10 @@ class Main(QtCore.QObject):
self.previewThread.wait()
self.settings.setValue("titleFont", self.window.fontComboBox.currentFont().toString())
self.settings.setValue("alignment", str(self.window.alignmentComboBox.currentIndex()))
self.settings.setValue("fontSize", str(self.window.fontsizeSpinBox.value()))
self.settings.setValue("xPosition", str(self.window.textXSpinBox.value()))
self.settings.setValue("yPosition", str(self.window.textYSpinBox.value()))
def openInputFileDialog(self):
inputDir = self.settings.value("inputDir", expanduser("~"))