1""" 2Copyright (c) 2017 Eliakin Costa <eliakim170@gmail.com> 3 4This program is free software; you can redistribute it and/or modify 5it under the terms of the GNU General Public License as published by 6the Free Software Foundation; either version 2 of the License, or 7(at your option) any later version. 8 9This program is distributed in the hope that it will be useful, 10but WITHOUT ANY WARRANTY; without even the implied warranty of 11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12GNU General Public License for more details. 13 14You should have received a copy of the GNU General Public License 15along with this program; if not, write to the Free Software 16Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17""" 18from PyQt5.QtWidgets import QDialog, QFormLayout 19from . import syntaxstylescombobox, fontscombobox 20import krita 21 22 23class SettingsDialog(QDialog): 24 25 def __init__(self, scripter, parent=None): 26 super(SettingsDialog, self).__init__(parent) 27 28 self.scripter = scripter 29 self.setWindowTitle(i18n("Settings")) 30 self.mainLayout = QFormLayout(self) 31 self.mainLayout.addRow(i18n("Syntax highlighter:"), syntaxstylescombobox.SyntaxStylesComboBox(self.scripter.uicontroller.highlight, self.scripter.uicontroller.editor)) 32 self.mainLayout.addRow(i18n("Fonts:"), fontscombobox.FontsComboBox(self.scripter.uicontroller.editor)) 33 34 def readSettings(self, settings): 35 for index in range(self.mainLayout.rowCount()): 36 widget = self.mainLayout.itemAt(index, QFormLayout.FieldRole).widget() 37 widget.readSettings(settings) 38 39 def writeSettings(self, settings): 40 for index in range(self.mainLayout.rowCount()): 41 widget = self.mainLayout.itemAt(index, QFormLayout.FieldRole).widget() 42 widget.writeSettings(settings) 43