Пример #1
0
    def update_ui_state(self):
        show_advanced_options = self.check_show_advanced_options.isChecked()

        # version
        def cb_shell_versions(versions):
            for version in versions:
                if version.executable == self.program.executable:
                    self.label_version.setText(version.version)
                    return

            self.label_version.setText('<unknown>')

        self.get_executable_versions('shell', cb_shell_versions)

        # start mode
        start_mode_api_name = self.program.cast_custom_option_value(
            'shell.start_mode', unicode, '<unknown>')
        start_mode = Constants.get_shell_start_mode(start_mode_api_name)
        start_mode_script_file = start_mode == Constants.SHELL_START_MODE_SCRIPT_FILE
        start_mode_command = start_mode == Constants.SHELL_START_MODE_COMMAND

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

        # script file
        self.label_script_file_title.setVisible(start_mode_script_file)
        self.label_script_file.setVisible(start_mode_script_file)
        self.label_script_file.setText(
            self.program.cast_custom_option_value('shell.script_file', unicode,
                                                  '<unknown>'))

        # command
        self.label_command_title.setVisible(start_mode_command)
        self.label_command.setVisible(start_mode_command)
        self.label_command.setText(
            self.program.cast_custom_option_value('shell.command', unicode,
                                                  '<unknown>'))

        # 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)

        # options
        self.label_options_title.setVisible(show_advanced_options)
        self.label_options.setVisible(show_advanced_options)
        self.label_options.setText('\n'.join(
            self.program.cast_custom_option_value_list('shell.options',
                                                       unicode, [])))
Пример #2
0
    def initializePage(self):
        self.set_formatted_sub_title(
            'Specify how the {language} program [{name}] should be executed.')

        self.update_combo_version('shell', self.combo_version)

        self.combo_start_mode.setCurrentIndex(
            Constants.DEFAULT_SHELL_START_MODE)
        self.combo_script_file_selector.reset()
        self.check_show_advanced_options.setChecked(False)
        self.combo_working_directory_selector.reset()
        self.option_list_editor.reset()

        # if a program exists then this page is used in an edit wizard
        program = self.wizard().program

        if program != None:
            # start mode
            start_mode_api_name = program.cast_custom_option_value(
                'shell.start_mode', str, '<unknown>')
            start_mode = Constants.get_shell_start_mode(start_mode_api_name)

            self.combo_start_mode.setCurrentIndex(start_mode)

            # script file
            self.combo_script_file_selector.set_current_text(
                program.cast_custom_option_value('shell.script_file', str, ''))

            # command
            self.edit_command.setText(
                program.cast_custom_option_value('shell.command', str, ''))

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

            # options
            self.option_list_editor.clear()

            for option in program.cast_custom_option_value_list(
                    'shell.options', str, []):
                self.option_list_editor.add_item(option)

        self.update_ui_state()
Пример #3
0
    def update_ui_state(self):
        show_advanced_options = self.check_show_advanced_options.isChecked()

        self.label_working_directory_title.setVisible(show_advanced_options)
        self.label_working_directory.setVisible(show_advanced_options)
        self.label_options_title.setVisible(show_advanced_options)
        self.label_options.setVisible(show_advanced_options)

        # version
        def cb_shell_versions(versions):
            for version in versions:
                if version.executable == self.program.executable:
                    self.label_version.setText(version.version)
                    return

            self.label_version.setText('<unknown>')

        self.get_executable_versions('shell', cb_shell_versions)

        # start mode
        start_mode_api_name    = self.program.cast_custom_option_value('shell.start_mode', unicode, '<unknown>')
        start_mode             = Constants.get_shell_start_mode(start_mode_api_name)
        start_mode_script_file = start_mode == Constants.SHELL_START_MODE_SCRIPT_FILE
        start_mode_command     = start_mode == Constants.SHELL_START_MODE_COMMAND

        self.label_start_mode.setText(Constants.shell_start_mode_display_names[start_mode])
        self.label_script_file_title.setVisible(start_mode_script_file)
        self.label_script_file.setVisible(start_mode_script_file)
        self.label_command_title.setVisible(start_mode_command)
        self.label_command.setVisible(start_mode_command)

        # script file
        self.label_script_file.setText(self.program.cast_custom_option_value('shell.script_file', unicode, '<unknown>'))

        # command
        self.label_command.setText(self.program.cast_custom_option_value('shell.command', unicode, '<unknown>'))

        # working directory
        self.label_working_directory.setText(self.program.working_directory)

        # options
        self.label_options.setText('\n'.join(self.program.cast_custom_option_value_list('shell.options', unicode, [])))