Beispiel #1
0
    def update_ui_state(self):
        show_advanced_options = self.check_show_advanced_options.isChecked()

        # start mode
        start_mode_api_name   = self.program.cast_custom_option_value('delphi.start_mode', unicode, '<unknown>')
        start_mode            = Constants.get_delphi_start_mode(start_mode_api_name)
        start_mode_executable = start_mode == Constants.DELPHI_START_MODE_EXECUTABLE

        self.label_start_mode.setText(Constants.delphi_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('delphi.executable', unicode, ''))

        # compile from source
        compile_from_source = self.program.cast_custom_option_value('delphi.compile_from_source', bool, False)

        if compile_from_source:
            self.label_compile_from_source.setText('Enabled')
        else:
            self.label_compile_from_source.setText('Disabled')

        # build system
        build_system_api_name = self.program.cast_custom_option_value('delphi.build_system', unicode, '<unknown>')
        build_system          = Constants.get_delphi_build_system(build_system_api_name)
        build_system_fpcmake  = build_system == Constants.DELPHI_BUILD_SYSTEM_FPCMAKE
        build_system_lazbuild = build_system == Constants.DELPHI_BUILD_SYSTEM_LAZBUILD

        self.label_build_system_title.setVisible(compile_from_source)
        self.label_build_system.setVisible(compile_from_source)
        self.label_build_system.setText(Constants.delphi_build_system_display_names[build_system])

        # 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 and build_system_fpcmake)
        self.label_make_options.setVisible(compile_from_source and show_advanced_options and build_system_fpcmake)
        self.label_make_options.setText('\n'.join(self.program.cast_custom_option_value_list('delphi.make_options', unicode, [])))

        # lazbuild options
        self.label_lazbuild_options_title.setVisible(compile_from_source and show_advanced_options and build_system_lazbuild)
        self.label_lazbuild_options.setVisible(compile_from_source and show_advanced_options and build_system_lazbuild)
        self.label_lazbuild_options.setText('\n'.join(self.program.cast_custom_option_value_list('delphi.lazbuild_options', unicode, [])))
Beispiel #2
0
    def initializePage(self):
        self.set_formatted_sub_title(
            'Specify how the {language} program [{name}] should be executed.')

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

            self.label_build_system_fpcmake_help.setText(
                self.build_system_fpcmake_help_template.replace('<FPC>', fpc))

        self.get_executable_versions('fpc', cb_fpc_versions)

        def cb_lazbuild_versions(versions):
            if versions[0].version != None:
                lazbuild = '<b>{0}</b> ({1})'.format(versions[0].executable,
                                                     versions[0].version)
                self.lazbuild_available = True

                self.combo_build_system.setItemText(1, 'lazbuild')
            else:
                lazbuild = '<b>{0}</b>'.format(versions[0].executable)

            self.label_build_system_lazbuild_help.setText(
                self.build_system_lazbuild_help_template.replace(
                    '<LAZBUILD>', lazbuild))

        self.get_executable_versions('lazbuild', cb_lazbuild_versions)

        self.combo_start_mode.setCurrentIndex(
            Constants.DEFAULT_DELPHI_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()
        self.lazbuild_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(
                'delphi.start_mode', str, '<unknown>')
            start_mode = Constants.get_delphi_start_mode(start_mode_api_name)

            self.combo_start_mode.setCurrentIndex(start_mode)

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

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

            # build system
            build_system_api_name = program.cast_custom_option_value(
                'delphi.build_system', str, '<unknown>')
            build_system = Constants.get_delphi_build_system(
                build_system_api_name)

            self.combo_build_system.setCurrentIndex(build_system)

            # 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(
                    'delphi.make_options', str, []):
                self.make_option_list_editor.add_item(make_option)

            # lazbuild options
            self.lazbuild_option_list_editor.clear()

            for lazbuild_option in program.cast_custom_option_value_list(
                    'delphi.lazbuild_options', str, []):
                self.lazbuild_option_list_editor.add_item(lazbuild_option)

        self.update_ui_state()