Exemple #1
0
    def _run_in_external_terminal(self, program, wd, file_type):
        """
        Runs a program in an external terminal.

        :param program: program to run
        :param wd: working directory
        """
        self.ui.consoleOutput.append(
            "Launched in external terminal")
        pyqode_console = system.which('pyqode-console')
        if file_type == FileType.MODULE:
            program = QtCore.QFileInfo(program).baseName()
        if system.windows:
            cmd = [pyqode_console, program]
            if file_type == FileType.MODULE:
                cmd.insert(1, system.which('cobcrun'))
            subprocess.Popen(cmd, cwd=wd,
                             creationflags=subprocess.CREATE_NEW_CONSOLE)
        elif system.darwin:
            cmd = ['open', program]
            if file_type == FileType.MODULE:
                cmd.insert(1, system.which('cobcrun'))
            subprocess.Popen(cmd, cwd=wd)
        else:
            if file_type == FileType.EXECUTABLE:
                cmd = ['"%s %s"' % (pyqode_console, program)]
            else:
                cmd = ['"%s %s %s"' % (pyqode_console, system.which('cobcrun'),
                                       program)]
            cmd = (Settings().external_terminal_command.strip().split(' ') +
                   cmd)
            subprocess.Popen(' '.join(cmd), cwd=wd, shell=True)
        _logger().info('running program in external terminal: %s',
                       ' '.join(cmd))
Exemple #2
0
 def full_compiler_path(self):
     compiler = self.compiler_path
     if compiler and not os.path.exists(compiler):
         result = system.which(compiler)
         if result is not None:
             compiler = result
     return system.normpath(compiler)
Exemple #3
0
 def full_compiler_path(self):
     compiler = self.compiler_path
     if compiler and not os.path.exists(compiler):
         result = system.which(compiler)
         if result is not None:
             compiler = result
     return system.normpath(compiler)
Exemple #4
0
 def compiler_path(self):
     default = self.default_compiler_path()
     path = self._settings.value('compilerPath', default)
     if not path or \
             (not os.path.exists(path) and system.which(path) is None):
         path = default
         self.compiler_path = path
     return system.normpath(path)
Exemple #5
0
 def compiler_path(self):
     default = self.default_compiler_path()
     path = self._settings.value('compilerPath', default)
     if not path or \
             (not os.path.exists(path) and system.which(path) is None):
         path = default
         self.compiler_path = path
     return system.normpath(path)
 def _check_compiler(self, *_):
     self.apply()
     pth = self.lineEditCompilerPath.text()
     if os.path.exists(pth) or system.which(pth) is not None:
         DlgCheckCompiler.check(self, pth)
     else:
         QtWidgets.QMessageBox.warning(
             self, 'Invalid compiler path',
             'Not a valid compiler path, path does not exists: %s!' % pth)
Exemple #7
0
 def _check_compiler(self, *_):
     self.apply()
     pth = self.lineEditCompilerPath.text()
     if os.path.exists(pth) or system.which(pth) is not None:
         DlgCheckCompiler.check(self, pth)
     else:
         QtWidgets.QMessageBox.warning(
             self, 'Invalid compiler path',
             'Not a valid compiler path, path does not exists: %s!' % pth)
