def _select_dbpre(self): path, _ = QtWidgets.QFileDialog.getOpenFileName( self, 'Select dbpre executable', self.lineEditDbpre.text()) if path: self.lineEditDbpre.setText(system.normpath(path)) self.labelDbpreVersion.setText( compilers.DbpreCompiler(path).get_version( ) if Settings().dbpre != '' else '')
def reset(self, all_tabs=False): settings = Settings() # Editor if self.tabWidget.currentIndex() == 0 or all_tabs: self.cb_cursor_pos_in_bytes.setChecked( settings.show_cursor_pos_in_bytes) self.checkBoxShowErrors.setChecked(settings.show_errors) self.checkBoxViewLineNumber.setChecked(settings.display_lines) self.checkBoxHighlightCurrentLine.setChecked( settings.highlight_caret) self.checkBoxHighlightWhitespaces.setChecked( settings.show_whitespaces) self.spinBoxEditorTabLen.setValue(settings.tab_len) self.checkBoxEditorAutoIndent.setChecked( settings.enable_autoindent) self.spinBoxEditorCCTriggerLen.setValue( settings.code_completion_trigger_len) self.rbLowerCaseKwds.setChecked(settings.lower_case_keywords) self.rbUpperCaseKwds.setChecked(not settings.lower_case_keywords) self.lineEditCommentIndicator.setText(settings.comment_indicator) self.checkBoxSmartBackspace.setChecked( settings.enable_smart_backspace) self.checkBoxAutodetectEOL.setChecked(settings.autodetect_eol) self.comboBoxPreferredEOL.setCurrentIndex(settings.preferred_eol) self.comboCcFilterMode.setCurrentIndex( settings.completion_filter_mode) for pos, spin_box, color, picker in zip( settings.margin_positions, self._margin_spin_boxes, settings.margin_colors, self._margin_color_pickers): spin_box.setValue(pos + 1) picker.color = QtGui.QColor(color) # Style if self.tabWidget.currentIndex() == 1 or all_tabs: rb = (self.radioButtonColorDark if settings.dark_style else self.radioButtonColorWhite) rb.setChecked(True) index = self.comboBoxIconTheme.findText(QtGui.QIcon.themeName()) if index != -1: self.comboBoxIconTheme.setCurrentIndex(index) self.fontComboBox.setCurrentFont(QtGui.QFont(settings.font)) self.spinBoxFontSize.setValue(settings.font_size) self.listWidgetColorSchemes.clear() current_index = None self.listWidgetColorSchemes.clear() for style in PYGMENTS_STYLES: self.listWidgetColorSchemes.addItem(style) if style == settings.color_scheme: current_index = self.listWidgetColorSchemes.count() - 1 if current_index: self.listWidgetColorSchemes.setCurrentRow(current_index) # Run if self.tabWidget.currentIndex() == 3 or all_tabs: self.checkBoxRunExtTerm.setChecked(settings.external_terminal) self.lineEditRunTerm.setVisible(sys.platform != 'win32') self.lbl_external_terminal_command.setVisible( sys.platform != 'win32') self.lineEditRunTerm.setEnabled(settings.external_terminal) self.lineEditRunTerm.setText(settings.external_terminal_command) self.tw_run_env.clearContents() self.tw_run_env.setRowCount(0) for key, value in Settings().run_environemnt.items(): index = self.tw_run_env.rowCount() self.tw_run_env.insertRow(index) self.tw_run_env.setItem(index, 0, QtWidgets.QTableWidgetItem(key)) self.tw_run_env.setItem(index, 1, QtWidgets.QTableWidgetItem(value)) self.edit_working_dir.setText(settings.working_dir) # compiler if self.tabWidget.currentIndex() == 2 or all_tabs: self.cbAutoDetectSublmodules.setChecked( Settings().autodetect_submodules) self.cb_copy_runtime_dlls.setVisible(sys.platform == 'win32') self.cb_copy_runtime_dlls.setChecked(Settings().copy_runtime_dlls) self.lineEditOutputDirectory.setText(Settings().output_directory) self.lineEditCobcExts.setText(';'.join(Settings().cobc_extensions)) self.checkBoxFreeFormat.setChecked(settings.free_format) self.comboBoxStandard.setCurrentIndex(int(settings.cobol_standard)) self.lineEditCompilerPath.setText(settings.compiler_path) flags = Settings().compiler_flags self.cb_debugging_line.setChecked( self.cb_debugging_line.text() in flags) self.cb_ftrace.setChecked( self.cb_ftrace.text().replace('&', '') in flags) self.cb_ftraceall.setChecked( self.cb_ftraceall.text().replace('&', '') in flags) self.cb_g.setChecked(self.cb_g.text().replace('&', '') in flags) self.cb_static.setChecked( self.cb_static.text().replace('&', '') in flags) self.cb_debug.setChecked( self.cb_debug.text().replace('&', '') in flags) self.cb_w.setChecked(self.cb_w.text().replace('&', '') in flags) self.cb_wall.setChecked( self.cb_wall.text().replace('&', '') in flags) for v in self.flags_in_checkbox: try: flags.remove(v) except ValueError: pass self.lineEditLibs.setText(settings.libraries) self.listWidgetLibPaths.addItems([ pth for pth in settings.library_search_path.split(';') if pth ]) self.listWidgetCopyPaths.addItems( [pth for pth in settings.copybook_paths.split(';') if pth]) self.le_compiler_flags.setText(' '.join(flags)) if system.windows: self.lineEditVCVARS.setText(settings.vcvarsall) self.combo_arch.setCurrentIndex(1 if settings.vcvarsall_arch == 'x64' else 0) self.PATH.setText(settings.path) self.cbPATH.setChecked(settings.path_enabled) self.COB_CONFIG_DIR.setText(settings.cob_config_dir) self.cbCOB_CONFIG_DIR.setChecked(settings.cob_config_dir_enabled) self.COB_COPY_DIR.setText(settings.cob_copy_dir) self.cbCOB_COPY_DIR.setChecked(settings.cob_copy_dir_enabled) self.COB_INCLUDE_PATH.setText(settings.cob_include_path) self.cbCOB_INCLUDE_PATH.setChecked( settings.cob_include_path_enabled) self.COB_LIB_PATH.setText(settings.cob_lib_path) self.cbCOB_LIB_PATH.setChecked(settings.cob_lib_path_enabled) # SQL Cobol if self.tabWidget.currentIndex() == 4 or all_tabs: self.lineEditDbpreExts.setText(';'.join( Settings().dbpre_extensions)) self.lineEditDbpre.setText(settings.dbpre) self.lineEditDbpreFramework.setText(settings.dbpre_framework) self.lineEditCobmysqlapi.setText(settings.cobmysqlapi) self.lineEditDBHOST.setText(settings.dbhost) self.lineEditDBUSER.setText(settings.dbuser) self.lineEditDBPASSWD.setText(settings.dbpasswd) self.lineEditDBNAME.setText(settings.dbname) self.lineEditDBPORT.setText(settings.dbport) self.lineEditDBSOCKET.setText(settings.dbsocket) self.labelDbpreVersion.setText(compilers.DbpreCompiler( ).get_version() if Settings().dbpre != '' else '') self.lineEditESQLOC.setText(settings.esqloc) self.lineEditesqlOcExts.setText(';'.join( Settings().esqloc_extensions))