def editSettings(cls, parent): dlg = cls(parent) if dlg.exec_() != dlg.Accepted: raise DlgRejectedError() settings = Settings() settings.displayLineNumbers = dlg.checkBoxViewLineNumber.isChecked() settings.displayMargins = dlg.checkBoxViewMargins.isChecked() settings.displayStatusBar = dlg.checkBoxViewStatus.isChecked() settings.highlightCurrentLine = dlg.checkBoxHighlightCurrentLine.isChecked() settings.highlightMatchingBraces = dlg.checkBoxHighlightBraces.isChecked() settings.highlightWhitespaces = dlg.checkBoxHighlightWhitespaces.isChecked() settings.tabWidth = dlg.spinBoxEditorTabLen.value() settings.enableAutoIndent = dlg.checkBoxEditorAutoIndent.isChecked() settings.saveOnFocusOut = dlg.checkBoxEditorSaveOnFocusOut.isChecked() settings.ccTriggerLen = dlg.spinBoxEditorCCTriggerLen.value() settings.globalStyle = 'white' if dlg.radioButtonColorWhite.isChecked() else 'dark' settings.fontName = dlg.fontComboBox.currentFont().family() settings.fontSize = dlg.spinBoxFontSize.value() settings.colorScheme = dlg.listWidgetColorSchemes.currentItem().text() settings.runInShell = dlg.checkBoxRunExtTerm.isChecked() settings.shellCommand = dlg.lineEditRunTerm.text() settings.displayControlPanel = dlg.checkBoxViewControlPanel.isChecked() settings.displayToolBar = dlg.checkBoxViewToolBar.isChecked() settings.displayMenuBar = dlg.checkBoxViewMenuBar.isChecked() if dlg.checkBoxCustomPath.isChecked(): settings.customCompilerPath = dlg.lineEditCompilerPath.text() else: settings.customCompilerPath = '' settings.free_format = dlg.checkBoxFreeFormat.isChecked() settings.left_margin = dlg.spinBoxLeftMargin.value() settings.right_margin = dlg.spinBoxRightMargin.value() settings.comment_indicator = dlg.lineEditCommentIndicator.text() settings.cobol_standard = CobolStandard(dlg.comboBoxStandard.currentIndex())
def restoreDefaults(self): settings = Settings() index = self.tabWidget.currentIndex() if index == 0: settings.displayLineNumbers = True settings.displayMargins = True settings.displayStatusBar = True settings.displayMenuBar = False settings.displayControlPanel = True settings.displayToolBar = False settings.highlightCurrentLine = True settings.highlightMatchingBraces = True settings.highlightWhitespaces = False if index == 1: settings.tabWidth = 4 settings.enableAutoIndent = True settings.saveOnFocusOut = True settings.ccTriggerLen = 1 if index == 2: settings.globalStyle = 'white' settings.fontName = None settings.fontSize = 10 settings.colorScheme = 'default' if index == 3: settings.runInShell = False settings.shellCommand = None settings.customCompilerPath = '' if index == 4: settings.free_format = False settings.left_margin = 7 settings.right_margin = 72 settings.cobol_standard = CobolStandard.default settings.comment_indicator = '*>' self.reset()