Exemple #8
0
    def _run_in_external_terminal(self, program, wd, file_type):
        """
        Runs a program in an external terminal.

        :param program: program to run
        :param wd: working directory
        """
        self.ui.consoleOutput.append(
            "Launched in external terminal")
        pyqode_console = system.which('pyqode-console')
        env = os.environ.copy()
        for k, v in Settings().run_environemnt.items():
            env[k] = v
        env['PATH'] = GnuCobolCompiler.setup_process_environment().value(
            'PATH')
        if file_type == FileType.MODULE:
            program = QtCore.QFileInfo(program).baseName()
        if system.windows:
            cmd = [pyqode_console, program]
            if file_type == FileType.MODULE:
                cmd.insert(1, system.which('cobcrun'))
            subprocess.Popen(cmd, cwd=wd,
                             creationflags=subprocess.CREATE_NEW_CONSOLE,
                             env=env)
        elif system.darwin:
            cmd = ['open', program]
            if file_type == FileType.MODULE:
                cmd.insert(1, system.which('cobcrun'))
            subprocess.Popen(cmd, cwd=wd, env=env)
        else:
            if file_type == FileType.EXECUTABLE:
                cmd = ['"%s %s"' % (pyqode_console, program)]
            else:
                cmd = ['"%s %s %s"' % (pyqode_console, system.which('cobcrun'),
                                       program)]
            cmd = system.shell_split(
                Settings().external_terminal_command.strip()) + cmd
            subprocess.Popen(' '.join(cmd), cwd=wd, shell=True,
                             env=env)
        _logger().info('running program in external terminal: %s',
                       ' '.join(cmd))
 def _check_compiler(self, *_):
     self.apply()
     pth = self.lineEditCompilerPath.text()
     if os.path.exists(pth) or system.which(pth) is not None:
         p = QtCore.QProcess()
         p.start(pth, ["--version"])
         p.waitForFinished()
         output = bytes(p.readAllStandardOutput()).decode(locale.getpreferredencoding())
         DlgCheckCompiler.check(self, pth, output)
     else:
         QtWidgets.QMessageBox.warning(
             self, "Invalid compiler path", "Not a valid compiler path, path does not exists: %s!" % pth
         )
 def _check_compiler(self, *_):
     self.apply()
     pth = self.lineEditCompilerPath.text()
     if os.path.exists(pth) or system.which(pth) is not None:
         p = QtCore.QProcess()
         p.start(pth, ['--version'])
         p.waitForFinished()
         output = bytes(p.readAllStandardOutput()).decode(
             locale.getpreferredencoding())
         DlgCheckCompiler.check(self, pth, output)
     else:
         QtWidgets.QMessageBox.warning(
             self, 'Invalid compiler path',
             'Not a valid compiler path, path does not exists: %s!' % pth)
Exemple #11
0
        def get_terminal():
            """
            Gets the authentication program used to run command as root (
            on linux only).

            The function try to use one of the following programs:
                - gksu
                - kdesu

            """
            for program in ['gnome-terminal', 'xfce4-terminal', 'konsole']:
                if system.which(program) is not None:
                    return program
            return 'gnome-terminal'
Exemple #12
0
 def _run(self):
     """
     Runs the current editor program.
     :return:
     """
     # compilation has finished, we can run the program that corresponds
     # to the current editor file
     editor = self.app.edit.current_editor
     file_type = editor.file_type
     self.ui.tabWidgetLogs.setCurrentIndex(LOG_PAGE_RUN)
     self.ui.dockWidgetLogs.show()
     self.ui.consoleOutput.clear()
     output_dir = Settings().output_directory
     if not os.path.isabs(output_dir):
         output_dir = os.path.join(os.path.dirname(editor.file.path),
                                   output_dir)
     if Settings().working_dir:
         wd = Settings().working_dir
     else:
         wd = output_dir
     filename = os.path.splitext(editor.file.name)[0] + \
         GnuCobolCompiler().extension_for_type(file_type)
     program = os.path.join(output_dir, filename)
     if not os.path.exists(program):
         _logger().warning('cannot run %s, file does not exists', program)
         return
     _logger().info('running program: %r (working dir=%r)', program, wd)
     if Settings().external_terminal:
         self._run_in_external_terminal(program, wd, file_type)
         self.enable_run(True)
         self.enable_compile(True)
     else:
         self.ui.consoleOutput.setFocus(True)
         for item in self.run_buttons + [self.ui.actionRun]:
             item.setEnabled(False)
         path = GnuCobolCompiler.setup_process_environment().value('PATH')
         env = Settings().run_environemnt
         if 'PATH' not in list(env.keys()):
             env['PATH'] = path
         if file_type == FileType.MODULE:
             cobcrun = system.which('cobcrun')
             self.ui.consoleOutput.start_process(
                 cobcrun, [os.path.splitext(editor.file.name)[0]],
                 working_dir=wd,
                 env=env)
         else:
             self.ui.consoleOutput.start_process(program,
                                                 working_dir=wd,
                                                 env=env,
                                                 print_command=True)
