Ejemplo n.º 1
0
    def update_ui_state(self):
        show_advanced_options = self.check_show_advanced_options.isChecked()
        compile_from_source   = self.program.cast_custom_option_value('c.compile_from_source', bool, False)

        # start mode
        start_mode_api_name   = self.program.cast_custom_option_value('c.start_mode', str, '<unknown>')
        start_mode            = Constants.get_c_start_mode(start_mode_api_name)
        start_mode_executable = start_mode == Constants.C_START_MODE_EXECUTABLE

        self.label_start_mode.setText(Constants.c_start_mode_display_names[start_mode])

        # executable
        self.label_executable_title.setVisible(start_mode_executable)
        self.label_executable.setVisible(start_mode_executable)
        self.label_executable.setText(self.program.cast_custom_option_value('c.executable', str, ''))

        # compile from source
        if compile_from_source:
            self.label_compile_from_source.setText('Enabled')
        else:
            self.label_compile_from_source.setText('Disabled')

        # working directory
        self.label_working_directory_title.setVisible(show_advanced_options)
        self.label_working_directory.setVisible(show_advanced_options)
        self.label_working_directory.setText(self.program.working_directory)

        # make options
        self.label_make_options_title.setVisible(compile_from_source and show_advanced_options)
        self.label_make_options.setVisible(compile_from_source and show_advanced_options)
        self.label_make_options.setText('\n'.join(self.program.cast_custom_option_value_list('c.make_options', str, [])))
Ejemplo n.º 2
0
    def update_ui_state(self):
        show_advanced_options = self.check_show_advanced_options.isChecked()
        compile_from_source = self.program.cast_custom_option_value(
            'c.compile_from_source', bool, False)

        # start mode
        start_mode_api_name = self.program.cast_custom_option_value(
            'c.start_mode', str, '<unknown>')
        start_mode = Constants.get_c_start_mode(start_mode_api_name)
        start_mode_executable = start_mode == Constants.C_START_MODE_EXECUTABLE

        self.label_start_mode.setText(
            Constants.c_start_mode_display_names[start_mode])

        # executable
        self.label_executable_title.setVisible(start_mode_executable)
        self.label_executable.setVisible(start_mode_executable)
        self.label_executable.setText(
            self.program.cast_custom_option_value('c.executable', str, ''))

        # compile from source
        if compile_from_source:
            self.label_compile_from_source.setText('Enabled')
        else:
            self.label_compile_from_source.setText('Disabled')

        # working directory
        self.label_working_directory_title.setVisible(show_advanced_options)
        self.label_working_directory.setVisible(show_advanced_options)
        self.label_working_directory.setText(self.program.working_directory)

        # make options
        self.label_make_options_title.setVisible(compile_from_source
                                                 and show_advanced_options)
        self.label_make_options.setVisible(compile_from_source
                                           and show_advanced_options)
        self.label_make_options.setText('\n'.join(
            self.program.cast_custom_option_value_list('c.make_options', str,
                                                       [])))
Ejemplo n.º 3
0
    def initializePage(self):
        self.set_formatted_sub_title(
            'Specify how the {language} program [{name}] should be executed.')

        def cb_gcc_versions(versions):
            if versions[0].version != None:
                gcc = '<b>{0}</b> ({1})'.format(versions[0].executable,
                                                versions[0].version)
            else:
                gcc = '<b>{0}</b>'.format(versions[0].executable)

            if versions[1].version != None:
                gpp = '<b>{0}</b> ({1})'.format(versions[1].executable,
                                                versions[1].version)
            else:
                gpp = '<b>{0}</b>'.format(versions[1].executable)

            self.label_compile_from_source_help_new.setText(
                self.compile_from_source_help_new_template.replace(
                    '<GCC>', gcc).replace('<G++>', gpp))
            self.label_compile_from_source_help_edit.setText(
                self.compile_from_source_help_edit_template.replace(
                    '<GCC>', gcc).replace('<G++>', gpp))

        self.get_executable_versions('gcc', cb_gcc_versions)

        self.combo_start_mode.setCurrentIndex(Constants.DEFAULT_C_START_MODE)
        self.check_compile_from_source.setChecked(False)
        self.check_show_advanced_options.setChecked(False)
        self.combo_working_directory_selector.reset()
        self.make_option_list_editor.reset()

        # if a program exists then this page is used in an edit wizard
        if self.wizard().program != None:
            program = self.wizard().program
            self.edit_mode = True

            # start mode
            start_mode_api_name = program.cast_custom_option_value(
                'c.start_mode', str, '<unknown>')
            start_mode = Constants.get_c_start_mode(start_mode_api_name)

            self.combo_start_mode.setCurrentIndex(start_mode)

            # executable
            self.edit_executable.setText(
                program.cast_custom_option_value('c.executable', str, ''))

            # compile from source
            self.check_compile_from_source.setChecked(
                program.cast_custom_option_value('c.compile_from_source', bool,
                                                 False))

            # working directory
            self.combo_working_directory_selector.set_current_text(
                program.working_directory)

            # make options
            self.make_option_list_editor.clear()

            for make_option in program.cast_custom_option_value_list(
                    'c.make_options', str, []):
                self.make_option_list_editor.add_item(make_option)

        self.update_ui_state()