def update_ui_state(self): show_advanced_options = self.check_show_advanced_options.isChecked() # version def cb_octave_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('octave', cb_octave_versions) # start mode start_mode_api_name = self.program.cast_custom_option_value('octave.start_mode', str, '<unknown>') start_mode = Constants.get_octave_start_mode(start_mode_api_name) start_mode_script_file = start_mode == Constants.OCTAVE_START_MODE_SCRIPT_FILE self.label_start_mode.setText(Constants.octave_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('octave.script_file', str, '<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('octave.options', str, [])))
def update_ui_state(self): show_advanced_options = self.check_show_advanced_options.isChecked() # version def cb_octave_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('octave', cb_octave_versions) # start mode start_mode_api_name = self.program.cast_custom_option_value('octave.start_mode', unicode, '<unknown>') start_mode = Constants.get_octave_start_mode(start_mode_api_name) start_mode_script_file = start_mode == Constants.OCTAVE_START_MODE_SCRIPT_FILE self.label_start_mode.setText(Constants.octave_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('octave.script_file', 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('octave.options', unicode, [])))
def initializePage(self): self.set_formatted_sub_title('Specify how the {language} program [{name}] should be executed.') self.update_combo_version('octave', self.combo_version) self.combo_start_mode.setCurrentIndex(Constants.DEFAULT_OCTAVE_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() self.option_list_editor.add_item('--silent') # FIXME: check if X11 service is enabled instead self.is_full_image = self.wizard().image_version.flavor == 'full' if not self.is_full_image: self.option_list_editor.add_item('--no-window-system') # 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('octave.start_mode', str, '<unknown>') start_mode = Constants.get_octave_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('octave.script_file', 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('octave.options', str, []): self.option_list_editor.add_item(option) self.update_ui_state()