Exemple #13
0
        def get_terminal():
            """
            Gets the authentication program used to run command as root (
            on linux only).

            The function try to use one of the following programs:
                - gksu
                - kdesu

            """
            for program in ['gnome-terminal', 'xfce4-terminal', 'konsole']:
                if system.which(program) is not None:
                    return program
            return 'gnome-terminal'
Exemple #14
0
 def default_compiler_path():
     if system.windows:
         # get the bundled compiler path as default
         # compiler on windows
         if getattr(sys, 'frozen', False):
             # The application is frozen
             cwd = os.path.dirname(sys.executable)
             default = os.path.join(cwd, 'GnuCOBOL', 'bin', 'cobc.exe')
         else:
             cwd = os.getcwd()
             default = os.path.join(cwd, 'GnuCOBOL-Win32-MinGW', 'bin',
                                    'cobc.exe')
     else:
         default = system.which('cobc')
     return system.normpath(default)
Exemple #15
0
 def default_compiler_path():
     if system.windows:
         # get the bundled compiler path as default
         # compiler on windows
         if getattr(sys, 'frozen', False):
             # The application is frozen
             cwd = os.path.dirname(sys.executable)
             default = os.path.join(cwd, 'GnuCOBOL', 'bin', 'cobc.exe')
         else:
             cwd = os.getcwd()
             default = os.path.join(cwd, 'GnuCOBOL-Win32-MinGW', 'bin',
                                    'cobc.exe')
     else:
         default = system.which('cobc', include_settings_path=False)
     return system.normpath(default)
Exemple #16
0
    def _run_in_external_terminal(self, program, wd, file_type):
        """
        Runs a program in an external terminal.

        :param program: program to run
        :param wd: working directory
        """
        self.ui.consoleOutput.append("Launched in external terminal")
        pyqode_console = system.which('pyqode-console')
        if file_type == FileType.MODULE:
            program = QtCore.QFileInfo(program).baseName()
        if system.windows:
            cmd = [pyqode_console, program]
            if file_type == FileType.MODULE:
                cmd.insert(1, system.which('cobcrun'))
            subprocess.Popen(cmd,
                             cwd=wd,
                             creationflags=subprocess.CREATE_NEW_CONSOLE)
        elif system.darwin:
            cmd = ['open', program]
            if file_type == FileType.MODULE:
                cmd.insert(1, system.which('cobcrun'))
            subprocess.Popen(cmd, cwd=wd)
        else:
            if file_type == FileType.EXECUTABLE:
                cmd = ['"%s %s"' % (pyqode_console, program)]
            else:
                cmd = [
                    '"%s %s %s"' %
                    (pyqode_console, system.which('cobcrun'), program)
                ]
            cmd = (Settings().external_terminal_command.strip().split(' ') +
                   cmd)
            subprocess.Popen(' '.join(cmd), cwd=wd, shell=True)
        _logger().info('running program in external terminal: %s',
                       ' '.join(cmd))
Exemple #17
0
 def _run(self):
     """
     Runs the current editor program.
     :return:
     """
     # compilation has finished, we can run the program that corresponds
     # to the current editor file
     editor = self.app.edit.current_editor
     file_type = editor.file_type
     self.ui.tabWidgetLogs.setCurrentIndex(LOG_PAGE_RUN)
     self.ui.dockWidgetLogs.show()
     self.ui.consoleOutput.clear()
     output_dir = Settings().output_directory
     if not os.path.isabs(output_dir):
         output_dir = os.path.join(
             os.path.dirname(editor.file.path), output_dir)
     if Settings().working_dir:
         wd = Settings().working_dir
     else:
         wd = output_dir
     filename = os.path.splitext(editor.file.name)[0] + \
         GnuCobolCompiler().extension_for_type(file_type)
     program = os.path.join(output_dir, filename)
     if not os.path.exists(program):
         _logger().warning('cannot run %s, file does not exists',
                           program)
         return
     _logger().info('running program: %r (working dir=%r)', program, wd)
     if Settings().external_terminal:
         self._run_in_external_terminal(program, wd, file_type)
         self.enable_run(True)
         self.enable_compile(True)
     else:
         self.ui.consoleOutput.setFocus(True)
         for item in self.run_buttons + [self.ui.actionRun]:
             item.setEnabled(False)
         path = GnuCobolCompiler.setup_process_environment().value('PATH')
         env = Settings().run_environemnt
         if 'PATH' not in env.keys():
             env['PATH'] = path
         if file_type == FileType.MODULE:
             cobcrun = system.which('cobcrun')
             self.ui.consoleOutput.start_process(
                 cobcrun, [os.path.splitext(editor.file.name)[0]], working_dir=wd, env=env)
         else:
             self.ui.consoleOutput.start_process(program, working_dir=wd, env=env, print_command=True)
