def compile_from_source(self): if not self.program.cast_custom_option_value('c.compile_from_source', bool, False): return self.compile_dialog = ProgramInfoCCompile(self, self.script_manager, self.program) self.compile_dialog.exec_() self.compile_dialog = None
class ProgramInfoC(ProgramInfo, Ui_ProgramInfoC): def __init__(self, context): ProgramInfo.__init__(self, context) self.setupUi(self) self.compile_dialog = None self.check_show_advanced_options.stateChanged.connect(self.update_ui_state) # overrides ProgramInfo.update_ui_state 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, []))) # overrides ProgramInfo.close_all_dialogs def close_all_dialogs(self): if self.compile_dialog != None: self.compile_dialog.close() # overrides ProgramInfo.get_language_action def get_language_action(self): if self.program.cast_custom_option_value('c.compile_from_source', bool, False): return self.compile_from_source, 'Compile' else: return ProgramInfo.get_language_action(self) def compile_from_source(self): if not self.program.cast_custom_option_value('c.compile_from_source', bool, False): return self.compile_dialog = ProgramInfoCCompile(self, self.script_manager, self.program) self.compile_dialog.exec_() self.compile_dialog = None
class ProgramInfoC(ProgramInfo, Ui_ProgramInfoC): def __init__(self, context): ProgramInfo.__init__(self, context) self.setupUi(self) self.compile_dialog = None self.check_show_advanced_options.stateChanged.connect( self.update_ui_state) # overrides ProgramInfo.update_ui_state 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, []))) # overrides ProgramInfo.close_all_dialogs def close_all_dialogs(self): if self.compile_dialog != None: self.compile_dialog.close() # overrides ProgramInfo.get_language_action def get_language_action(self): if self.program.cast_custom_option_value('c.compile_from_source', bool, False): return self.compile_from_source, 'Compile' else: return ProgramInfo.get_language_action(self) def compile_from_source(self): if not self.program.cast_custom_option_value('c.compile_from_source', bool, False): return self.compile_dialog = ProgramInfoCCompile(self, self.script_manager, self.program) self.compile_dialog.exec_() self.compile_dialog = None