Exemple #18
0
    def _run_in_external_terminal(self, program, wd):
        """
        Runs a program in an external terminal.

        :param program: program to run
        :param wd: working directory
        """
        self.ui.consoleOutput.append(
            "Launched in external terminal")
        pyqode_console = system.which('pyqode-console')
        if system.windows:
            cmd = [pyqode_console, program]
            subprocess.Popen(cmd, cwd=wd,
                             creationflags=subprocess.CREATE_NEW_CONSOLE)
        elif system.darwin:
            cmd = ['open', program]
            subprocess.Popen(cmd, cwd=wd)
        else:
            cmd = (Settings().external_terminal_command.strip().split(' ') +
                   ['"%s %s"' % (pyqode_console, program)])
            # os.system(' '.join(cmd))
            subprocess.Popen(' '.join(cmd), cwd=wd, shell=True)
        _logger().info('running program in external terminal: %s',
                       ' '.join(cmd))
Exemple #19
0
    def _run_in_external_terminal(self, program, wd):
        """
        Runs a program in an external terminal.

        :param program: program to run
        :param wd: working directory
        """
        self.ui.consoleOutput.append(
            "Launched in external terminal")
        pyqode_console = system.which('pyqode-console')
        if system.windows:
            cmd = [pyqode_console, program]
            subprocess.Popen(cmd, cwd=wd,
                             creationflags=subprocess.CREATE_NEW_CONSOLE)
        elif system.darwin:
            cmd = ['open', program]
            subprocess.Popen(cmd, cwd=wd)
        else:
            cmd = (Settings().external_terminal_command.strip().split(' ') +
                   ['"%s %s"' % (pyqode_console, program)])
            # os.system(' '.join(cmd))
            subprocess.Popen(' '.join(cmd), cwd=wd, shell=True)
        _logger().info('running program in external terminal: %s',
                       ' '.join(cmd))
Exemple #20
0
    def _run_in_external_terminal(self, program, wd, file_type):
        """
        Runs a program in an external terminal.

        :param program: program to run
        :param wd: working directory
        """
        pyqode_console = system.which('pyqode-console')
        cobc_run_insert_pos = 1
        if pyqode_console is None:
            from pyqode.core.tools import console
            pyqode_console = [sys.executable, console.__file__]
            cobc_run_insert_pos = 2
        else:
            pyqode_console = [pyqode_console]
        env = os.environ.copy()
        for k, v in list(Settings().run_environemnt.items()):
            env[k] = v
        if 'PATH' not in list(Settings().run_environemnt.keys()):
            env['PATH'] = GnuCobolCompiler.setup_process_environment().value(
                'PATH')
        if file_type == FileType.MODULE:
            program = QtCore.QFileInfo(program).baseName()
        if system.windows:
            cmd = pyqode_console + [program]
            if file_type == FileType.MODULE:
                cmd.insert(cobc_run_insert_pos, system.which('cobcrun'))
            try:
                _logger().debug(
                    "running program in external terminal: %r, %r, %r" %
                    (cmd, wd, env))
                subprocess.Popen(cmd,
                                 cwd=wd,
                                 creationflags=subprocess.CREATE_NEW_CONSOLE,
                                 env=env)
            except (OSError, subprocess.CalledProcessError):
                msg = "Failed to launch program in external terminal (cmd=%s) " % ' '.join(
                    cmd)
                _logger().exception(msg)
                self.ui.consoleOutput.appendPlainText(msg)
                return
        elif system.darwin:
            if file_type == FileType.MODULE:
                create_script(PATH_RUN_MODULE_SCRIPT, RUN_MODULE_SCRIPT,
                              (wd, system.which('cobcrun'), program))
                cmd = [
                    'open', '-n', '-a', 'Terminal', '--args',
                    PATH_RUN_MODULE_SCRIPT
                ]
            else:
                create_script(PATH_RUN_PROGRAM_SCRIPT, RUN_PROGRAM_SCRIPT,
                              (wd, program))
                cmd = [
                    'open', '-n', '-a', 'Terminal', '--args',
                    PATH_RUN_PROGRAM_SCRIPT
                ]
            try:
                subprocess.Popen(cmd, cwd=wd, env=env)
            except (OSError, subprocess.CalledProcessError):
                msg = "Failed to launch program in external terminal (cmd=%s) " % ' '.join(
                    cmd)
                _logger().exception(msg)
                self.ui.consoleOutput.appendPlainText(msg)
                return
        else:
            if file_type == FileType.EXECUTABLE:
                cmd = ['"%s %s"' % (' '.join(pyqode_console), program)]
            else:
                cmd = [
                    '"%s %s %s"' % (' '.join(pyqode_console),
                                    system.which('cobcrun'), program)
                ]
            cmd = system.shell_split(
                Settings().external_terminal_command.strip()) + cmd
            try:
                subprocess.Popen(' '.join(cmd), cwd=wd, shell=True, env=env)
            except (OSError, subprocess.CalledProcessError):
                msg = "Failed to launch program in external terminal (cmd=%s) " % ' '.join(
                    cmd)
                _logger().exception(msg)
                self.ui.consoleOutput.appendPlainText(msg)
                return
        _logger().info('running program in external terminal: %s',
                       ' '.join(cmd))
        self.ui.consoleOutput.appendPlainText(
            "Launched in external terminal: %s" % ' '.join(cmd))
 def reset(self, all_tabs=False):
     settings = Settings()
     # Editor
     if self.tabWidget.currentIndex() == 0 or all_tabs:
         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.lineEditCommentIndicator.setText(settings.comment_indicator)
     # 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(settings.icon_theme)
         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
         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.lineEditRunTerm.setEnabled(settings.external_terminal)
         self.lineEditRunTerm.setText(settings.external_terminal_command)
     # compiler
     if self.tabWidget.currentIndex() == 2 or all_tabs:
         self.checkBoxFreeFormat.setChecked(settings.free_format)
         self.comboBoxStandard.setCurrentIndex(
             int(settings.cobol_standard))
         self.checkBoxCustomPath.setChecked(
             settings.custom_compiler_path != system.which('cobc'))
         self.lineEditCompilerPath.setText(settings.custom_compiler_path)
         self.lineEditCompilerPath.setEnabled(
             self.checkBoxCustomPath.isChecked())
         flags = Settings().compiler_flags
         self.cb_debugging_line.setChecked(
             self.cb_debugging_line.text() in flags)
         self.cb_ftrace.setChecked(self.cb_ftrace.text() in flags)
         self.cb_ftraceall.setChecked(self.cb_ftraceall.text() in flags)
         self.cb_g.setChecked(self.cb_g.text() in flags)
         self.cb_static.setChecked(self.cb_static.text() in flags)
         for v in self.flags_in_checkbox:
             try:
                 flags.remove(v)
             except ValueError:
                 pass
         self.le_compiler_flags.setText(' '.join(flags))
Exemple #22
0
    def _run_in_external_terminal(self, program, wd, file_type):
        """
        Runs a program in an external terminal.

        :param program: program to run
        :param wd: working directory
        """
        pyqode_console = system.which('pyqode-console')
        cobc_run_insert_pos = 1
        if pyqode_console is None:
            from pyqode.core.tools import console
            pyqode_console = [sys.executable, console.__file__]
            cobc_run_insert_pos = 2
        else:
            pyqode_console = [pyqode_console]
        env = os.environ.copy()
        for k, v in Settings().run_environemnt.items():
            env[k] = v
        if 'PATH' not in Settings().run_environemnt.keys():
            env['PATH'] = GnuCobolCompiler.setup_process_environment().value(
                'PATH')
        if file_type == FileType.MODULE:
            program = QtCore.QFileInfo(program).baseName()
        if system.windows:
            cmd = pyqode_console + [program]
            if file_type == FileType.MODULE:
                cmd.insert(cobc_run_insert_pos, system.which('cobcrun'))
            try:
                _logger().debug("running program in external terminal: %r, %r, %r" % (cmd, wd, env))
                subprocess.Popen(cmd, cwd=wd, creationflags=subprocess.CREATE_NEW_CONSOLE, env=env)
            except (OSError, subprocess.CalledProcessError):
                msg = "Failed to launch program in external terminal (cmd=%s) " % ' '.join(cmd)
                _logger().exception(msg)
                self.ui.consoleOutput.appendPlainText(msg)
                return
        elif system.darwin:
            if file_type == FileType.MODULE:
                create_script(PATH_RUN_MODULE_SCRIPT, RUN_MODULE_SCRIPT, (wd, system.which('cobcrun'), program))
                cmd = ['open', '-n', '-a', 'Terminal', '--args', PATH_RUN_MODULE_SCRIPT]
            else:
                create_script(PATH_RUN_PROGRAM_SCRIPT, RUN_PROGRAM_SCRIPT, (wd, program))
                cmd = ['open', '-n', '-a', 'Terminal', '--args', PATH_RUN_PROGRAM_SCRIPT]
            try:
                subprocess.Popen(cmd, cwd=wd, env=env)
            except (OSError, subprocess.CalledProcessError):
                msg = "Failed to launch program in external terminal (cmd=%s) " % ' '.join(cmd)
                _logger().exception(msg)
                self.ui.consoleOutput.appendPlainText(msg)
                return
        else:
            if file_type == FileType.EXECUTABLE:
                cmd = ['"%s %s"' % (' '.join(pyqode_console), program)]
            else:
                cmd = ['"%s %s %s"' % (' '.join(pyqode_console), system.which('cobcrun'), program)]
            cmd = system.shell_split(Settings().external_terminal_command.strip()) + cmd
            try:
                subprocess.Popen(' '.join(cmd), cwd=wd, shell=True, env=env)
            except (OSError, subprocess.CalledProcessError):
                msg = "Failed to launch program in external terminal (cmd=%s) " % ' '.join(cmd)
                _logger().exception(msg)
                self.ui.consoleOutput.appendPlainText(msg)
                return
        _logger().info('running program in external terminal: %s', ' '.join(cmd))
        self.ui.consoleOutput.appendPlainText("Launched in external terminal: %s" % ' '.join(cmd))
Exemple #23
0
 def reset(self, all_tabs=False):
     settings = Settings()
     # Editor
     if self.tabWidget.currentIndex() == 0 or all_tabs:
         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.lineEditCommentIndicator.setText(settings.comment_indicator)
         self.checkBoxSmartBackspace.setChecked(
             settings.enable_smart_backspace)
     # 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(settings.icon_theme)
         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.lineEditRunTerm.setEnabled(settings.external_terminal)
         self.lineEditRunTerm.setText(settings.external_terminal_command)
     # compiler
     if self.tabWidget.currentIndex() == 2 or all_tabs:
         self.checkBoxFreeFormat.setChecked(settings.free_format)
         self.comboBoxStandard.setCurrentIndex(
             int(settings.cobol_standard))
         self.checkBoxCustomPath.setChecked(
             settings.custom_compiler_path != system.which('cobc'))
         self.lineEditCompilerPath.setText(settings.custom_compiler_path)
         self.lineEditCompilerPath.setEnabled(
             self.checkBoxCustomPath.isChecked())
         flags = Settings().compiler_flags
         self.cb_debugging_line.setChecked(
             self.cb_debugging_line.text() in flags)
         self.cb_ftrace.setChecked(self.cb_ftrace.text() in flags)
         self.cb_ftraceall.setChecked(self.cb_ftraceall.text() in flags)
         self.cb_g.setChecked(self.cb_g.text() in flags)
         self.cb_static.setChecked(self.cb_static.text() in flags)
         for v in self.flags_in_checkbox:
             try:
                 flags.remove(v)
             except ValueError:
                 pass
         self.le_compiler_flags.setText(' '.join(flags))