From be6c69cba7c4e5028261f058c56114c6323d77b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=B6then=2C=20Marvin?= Date: Thu, 16 Nov 2023 09:38:07 +0000 Subject: [PATCH 001/130] Resolve "Fix pipeline" --- src/module/module.pro | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/module/module.pro b/src/module/module.pro index 11660b1..2f05a9e 100644 --- a/src/module/module.pro +++ b/src/module/module.pro @@ -223,7 +223,11 @@ CONFIG(debug, debug|release){ } # THIRD PARTY - win32: LIBS += -lPythonQt-Qt5-Python$${PY_VERSION}_d + greaterThan(MAJOR_VERSION, 1) { + win32: LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}.$${PY_MINOR_VERSION}_d + } else { + win32: LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}$${PY_MINOR_VERSION}_d + } unix { LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}.$${PY_MINOR_VERSION} @@ -250,7 +254,12 @@ CONFIG(debug, debug|release){ # GTLAB MODULES # THIRD PARTY - win32: LIBS += -lPythonQt-Qt5-Python$${PY_VERSION} + greaterThan(MAJOR_VERSION, 1) { + win32: LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}.$${PY_MINOR_VERSION} + } else { + win32: LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}$${PY_MINOR_VERSION} + } + unix { LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}.$${PY_MINOR_VERSION} From 84e140e6febabf3c19ba315a39acb1060b5627da Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Fri, 8 Dec 2023 13:45:14 +0100 Subject: [PATCH 002/130] Initial cmake support --- CMakeLists.txt | 61 +++ cmake/CodeCoverage.cmake | 609 ++++++++++++++++++++++ cmake/FindPythonQt.cmake | 47 ++ cmake/GTlab.cmake | 169 ++++++ cmake/GTlabPythonConfig.in | 25 + src/batch/CMakeLists.txt | 31 ++ src/module/CMakeLists.txt | 239 +++++++++ src/setup_module/CMakeLists.txt | 45 ++ tests/unittests/CMakeLists.txt | 21 + tests/unittests/cmake/AddGoogleTest.cmake | 83 +++ 10 files changed, 1330 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/CodeCoverage.cmake create mode 100644 cmake/FindPythonQt.cmake create mode 100644 cmake/GTlab.cmake create mode 100644 cmake/GTlabPythonConfig.in create mode 100644 src/batch/CMakeLists.txt create mode 100644 src/module/CMakeLists.txt create mode 100644 src/setup_module/CMakeLists.txt create mode 100644 tests/unittests/CMakeLists.txt create mode 100644 tests/unittests/cmake/AddGoogleTest.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..cc6d27e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,61 @@ +# ______________ __ +# / ____/_ __/ /___ / /_ +# / / __ / / / / __ `/ __ +# / /_/ / / / / / /_/ / /_/ / +# ____/ /_/ /_/\__,_/_.___/ +###################################################################### + +cmake_minimum_required(VERSION 3.15) + +project(GTlab-Python VERSION 1.4.2) + +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +find_package(Qt5 REQUIRED COMPONENTS Widgets Core Gui Xml Svg) +find_package(Python3 REQUIRED COMPONENTS Development) + +set(Python3_VERSION_SUFFIX "${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}") + +include(GTlab) + +gtlab_standard_setup() +enable_gtlab_devtools() + +if(NOT TARGET GTlab::Core) + find_package(GTlab REQUIRED) +endif() + +find_package(PythonQt REQUIRED) + + +option(BUILD_WITH_COVERAGE "Build with code coverage (linux only)" OFF) +option(BUILD_UNITTESTS "Build Unittests" OFF) + +if (BUILD_WITH_COVERAGE) + set(CODE_COVERAGE_VERBOSE ON) + include(CodeCoverage) + append_coverage_compiler_flags() +endif(BUILD_WITH_COVERAGE) + +add_subdirectory(src/module) +add_subdirectory(src/setup_module) +add_subdirectory(src/batch) + +if (BUILD_UNITTESTS) + enable_testing() + add_subdirectory(tests/unittests) +endif () + +if (BUILD_UNITTESTS AND BUILD_WITH_COVERAGE) + setup_target_for_coverage_lcov( + NAME test-coverage + EXECUTABLE GTlabDataAnalyticsUnitTests + EXCLUDE "tests/*" "build*" "/usr/*" "/opt/*" "/home/gitlab-runner/*" + BASE_DIRECTORY "${PROJECT_SOURCE_DIR}") +endif() + +include(CPack) +set(CPACK_PACKAGE_VENDOR "DLR AT") +set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") +set(CPACK_SOURCE_GENERATOR "TGZ;ZIP") + diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake new file mode 100644 index 0000000..ef8be71 --- /dev/null +++ b/cmake/CodeCoverage.cmake @@ -0,0 +1,609 @@ +# SPDX-FileCopyrightText: (c) 2012 - 2017, Lars Bilke +# +# SPDX-License-Identifier: BSL-1.0 + +include(CMakeParseArguments) + +option(CODE_COVERAGE_VERBOSE "Verbose information" FALSE) + +# Check prereqs +find_program( GCOV_PATH gcov ) +find_program( LCOV_PATH NAMES lcov lcov.bat lcov.exe lcov.perl) +find_program( FASTCOV_PATH NAMES fastcov fastcov.py ) +find_program( GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat ) +find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test) +find_program( CPPFILT_PATH NAMES c++filt ) + +if(NOT GCOV_PATH) + message(FATAL_ERROR "gcov not found! Aborting...") +endif() # NOT GCOV_PATH + +# Check supported compiler (Clang, GNU and Flang) +get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(LANG ${LANGUAGES}) + if("${CMAKE_${LANG}_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang") + if("${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS 3) + message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...") + endif() + elseif(NOT "${CMAKE_${LANG}_COMPILER_ID}" MATCHES "GNU" + AND NOT "${CMAKE_${LANG}_COMPILER_ID}" MATCHES "(LLVM)?[Ff]lang") + message(FATAL_ERROR "Compiler is not GNU or Flang! Aborting...") + endif() +endforeach() + +set(COVERAGE_COMPILER_FLAGS "-g --coverage" + CACHE INTERNAL "") +if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(-fprofile-abs-path HAVE_fprofile_abs_path) + if(HAVE_fprofile_abs_path) + set(COVERAGE_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path") + endif() +endif() + +set(CMAKE_Fortran_FLAGS_COVERAGE + ${COVERAGE_COMPILER_FLAGS} + CACHE STRING "Flags used by the Fortran compiler during coverage builds." + FORCE ) +set(CMAKE_CXX_FLAGS_COVERAGE + ${COVERAGE_COMPILER_FLAGS} + CACHE STRING "Flags used by the C++ compiler during coverage builds." + FORCE ) +set(CMAKE_C_FLAGS_COVERAGE + ${COVERAGE_COMPILER_FLAGS} + CACHE STRING "Flags used by the C compiler during coverage builds." + FORCE ) +set(CMAKE_EXE_LINKER_FLAGS_COVERAGE + "" + CACHE STRING "Flags used for linking binaries during coverage builds." + FORCE ) +set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE + "" + CACHE STRING "Flags used by the shared libraries linker during coverage builds." + FORCE ) +mark_as_advanced( + CMAKE_Fortran_FLAGS_COVERAGE + CMAKE_CXX_FLAGS_COVERAGE + CMAKE_C_FLAGS_COVERAGE + CMAKE_EXE_LINKER_FLAGS_COVERAGE + CMAKE_SHARED_LINKER_FLAGS_COVERAGE ) + +get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG)) + message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading") +endif() # NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG) + +if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + link_libraries(gcov) +endif() + +# Defines a target for running and collection code coverage information +# Builds dependencies, runs the given executable and outputs reports. +# NOTE! The executable should always have a ZERO as exit code otherwise +# the coverage generation will not complete. +# +# setup_target_for_coverage_lcov( +# NAME testrunner_coverage # New target name +# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR +# DEPENDENCIES testrunner # Dependencies to build first +# BASE_DIRECTORY "../" # Base directory for report +# # (defaults to PROJECT_SOURCE_DIR) +# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative +# # to BASE_DIRECTORY, with CMake 3.4+) +# NO_DEMANGLE # Don't demangle C++ symbols +# # even if c++filt is found +# ) +function(setup_target_for_coverage_lcov) + + set(options NO_DEMANGLE SONARQUBE) + set(oneValueArgs BASE_DIRECTORY NAME) + set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES LCOV_ARGS GENHTML_ARGS) + cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT LCOV_PATH) + message(FATAL_ERROR "lcov not found! Aborting...") + endif() # NOT LCOV_PATH + + if(NOT GENHTML_PATH) + message(FATAL_ERROR "genhtml not found! Aborting...") + endif() # NOT GENHTML_PATH + + # Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR + if(DEFINED Coverage_BASE_DIRECTORY) + get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE) + else() + set(BASEDIR ${PROJECT_SOURCE_DIR}) + endif() + + # Collect excludes (CMake 3.4+: Also compute absolute paths) + set(LCOV_EXCLUDES "") + foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_LCOV_EXCLUDES}) + if(CMAKE_VERSION VERSION_GREATER 3.4) + get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR}) + endif() + list(APPEND LCOV_EXCLUDES "${EXCLUDE}") + endforeach() + list(REMOVE_DUPLICATES LCOV_EXCLUDES) + + # Conditional arguments + if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE}) + set(GENHTML_EXTRA_ARGS "--demangle-cpp") + endif() + + # Setting up commands which will be run to generate coverage data. + # Cleanup lcov + set(LCOV_CLEAN_CMD + ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -directory . + -b ${BASEDIR} --zerocounters + ) + # Create baseline to make sure untouched files show up in the report + set(LCOV_BASELINE_CMD + ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -c -i -d . -b + ${BASEDIR} -o ${Coverage_NAME}.base + ) + # Run tests + set(LCOV_EXEC_TESTS_CMD + ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS} + ) + # Capturing lcov counters and generating report + set(LCOV_CAPTURE_CMD + ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --directory . -b + ${BASEDIR} --capture --output-file ${Coverage_NAME}.capture + ) + # add baseline counters + set(LCOV_BASELINE_COUNT_CMD + ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -a ${Coverage_NAME}.base + -a ${Coverage_NAME}.capture --output-file ${Coverage_NAME}.total + ) + # filter collected data to final coverage report + set(LCOV_FILTER_CMD + ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --remove + ${Coverage_NAME}.total ${LCOV_EXCLUDES} --output-file ${Coverage_NAME}.info + ) + # Generate HTML output + set(LCOV_GEN_HTML_CMD + ${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS} -o + ${Coverage_NAME} ${Coverage_NAME}.info + ) + if(${Coverage_SONARQUBE}) + # Generate SonarQube output + set(GCOVR_XML_CMD + ${GCOVR_PATH} --sonarqube ${Coverage_NAME}_sonarqube.xml -r ${BASEDIR} ${GCOVR_ADDITIONAL_ARGS} + ${GCOVR_EXCLUDE_ARGS} --object-directory=${PROJECT_BINARY_DIR} + ) + set(GCOVR_XML_CMD_COMMAND + COMMAND ${GCOVR_XML_CMD} + ) + set(GCOVR_XML_CMD_BYPRODUCTS ${Coverage_NAME}_sonarqube.xml) + set(GCOVR_XML_CMD_COMMENT COMMENT "SonarQube code coverage info report saved in ${Coverage_NAME}_sonarqube.xml.") + endif() + + + if(CODE_COVERAGE_VERBOSE) + message(STATUS "Executed command report") + message(STATUS "Command to clean up lcov: ") + string(REPLACE ";" " " LCOV_CLEAN_CMD_SPACED "${LCOV_CLEAN_CMD}") + message(STATUS "${LCOV_CLEAN_CMD_SPACED}") + + message(STATUS "Command to create baseline: ") + string(REPLACE ";" " " LCOV_BASELINE_CMD_SPACED "${LCOV_BASELINE_CMD}") + message(STATUS "${LCOV_BASELINE_CMD_SPACED}") + + message(STATUS "Command to run the tests: ") + string(REPLACE ";" " " LCOV_EXEC_TESTS_CMD_SPACED "${LCOV_EXEC_TESTS_CMD}") + message(STATUS "${LCOV_EXEC_TESTS_CMD_SPACED}") + + message(STATUS "Command to capture counters and generate report: ") + string(REPLACE ";" " " LCOV_CAPTURE_CMD_SPACED "${LCOV_CAPTURE_CMD}") + message(STATUS "${LCOV_CAPTURE_CMD_SPACED}") + + message(STATUS "Command to add baseline counters: ") + string(REPLACE ";" " " LCOV_BASELINE_COUNT_CMD_SPACED "${LCOV_BASELINE_COUNT_CMD}") + message(STATUS "${LCOV_BASELINE_COUNT_CMD_SPACED}") + + message(STATUS "Command to filter collected data: ") + string(REPLACE ";" " " LCOV_FILTER_CMD_SPACED "${LCOV_FILTER_CMD}") + message(STATUS "${LCOV_FILTER_CMD_SPACED}") + + message(STATUS "Command to generate lcov HTML output: ") + string(REPLACE ";" " " LCOV_GEN_HTML_CMD_SPACED "${LCOV_GEN_HTML_CMD}") + message(STATUS "${LCOV_GEN_HTML_CMD_SPACED}") + + if(${Coverage_SONARQUBE}) + message(STATUS "Command to generate SonarQube XML output: ") + string(REPLACE ";" " " GCOVR_XML_CMD_SPACED "${GCOVR_XML_CMD}") + message(STATUS "${GCOVR_XML_CMD_SPACED}") + endif() + endif() + + # Setup target + add_custom_target(${Coverage_NAME} + COMMAND ${LCOV_CLEAN_CMD} + COMMAND ${LCOV_BASELINE_CMD} + COMMAND ${LCOV_EXEC_TESTS_CMD} + COMMAND ${LCOV_CAPTURE_CMD} + COMMAND ${LCOV_BASELINE_COUNT_CMD} + COMMAND ${LCOV_FILTER_CMD} + COMMAND ${LCOV_GEN_HTML_CMD} + ${GCOVR_XML_CMD_COMMAND} + + # Set output files as GENERATED (will be removed on 'make clean') + BYPRODUCTS + ${Coverage_NAME}.base + ${Coverage_NAME}.capture + ${Coverage_NAME}.total + ${Coverage_NAME}.info + ${GCOVR_XML_CMD_BYPRODUCTS} + ${Coverage_NAME}/index.html + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + DEPENDS ${Coverage_DEPENDENCIES} + VERBATIM # Protect arguments to commands + COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." + ) + + # Show where to find the lcov info report + add_custom_command(TARGET ${Coverage_NAME} POST_BUILD + COMMAND ; + COMMENT "Lcov code coverage info report saved in ${Coverage_NAME}.info." + ${GCOVR_XML_CMD_COMMENT} + ) + + # Show info where to find the report + add_custom_command(TARGET ${Coverage_NAME} POST_BUILD + COMMAND ; + COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report." + ) + +endfunction() # setup_target_for_coverage_lcov + +# Defines a target for running and collection code coverage information +# Builds dependencies, runs the given executable and outputs reports. +# NOTE! The executable should always have a ZERO as exit code otherwise +# the coverage generation will not complete. +# +# setup_target_for_coverage_gcovr_xml( +# NAME ctest_coverage # New target name +# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR +# DEPENDENCIES executable_target # Dependencies to build first +# BASE_DIRECTORY "../" # Base directory for report +# # (defaults to PROJECT_SOURCE_DIR) +# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative +# # to BASE_DIRECTORY, with CMake 3.4+) +# ) +# The user can set the variable GCOVR_ADDITIONAL_ARGS to supply additional flags to the +# GCVOR command. +function(setup_target_for_coverage_gcovr_xml) + + set(options NONE) + set(oneValueArgs BASE_DIRECTORY NAME) + set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES) + cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT GCOVR_PATH) + message(FATAL_ERROR "gcovr not found! Aborting...") + endif() # NOT GCOVR_PATH + + # Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR + if(DEFINED Coverage_BASE_DIRECTORY) + get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE) + else() + set(BASEDIR ${PROJECT_SOURCE_DIR}) + endif() + + # Collect excludes (CMake 3.4+: Also compute absolute paths) + set(GCOVR_EXCLUDES "") + foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES}) + if(CMAKE_VERSION VERSION_GREATER 3.4) + get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR}) + endif() + list(APPEND GCOVR_EXCLUDES "${EXCLUDE}") + endforeach() + list(REMOVE_DUPLICATES GCOVR_EXCLUDES) + + # Combine excludes to several -e arguments + set(GCOVR_EXCLUDE_ARGS "") + foreach(EXCLUDE ${GCOVR_EXCLUDES}) + list(APPEND GCOVR_EXCLUDE_ARGS "-e") + list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}") + endforeach() + + # Set up commands which will be run to generate coverage data + # Run tests + set(GCOVR_XML_EXEC_TESTS_CMD + ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS} + ) + # Running gcovr + set(GCOVR_XML_CMD + ${GCOVR_PATH} --xml ${Coverage_NAME}.xml -r ${BASEDIR} ${GCOVR_ADDITIONAL_ARGS} + ${GCOVR_EXCLUDE_ARGS} --object-directory=${PROJECT_BINARY_DIR} + ) + + if(CODE_COVERAGE_VERBOSE) + message(STATUS "Executed command report") + + message(STATUS "Command to run tests: ") + string(REPLACE ";" " " GCOVR_XML_EXEC_TESTS_CMD_SPACED "${GCOVR_XML_EXEC_TESTS_CMD}") + message(STATUS "${GCOVR_XML_EXEC_TESTS_CMD_SPACED}") + + message(STATUS "Command to generate gcovr XML coverage data: ") + string(REPLACE ";" " " GCOVR_XML_CMD_SPACED "${GCOVR_XML_CMD}") + message(STATUS "${GCOVR_XML_CMD_SPACED}") + endif() + + add_custom_target(${Coverage_NAME} + COMMAND ${GCOVR_XML_EXEC_TESTS_CMD} + COMMAND ${GCOVR_XML_CMD} + + BYPRODUCTS ${Coverage_NAME}.xml + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + DEPENDS ${Coverage_DEPENDENCIES} + VERBATIM # Protect arguments to commands + COMMENT "Running gcovr to produce Cobertura code coverage report." + ) + + # Show info where to find the report + add_custom_command(TARGET ${Coverage_NAME} POST_BUILD + COMMAND ; + COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml." + ) +endfunction() # setup_target_for_coverage_gcovr_xml + +# Defines a target for running and collection code coverage information +# Builds dependencies, runs the given executable and outputs reports. +# NOTE! The executable should always have a ZERO as exit code otherwise +# the coverage generation will not complete. +# +# setup_target_for_coverage_gcovr_html( +# NAME ctest_coverage # New target name +# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR +# DEPENDENCIES executable_target # Dependencies to build first +# BASE_DIRECTORY "../" # Base directory for report +# # (defaults to PROJECT_SOURCE_DIR) +# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative +# # to BASE_DIRECTORY, with CMake 3.4+) +# ) +# The user can set the variable GCOVR_ADDITIONAL_ARGS to supply additional flags to the +# GCVOR command. +function(setup_target_for_coverage_gcovr_html) + + set(options NONE) + set(oneValueArgs BASE_DIRECTORY NAME) + set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES) + cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT GCOVR_PATH) + message(FATAL_ERROR "gcovr not found! Aborting...") + endif() # NOT GCOVR_PATH + + # Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR + if(DEFINED Coverage_BASE_DIRECTORY) + get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE) + else() + set(BASEDIR ${PROJECT_SOURCE_DIR}) + endif() + + # Collect excludes (CMake 3.4+: Also compute absolute paths) + set(GCOVR_EXCLUDES "") + foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES}) + if(CMAKE_VERSION VERSION_GREATER 3.4) + get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR}) + endif() + list(APPEND GCOVR_EXCLUDES "${EXCLUDE}") + endforeach() + list(REMOVE_DUPLICATES GCOVR_EXCLUDES) + + # Combine excludes to several -e arguments + set(GCOVR_EXCLUDE_ARGS "") + foreach(EXCLUDE ${GCOVR_EXCLUDES}) + list(APPEND GCOVR_EXCLUDE_ARGS "-e") + list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}") + endforeach() + + # Set up commands which will be run to generate coverage data + # Run tests + set(GCOVR_HTML_EXEC_TESTS_CMD + ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS} + ) + # Create folder + set(GCOVR_HTML_FOLDER_CMD + ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${Coverage_NAME} + ) + # Running gcovr + set(GCOVR_HTML_CMD + ${GCOVR_PATH} --html ${Coverage_NAME}/index.html --html-details -r ${BASEDIR} ${GCOVR_ADDITIONAL_ARGS} + ${GCOVR_EXCLUDE_ARGS} --object-directory=${PROJECT_BINARY_DIR} + ) + + if(CODE_COVERAGE_VERBOSE) + message(STATUS "Executed command report") + + message(STATUS "Command to run tests: ") + string(REPLACE ";" " " GCOVR_HTML_EXEC_TESTS_CMD_SPACED "${GCOVR_HTML_EXEC_TESTS_CMD}") + message(STATUS "${GCOVR_HTML_EXEC_TESTS_CMD_SPACED}") + + message(STATUS "Command to create a folder: ") + string(REPLACE ";" " " GCOVR_HTML_FOLDER_CMD_SPACED "${GCOVR_HTML_FOLDER_CMD}") + message(STATUS "${GCOVR_HTML_FOLDER_CMD_SPACED}") + + message(STATUS "Command to generate gcovr HTML coverage data: ") + string(REPLACE ";" " " GCOVR_HTML_CMD_SPACED "${GCOVR_HTML_CMD}") + message(STATUS "${GCOVR_HTML_CMD_SPACED}") + endif() + + add_custom_target(${Coverage_NAME} + COMMAND ${GCOVR_HTML_EXEC_TESTS_CMD} + COMMAND ${GCOVR_HTML_FOLDER_CMD} + COMMAND ${GCOVR_HTML_CMD} + + BYPRODUCTS ${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html # report directory + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + DEPENDS ${Coverage_DEPENDENCIES} + VERBATIM # Protect arguments to commands + COMMENT "Running gcovr to produce HTML code coverage report." + ) + + # Show info where to find the report + add_custom_command(TARGET ${Coverage_NAME} POST_BUILD + COMMAND ; + COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report." + ) + +endfunction() # setup_target_for_coverage_gcovr_html + +# Defines a target for running and collection code coverage information +# Builds dependencies, runs the given executable and outputs reports. +# NOTE! The executable should always have a ZERO as exit code otherwise +# the coverage generation will not complete. +# +# setup_target_for_coverage_fastcov( +# NAME testrunner_coverage # New target name +# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR +# DEPENDENCIES testrunner # Dependencies to build first +# BASE_DIRECTORY "../" # Base directory for report +# # (defaults to PROJECT_SOURCE_DIR) +# EXCLUDE "src/dir1/" "src/dir2/" # Patterns to exclude. +# NO_DEMANGLE # Don't demangle C++ symbols +# # even if c++filt is found +# SKIP_HTML # Don't create html report +# POST_CMD perl -i -pe s!${PROJECT_SOURCE_DIR}/!!g ctest_coverage.json # E.g. for stripping source dir from file paths +# ) +function(setup_target_for_coverage_fastcov) + + set(options NO_DEMANGLE SKIP_HTML) + set(oneValueArgs BASE_DIRECTORY NAME) + set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES FASTCOV_ARGS GENHTML_ARGS POST_CMD) + cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT FASTCOV_PATH) + message(FATAL_ERROR "fastcov not found! Aborting...") + endif() + + if(NOT Coverage_SKIP_HTML AND NOT GENHTML_PATH) + message(FATAL_ERROR "genhtml not found! Aborting...") + endif() + + # Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR + if(Coverage_BASE_DIRECTORY) + get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE) + else() + set(BASEDIR ${PROJECT_SOURCE_DIR}) + endif() + + # Collect excludes (Patterns, not paths, for fastcov) + set(FASTCOV_EXCLUDES "") + foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_FASTCOV_EXCLUDES}) + list(APPEND FASTCOV_EXCLUDES "${EXCLUDE}") + endforeach() + list(REMOVE_DUPLICATES FASTCOV_EXCLUDES) + + # Conditional arguments + if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE}) + set(GENHTML_EXTRA_ARGS "--demangle-cpp") + endif() + + # Set up commands which will be run to generate coverage data + set(FASTCOV_EXEC_TESTS_CMD ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}) + + set(FASTCOV_CAPTURE_CMD ${FASTCOV_PATH} ${Coverage_FASTCOV_ARGS} --gcov ${GCOV_PATH} + --search-directory ${BASEDIR} + --process-gcno + --output ${Coverage_NAME}.json + --exclude ${FASTCOV_EXCLUDES} + ) + + set(FASTCOV_CONVERT_CMD ${FASTCOV_PATH} + -C ${Coverage_NAME}.json --lcov --output ${Coverage_NAME}.info + ) + + if(Coverage_SKIP_HTML) + set(FASTCOV_HTML_CMD ";") + else() + set(FASTCOV_HTML_CMD ${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS} + -o ${Coverage_NAME} ${Coverage_NAME}.info + ) + endif() + + set(FASTCOV_POST_CMD ";") + if(Coverage_POST_CMD) + set(FASTCOV_POST_CMD ${Coverage_POST_CMD}) + endif() + + if(CODE_COVERAGE_VERBOSE) + message(STATUS "Code coverage commands for target ${Coverage_NAME} (fastcov):") + + message(" Running tests:") + string(REPLACE ";" " " FASTCOV_EXEC_TESTS_CMD_SPACED "${FASTCOV_EXEC_TESTS_CMD}") + message(" ${FASTCOV_EXEC_TESTS_CMD_SPACED}") + + message(" Capturing fastcov counters and generating report:") + string(REPLACE ";" " " FASTCOV_CAPTURE_CMD_SPACED "${FASTCOV_CAPTURE_CMD}") + message(" ${FASTCOV_CAPTURE_CMD_SPACED}") + + message(" Converting fastcov .json to lcov .info:") + string(REPLACE ";" " " FASTCOV_CONVERT_CMD_SPACED "${FASTCOV_CONVERT_CMD}") + message(" ${FASTCOV_CONVERT_CMD_SPACED}") + + if(NOT Coverage_SKIP_HTML) + message(" Generating HTML report: ") + string(REPLACE ";" " " FASTCOV_HTML_CMD_SPACED "${FASTCOV_HTML_CMD}") + message(" ${FASTCOV_HTML_CMD_SPACED}") + endif() + if(Coverage_POST_CMD) + message(" Running post command: ") + string(REPLACE ";" " " FASTCOV_POST_CMD_SPACED "${FASTCOV_POST_CMD}") + message(" ${FASTCOV_POST_CMD_SPACED}") + endif() + endif() + + # Setup target + add_custom_target(${Coverage_NAME} + + # Cleanup fastcov + COMMAND ${FASTCOV_PATH} ${Coverage_FASTCOV_ARGS} --gcov ${GCOV_PATH} + --search-directory ${BASEDIR} + --zerocounters + + COMMAND ${FASTCOV_EXEC_TESTS_CMD} + COMMAND ${FASTCOV_CAPTURE_CMD} + COMMAND ${FASTCOV_CONVERT_CMD} + COMMAND ${FASTCOV_HTML_CMD} + COMMAND ${FASTCOV_POST_CMD} + + # Set output files as GENERATED (will be removed on 'make clean') + BYPRODUCTS + ${Coverage_NAME}.info + ${Coverage_NAME}.json + ${Coverage_NAME}/index.html # report directory + + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + DEPENDS ${Coverage_DEPENDENCIES} + VERBATIM # Protect arguments to commands + COMMENT "Resetting code coverage counters to zero. Processing code coverage counters and generating report." + ) + + set(INFO_MSG "fastcov code coverage info report saved in ${Coverage_NAME}.info and ${Coverage_NAME}.json.") + if(NOT Coverage_SKIP_HTML) + string(APPEND INFO_MSG " Open ${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html in your browser to view the coverage report.") + endif() + # Show where to find the fastcov info report + add_custom_command(TARGET ${Coverage_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo ${INFO_MSG} + ) + +endfunction() # setup_target_for_coverage_fastcov + +function(append_coverage_compiler_flags) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE) + message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}") +endfunction() # append_coverage_compiler_flags + +# Setup coverage for specific library +function(append_coverage_compiler_flags_to_target name) + separate_arguments(_flag_list NATIVE_COMMAND "${COVERAGE_COMPILER_FLAGS}") + target_compile_options(${name} PRIVATE ${_flag_list}) + if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + target_link_libraries(${name} PRIVATE gcov) + endif() +endfunction() diff --git a/cmake/FindPythonQt.cmake b/cmake/FindPythonQt.cmake new file mode 100644 index 0000000..7934107 --- /dev/null +++ b/cmake/FindPythonQt.cmake @@ -0,0 +1,47 @@ +include(CMakeFindDependencyMacro ) +find_dependency(Python3 COMPONENTS Development) + +# Look for the header file. +find_path(PythonQt_INCLUDE_DIR NAMES PythonQt.h PATH_SUFFIXES include) + +set (PYTHONQT_LIBNAME_SUFFIX ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}) + +# Look for the library (sorted from most current/relevant entry to least). +find_library(PythonQt_LIBRARY NAMES + PythonQt-Qt5-Python${PYTHONQT_LIBNAME_SUFFIX} + PATH_SUFFIXES lib +) + +if (UNIX) +find_library(PythonQt_LIBRARY_DEBUG NAMES + PythonQt-Qt5-Python${PYTHONQT_LIBNAME_SUFFIX} + PATH_SUFFIXES libDebug +) +else() +find_library(PythonQt_LIBRARY_DEBUG NAMES + PythonQt-Qt5-Python${PYTHONQT_LIBNAME_SUFFIX}_d + PATH_SUFFIXES libDebug +) +endif() + +# handle the QUIETLY and REQUIRED arguments and set GTlabCore_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonQt + REQUIRED_VARS PythonQt_LIBRARY PythonQt_INCLUDE_DIR) + +if(PythonQt_FOUND) + + add_library(PythonQt::PythonQt UNKNOWN IMPORTED) + set_target_properties(PythonQt::PythonQt PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${PythonQt_INCLUDE_DIR} + IMPORTED_LOCATION ${PythonQt_LIBRARY} + IMPORTED_IMPLIB ${PythonQt_LIBRARY} + IMPORTED_LOCATION_DEBUG ${PythonQt_LIBRARY_DEBUG} + IMPORTED_IMPLIB_DEBUG ${PythonQt_LIBRARY_DEBUG} + ) + + set_property(TARGET PythonQt::PythonQt APPEND + PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES Python3::Python) + +endif() diff --git a/cmake/GTlab.cmake b/cmake/GTlab.cmake new file mode 100644 index 0000000..106fe43 --- /dev/null +++ b/cmake/GTlab.cmake @@ -0,0 +1,169 @@ +# SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR) +# +# SPDX-License-Identifier: MPL-2.0+ + +# This function set some variables that are common +# to the gtlab build system. +# It makes sure, that libraries are put into the root build folder, +# sets the debug postfix "-d" and sets the "binDebug" folder in +# Debug mode +# +# usage: +# gtlab_standard_setup() +macro(gtlab_standard_setup) + message("Setting up GTlab standards configuration") + set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + + # store all dlls inside build directory + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}) + + + if(NOT DEFINED CMAKE_INSTALL_BINDIR) + set(CMAKE_INSTALL_BINDIR "$<$:binDebug>$<$>:bin>") + endif(NOT DEFINED CMAKE_INSTALL_BINDIR) + + if(NOT DEFINED CMAKE_INSTALL_MODULEDIR) + if (IS_DIRECTORY ${CMAKE_INSTALL_PREFIX}/build) + message(STATUS "Deploying into GTlab build dir") + set(CMAKE_INSTALL_MODULEDIR build/modules) + + else () + set(CMAKE_INSTALL_MODULEDIR ${CMAKE_INSTALL_BINDIR}/modules) + endif() + endif(NOT DEFINED CMAKE_INSTALL_MODULEDIR) + + if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") + endif(NOT DEFINED CMAKE_INSTALL_LIBDIR) + + if(NOT DEFINED CMAKE_DEBUG_POSTFIX) + set(CMAKE_DEBUG_POSTFIX "-d") + endif() + + # Instruct CMake to run moc automatically when needed. + set(CMAKE_AUTOMOC ON) +endmacro() + +# This function adds the packages of GTlab's devtools +# to the cmake prefix path. It adds the GTLAB_DEVTOOLS_DIR +# cache variable, to set the path to GTlab's devtools +# +# Usage: +# enable_gtlab_devtools() +macro(enable_gtlab_devtools) + # prefix 3rdparty stuff from devtools + set(GTLAB_DEVTOOLS_DIR "" CACHE PATH "Path of gtlab devtools") + + if (EXISTS ${GTLAB_DEVTOOLS_DIR}) + message("GTlab DevTools enabled at " ${GTLAB_DEVTOOLS_DIR}) + + set (CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${GTLAB_DEVTOOLS_DIR}) + + set(bladegen_ROOT ${GTLAB_DEVTOOLS_DIR}/ThirdPartyLibraries/BladeGenInterface) + set(ceres_ROOT ${GTLAB_DEVTOOLS_DIR}/ThirdPartyLibraries/ceres) + set(GTest_ROOT ${GTLAB_DEVTOOLS_DIR}/ThirdPartyLibraries/GoogleTest) + set(hdf5_ROOT ${GTLAB_DEVTOOLS_DIR}/ThirdPartyLibraries/hdf5) + set(LibXml2_ROOT ${GTLAB_DEVTOOLS_DIR}/ThirdPartyLibraries/LibXML) + set(CMinpack_ROOT ${GTLAB_DEVTOOLS_DIR}/ThirdPartyLibraries/minpack) + set(nlopt_ROOT ${GTLAB_DEVTOOLS_DIR}/ThirdPartyLibraries/NLopt) + set(optymal_ROOT ${GTLAB_DEVTOOLS_DIR}/ThirdPartyLibraries/Optymal) + + set(Qwt_ROOT ${GTLAB_DEVTOOLS_DIR}/ThirdPartyLibraries/Qwt) + set(SplineLib_ROOT ${GTLAB_DEVTOOLS_DIR}/ThirdPartyLibraries/SplineLib) + + set(PythonQt_ROOT ${GTLAB_DEVTOOLS_DIR}/ThirdPartyLibraries/PythonQt/PythonQt_${Python3_VERSION_SUFFIX}) + + set(GTlabCompat_ROOT ${GTLAB_DEVTOOLS_DIR}/../../tools/CompatibilityLib) + + endif() + +endmacro() + +# Function to add a gtlab module +# +# This makes sure to add a module id and deploy to the correct +# folders. +# +# Arguments: +# MODULE_ID: String containing the module ID of the module +# SOURCES: Sources (and headers) of the module to be built +# +# Optional arguments: +# README_FILE: Location to the readme. This is used to copy the readme to the module's meta directory. +# CHANGELOG_FILE: Location to the changelog, which is also copied to the meta directory in the install step. +# EXAMPLES_DIR: Directory containing the example folders of the project for the automatic example presentation of GTlab +# Each example should be in a subdirectory of the following structure: +# EXAMPLE_DIR/ +# -> project/ +# -> CONTENT OF THE GTLAB PROJECT (e.g. performance.gtmod) +# -> index.json +# -> picture.png +# +# For more details see the documentation of gtlab about offering examples +# +# Usage: +# add_gtlab_module(mymodule +# SOURCES mod.cpp mod2.cpp mod.h +# MODULE_ID "my mod" +# README_FILE "${PROJECT_SOURCE_DIR}/README.md" +# CHANGELOG_FILE "${PROJECT_SOURCE_DIR}/CHANGELOG.md" +# EXAMPLES_DIR "${PROJECT_SOURCE_DIR}/examples/" +# ) +function(add_gtlab_module GTLAB_ADD_MODULE_TARGET) + cmake_parse_arguments( + PARSE_ARGV 1 GTLAB_ADD_MODULE "" "MODULE_ID;README_FILE;CHANGELOG_FILE;EXAMPLES_DIR" "SOURCES" + ) + + if (NOT DEFINED GTLAB_ADD_MODULE_MODULE_ID) + message(FATAL_ERROR "In add_gtlab_module: Missing argument MODULE_ID for target ${GTLAB_ADD_MODULE_TARGET}") + endif() + + add_library(${GTLAB_ADD_MODULE_TARGET} SHARED ${GTLAB_ADD_MODULE_SOURCES}) + + # add module id + target_compile_definitions(${GTLAB_ADD_MODULE_TARGET} + PRIVATE -DGT_MODULE_ID="${GTLAB_ADD_MODULE_MODULE_ID}") + + # set rpath for linux + if (UNIX) + set_target_properties(${GTLAB_ADD_MODULE_TARGET} + PROPERTIES INSTALL_RPATH "$ORIGIN:$ORIGIN/.." + INSTALL_RPATH_USE_LINK_PATH FALSE) + endif (UNIX) + + + if (UNIX) + install (TARGETS ${GTLAB_ADD_MODULE_TARGET} + LIBRARY DESTINATION + ${CMAKE_INSTALL_MODULEDIR} + ) + else(UNIX) + install (TARGETS ${GTLAB_ADD_MODULE_TARGET} + RUNTIME DESTINATION + ${CMAKE_INSTALL_MODULEDIR} + ) + endif(UNIX) + + # Copy of README and CHANGELOG to meta directory + if (DEFINED GTLAB_ADD_MODULE_README_FILE) + install(FILES ${GTLAB_ADD_MODULE_README_FILE} + DESTINATION ${CMAKE_INSTALL_MODULEDIR}/meta/${GTLAB_ADD_MODULE_MODULE_ID}) + endif() + + if (DEFINED GTLAB_ADD_MODULE_CHANGELOG_FILE) + install(FILES ${GTLAB_ADD_MODULE_CHANGELOG_FILE} + DESTINATION ${CMAKE_INSTALL_MODULEDIR}/meta/${GTLAB_ADD_MODULE_MODULE_ID}) + endif() + + if (DEFINED GTLAB_ADD_MODULE_EXAMPLES_DIR) + install(DIRECTORY ${GTLAB_ADD_MODULE_EXAMPLES_DIR} + DESTINATION examples/) + endif() + +endfunction() diff --git a/cmake/GTlabPythonConfig.in b/cmake/GTlabPythonConfig.in new file mode 100644 index 0000000..3befd4b --- /dev/null +++ b/cmake/GTlabPythonConfig.in @@ -0,0 +1,25 @@ +include(CMakeFindDependencyMacro) + +find_dependency(Qt5 COMPONENTS Core Widgets Xml) + +# support for monobuilds + +if (NOT TARGET GTlab::Core) + find_dependency(GTlab) +endif() + +if (NOT TARGET PythonQt::PythonQt) + find_dependency(PythonQt) +endif() + +# - Config file for the GTlabPython package +include("${CMAKE_CURRENT_LIST_DIR}/GTlabPython-targets.cmake") + +# create alias +if (NOT TARGET GTlab::Python) + add_library(GTlab::Python INTERFACE IMPORTED) + + set_target_properties(GTlab::Python PROPERTIES + INTERFACE_LINK_LIBRARIES "GTlabPython" + ) +endif() diff --git a/src/batch/CMakeLists.txt b/src/batch/CMakeLists.txt new file mode 100644 index 0000000..8684ce6 --- /dev/null +++ b/src/batch/CMakeLists.txt @@ -0,0 +1,31 @@ +# python batch application + +set (SOURCES + batch-script.cpp +) + +if (WIN32) + SET (SOURCES ${SOURCES} batch-script.rc) +endif() + +add_executable(GTlabPythonConsole + ${SOURCES} +) + +set_target_properties(GTlabPythonConsole PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) + +set_target_properties(GTlabPythonConsole PROPERTIES OUTPUT_NAME + GTlabPythonConsole${Python3_VERSION_SUFFIX}) + + +target_compile_definitions(GTlabPythonConsole PRIVATE + GT_MODULE_ID="Python Batch Application" +) + +target_link_libraries(GTlabPythonConsole + PRIVATE + Qt5::Widgets + Qt5::Xml + GTlab::Gui + GTlab::Python +) diff --git a/src/module/CMakeLists.txt b/src/module/CMakeLists.txt new file mode 100644 index 0000000..53c59b3 --- /dev/null +++ b/src/module/CMakeLists.txt @@ -0,0 +1,239 @@ +# ______________ __ +# / ____/_ __/ /___ / /_ +# / / __ / / / / __ `/ __ +# / /_/ / / / / / /_/ / /_/ / +# ____/ /_/ /_/\__,_/_.___/ +# +###################################################################### + +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(HEADERS + collection/browser/gtpy_collectionbrowser.h + collection/browser/gtpy_collectionbrowsermodel.h + collection/browser/gtpy_collectionbrowsersortmodel.h + collection/browser/items/gtpy_abstractbrowseritem.h + collection/browser/items/gtpy_browseritem.h + collection/browser/items/gtpy_collapsiblebrowseritem.h + collection/browser/items/gtpy_rootbrowseritem.h + collection/gtpy_collectionwidget.h + collection/gtpy_scriptcollectionsettings.h + collection/itemwidget/gtpy_collectionitemwidget.h + collection/localwidget/gtpy_collectionlocalmodel.h + collection/localwidget/gtpy_collectionlocalwidget.h + collection/localwidget/items/gtpy_abstractlocalitem.h + collection/localwidget/items/gtpy_collapsiblelocalitem.h + collection/localwidget/items/gtpy_localitem.h + extensions/gtpy_pythonfunctions.h + gt_compat.h + gt_python.h + gt_pythonmodule_exports.h + gtpy_icons_compat.h + gtpy_stylesheet_compat.h + models/gtpy_completermodel.h + models/gtpy_objectmodel.h + models/gtpy_taskstylemodel.h + post/gtpy_pythonplotconfigdialog.h + post/gtpy_pythonplotdata.h + post/gtpy_pythonplotitem.h + post/gtpy_pythonplotwidget.h + post/gtpy_pythonsvgwidget.h + processcomponents/gtpy_abstractscriptcomponent.h + processcomponents/gtpy_scriptcalculator.h + processcomponents/gtpy_task.h + utilities/gtpy_calculatorfactory.h + utilities/gtpy_codegenerator.h + utilities/gtpy_constants.h + utilities/gtpy_contextmanager.h + utilities/gtpy_decorator.h + utilities/gtpy_gilscope.h + utilities/gtpy_globals.h + utilities/gtpy_interruptrunnable.h + utilities/gtpy_matplotlib.h + utilities/gtpy_packageiteration.h + utilities/gtpy_processdatadistributor.h + utilities/gtpy_regexp.h + utilities/gtpy_scriptrunnable.h + utilities/gtpy_tempdir.h + utilities/gtpy_transfer.h + utilities/pythonextensions/gtpy_createhelperfunction.h + utilities/pythonextensions/gtpy_extendedwrapper.h + utilities/pythonextensions/gtpy_importfunction.h + utilities/pythonextensions/gtpy_loggingmodule.h + utilities/pythonextensions/gtpy_propertysetter.h + utilities/pythonextensions/gtpy_stdout.h + widgets/gtpy_completer.h + widgets/gtpy_console.h + widgets/gtpy_scripteditor.h + widgets/gtpy_taskdelegate.h + widgets/gtpy_tasktreeview.h + wizards/editor_settings/gtpy_editorsettings.h + wizards/editor_settings/gtpy_editorsettingsdialog.h + wizards/editor_settings/pages/gtpy_abstractsettingspage.h + wizards/editor_settings/pages/gtpy_generalpage.h + wizards/gtpy_abstractscriptingwizardpage.h + wizards/gtpy_wizardgeometries.h + wizards/gtpy_wizardgeometryitem.h + wizards/python_task/gtpy_taskwizardpage.h + wizards/script_calculator/gtpy_scriptcalculatorwizardpage.h +) + +set(SOURCES + collection/browser/gtpy_collectionbrowser.cpp + collection/browser/gtpy_collectionbrowsermodel.cpp + collection/browser/gtpy_collectionbrowsersortmodel.cpp + collection/browser/items/gtpy_abstractbrowseritem.cpp + collection/browser/items/gtpy_browseritem.cpp + collection/browser/items/gtpy_collapsiblebrowseritem.cpp + collection/browser/items/gtpy_rootbrowseritem.cpp + collection/gtpy_collectionwidget.cpp + collection/gtpy_scriptcollectionsettings.cpp + collection/itemwidget/gtpy_collectionitemwidget.cpp + collection/localwidget/gtpy_collectionlocalmodel.cpp + collection/localwidget/gtpy_collectionlocalwidget.cpp + collection/localwidget/items/gtpy_abstractlocalitem.cpp + collection/localwidget/items/gtpy_collapsiblelocalitem.cpp + collection/localwidget/items/gtpy_localitem.cpp + extensions/gtpy_pythonfunctions.cpp + gt_python.cpp + models/gtpy_completermodel.cpp + models/gtpy_objectmodel.cpp + models/gtpy_taskstylemodel.cpp + post/gtpy_pythonplotconfigdialog.cpp + post/gtpy_pythonplotdata.cpp + post/gtpy_pythonplotitem.cpp + post/gtpy_pythonplotwidget.cpp + post/gtpy_pythonsvgwidget.cpp + processcomponents/gtpy_abstractscriptcomponent.cpp + processcomponents/gtpy_scriptcalculator.cpp + processcomponents/gtpy_task.cpp + utilities/gtpy_calculatorfactory.cpp + utilities/gtpy_codegenerator.cpp + utilities/gtpy_contextmanager.cpp + utilities/gtpy_decorator.cpp + utilities/gtpy_gilscope.cpp + utilities/gtpy_globals.cpp + utilities/gtpy_interruptrunnable.cpp + utilities/gtpy_processdatadistributor.cpp + utilities/gtpy_regexp.cpp + utilities/gtpy_scriptrunnable.cpp + utilities/gtpy_tempdir.cpp + utilities/gtpy_transfer.cpp + utilities/pythonextensions/gtpy_calculatorsmodule.cpp + utilities/pythonextensions/gtpy_createhelperfunction.cpp + utilities/pythonextensions/gtpy_extendedwrapper.cpp + utilities/pythonextensions/gtpy_importfunction.cpp + utilities/pythonextensions/gtpy_loggingmodule.cpp + utilities/pythonextensions/gtpy_propertysetter.cpp + utilities/pythonextensions/gtpy_stdout.cpp + widgets/gtpy_completer.cpp + widgets/gtpy_console.cpp + widgets/gtpy_scripteditor.cpp + widgets/gtpy_taskdelegate.cpp + widgets/gtpy_tasktreeview.cpp + wizards/editor_settings/gtpy_editorsettings.cpp + wizards/editor_settings/gtpy_editorsettingsdialog.cpp + wizards/editor_settings/pages/gtpy_abstractsettingspage.cpp + wizards/editor_settings/pages/gtpy_generalpage.cpp + wizards/gtpy_abstractscriptingwizardpage.cpp + wizards/gtpy_wizardgeometries.cpp + wizards/gtpy_wizardgeometryitem.cpp + wizards/python_task/gtpy_taskwizardpage.cpp + wizards/script_calculator/gtpy_scriptcalculatorwizardpage.cpp +) + +set(MODULE_ID "Python Module (Python ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})") + +add_gtlab_module(GTlabPython SOURCES ${HEADERS} ${SOURCES} + MODULE_ID ${MODULE_ID} + README_FILE "${PROJECT_SOURCE_DIR}/README.md" + CHANGELOG_FILE "${PROJECT_SOURCE_DIR}/CHANGELOG.md" +) + +set_target_properties(GTlabPython PROPERTIES OUTPUT_NAME + GTlabPython${Python3_VERSION_SUFFIX}) + +add_library(GTlab::Python ALIAS GTlabPython) + +target_compile_definitions(GTlabPython PRIVATE + GT_PYTHON_DLL + GT_LOG_USE_QT_BINDINGS +) + +set(INSTALL_SUBDIR python${Python3_VERSION_SUFFIX}) + +target_include_directories(GTlabPython PUBLIC + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + + $ +) + +target_link_libraries(GTlabPython + PRIVATE + Qt5::Widgets + Qt5::Gui + Qt5::Xml + Qt5::Svg + GTlab::Logging + GTlab::Core + GTlab::Gui + PUBLIC + PythonQt::PythonQt + +) + +install (TARGETS GTlabPython + EXPORT GTlabPython-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${INSTALL_SUBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${INSTALL_SUBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_MODULEDIR} +) + +install (FILES ${HEADERS} DESTINATION include/${INSTALL_SUBDIR}) + +# cmake configuration export +set(CMAKE_INSTALL_INCLUDE_DIR "include") +set(CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/GTlabPython") + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/GTlabPythonConfigVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY AnyNewerVersion +) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/GTlabPythonConfig.cmake" + INPUT "${PROJECT_SOURCE_DIR}/cmake/GTlabPythonConfig.in" +) + +install(EXPORT GTlabPython-targets + DESTINATION ${CONFIG_INSTALL_DIR} +) + +install (FILES + "${CMAKE_CURRENT_BINARY_DIR}/GTlabPythonConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/GTlabPythonConfigVersion.cmake" + DESTINATION ${CONFIG_INSTALL_DIR}) + +###################################################################### + diff --git a/src/setup_module/CMakeLists.txt b/src/setup_module/CMakeLists.txt new file mode 100644 index 0000000..7a3849f --- /dev/null +++ b/src/setup_module/CMakeLists.txt @@ -0,0 +1,45 @@ +# ______________ __ +# / ____/_ __/ /___ / /_ +# / / __ / / / / __ `/ __ +# / /_/ / / / / / /_/ / /_/ / +# ____/ /_/ /_/\__,_/_.___/ +# +###################################################################### + +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(HEADERS + find_libpython.h + gt_python_setup.h + gtps_constants.h + gtps_globals.h + gtps_pythoninterpreter.h + gtps_pythonpreferencepage.h + gtps_systemsettings.h +) + +set(SOURCES + gt_python_setup.cpp + gtps_globals.cpp + gtps_pythoninterpreter.cpp + gtps_pythonpreferencepage.cpp + gtps_systemsettings.cpp +) + +add_gtlab_module(GTlabPythonSetup SOURCES ${HEADERS} ${SOURCES} + MODULE_ID "Python Setup" +) + +target_compile_definitions(GTlabPythonSetup PRIVATE + GT_PYTHON_SETUP_DLL +) + +target_include_directories(GTlabPythonSetup PUBLIC + $ +) + +target_link_libraries(GTlabPythonSetup + PRIVATE + GTlab::Gui +) diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt new file mode 100644 index 0000000..2b7035e --- /dev/null +++ b/tests/unittests/CMakeLists.txt @@ -0,0 +1,21 @@ +project(GTlabPython-UnitTests) + +if (NOT TARGET Qt5::Core) + find_package(Qt5 REQUIRED COMPONENTS Core) +endif() + + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +if (NOT TARGET gtest) + include(AddGoogleTest) +endif() + + +add_executable(GTlabPythonUnitTest + main.cpp +) + +target_link_libraries(GTlabPythonUnitTest PRIVATE GTlab::Python gtest Qt5::Core) + + diff --git a/tests/unittests/cmake/AddGoogleTest.cmake b/tests/unittests/cmake/AddGoogleTest.cmake new file mode 100644 index 0000000..57bf492 --- /dev/null +++ b/tests/unittests/cmake/AddGoogleTest.cmake @@ -0,0 +1,83 @@ +# +# +# Downloads GTest and provides a helper macro to add tests. Add make check, as well, which +# gives output on failed tests without having to set an environment variable. +# +# +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + +# Build gtest as a static library +set(BUILD_SHARED_LIBS OFF) + +include(FetchContent) +FetchContent_Declare(googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.11.0) +FetchContent_GetProperties(googletest) +if(NOT googletest_POPULATED) + FetchContent_Populate(googletest) + set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE BOOL "") + add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL) + unset(CMAKE_SUPPRESS_DEVELOPER_WARNINGS) +endif() + + +if(CMAKE_CONFIGURATION_TYPES) + add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} + --force-new-ctest-process --output-on-failure + --build-config "$") +else() + add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} + --force-new-ctest-process --output-on-failure) +endif() +set_target_properties(check PROPERTIES FOLDER "Scripts") + +#include_directories(${gtest_SOURCE_DIR}/include) + +# More modern way to do the last line, less messy but needs newish CMake: +# target_include_directories(gtest INTERFACE ${gtest_SOURCE_DIR}/include) + + +if(GOOGLE_TEST_INDIVIDUAL) + if(NOT CMAKE_VERSION VERSION_LESS 3.9) + include(GoogleTest) + else() + set(GOOGLE_TEST_INDIVIDUAL OFF) + endif() +endif() + +# Target must already exist +macro(add_gtest TESTNAME) + target_link_libraries(${TESTNAME} PUBLIC gtest gmock gtest_main) + + if(GOOGLE_TEST_INDIVIDUAL) + if(CMAKE_VERSION VERSION_LESS 3.10) + gtest_add_tests(TARGET ${TESTNAME} + TEST_PREFIX "${TESTNAME}." + TEST_LIST TmpTestList) + set_tests_properties(${TmpTestList} PROPERTIES FOLDER "Tests") + else() + gtest_discover_tests(${TESTNAME} + TEST_PREFIX "${TESTNAME}." + PROPERTIES FOLDER "Tests") + endif() + else() + add_test(${TESTNAME} ${TESTNAME}) + set_target_properties(${TESTNAME} PROPERTIES FOLDER "Tests") + endif() + +endmacro() + +mark_as_advanced( +gmock_build_tests +gtest_build_samples +gtest_build_tests +gtest_disable_pthreads +gtest_force_shared_crt +gtest_hide_internal_symbols +BUILD_GMOCK +BUILD_GTEST +) + +set_target_properties(gtest gtest_main gmock gmock_main + PROPERTIES FOLDER "Extern") From baba92641122e8bb05587c6b5001ce7ba8a3672d Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Fri, 8 Dec 2023 14:09:09 +0100 Subject: [PATCH 003/130] Added cmake support for GTlab 1.7 --- CMakeLists.txt | 7 +++++-- cmake/FindPythonQt.cmake | 2 ++ src/batch/CMakeLists.txt | 7 ++++++- src/module/CMakeLists.txt | 9 +++++++-- src/setup_module/CMakeLists.txt | 11 +++++++---- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc6d27e..9f24eca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,6 @@ find_package(Python3 REQUIRED COMPONENTS Development) set(Python3_VERSION_SUFFIX "${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}") include(GTlab) - gtlab_standard_setup() enable_gtlab_devtools() @@ -25,6 +24,10 @@ if(NOT TARGET GTlab::Core) find_package(GTlab REQUIRED) endif() +if (NOT TARGET GTlab::Numerics) + find_package(GTlabNumerics REQUIRED) +endif() + find_package(PythonQt REQUIRED) @@ -49,7 +52,7 @@ endif () if (BUILD_UNITTESTS AND BUILD_WITH_COVERAGE) setup_target_for_coverage_lcov( NAME test-coverage - EXECUTABLE GTlabDataAnalyticsUnitTests + EXECUTABLE GTlabPythonUnitTest EXCLUDE "tests/*" "build*" "/usr/*" "/opt/*" "/home/gitlab-runner/*" BASE_DIRECTORY "${PROJECT_SOURCE_DIR}") endif() diff --git a/cmake/FindPythonQt.cmake b/cmake/FindPythonQt.cmake index 7934107..ab7f195 100644 --- a/cmake/FindPythonQt.cmake +++ b/cmake/FindPythonQt.cmake @@ -5,10 +5,12 @@ find_dependency(Python3 COMPONENTS Development) find_path(PythonQt_INCLUDE_DIR NAMES PythonQt.h PATH_SUFFIXES include) set (PYTHONQT_LIBNAME_SUFFIX ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}) +set (PYTHONQT_LIBNAME_SUFFIX_ALT ${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}) # Look for the library (sorted from most current/relevant entry to least). find_library(PythonQt_LIBRARY NAMES PythonQt-Qt5-Python${PYTHONQT_LIBNAME_SUFFIX} + PythonQt-Qt5-Python${PYTHONQT_LIBNAME_SUFFIX_ALT} PATH_SUFFIXES lib ) diff --git a/src/batch/CMakeLists.txt b/src/batch/CMakeLists.txt index 8684ce6..1438e10 100644 --- a/src/batch/CMakeLists.txt +++ b/src/batch/CMakeLists.txt @@ -26,6 +26,11 @@ target_link_libraries(GTlabPythonConsole PRIVATE Qt5::Widgets Qt5::Xml - GTlab::Gui GTlab::Python ) + +if (GTlab_VERSION_MAJOR GREATER_EQUAL 2) + target_link_libraries(GTlabPythonConsole PRIVATE GTlab::Gui) +else() + target_link_libraries(GTlabPythonConsole PRIVATE GTlab::Mdi) +endif() diff --git a/src/module/CMakeLists.txt b/src/module/CMakeLists.txt index 53c59b3..c925525 100644 --- a/src/module/CMakeLists.txt +++ b/src/module/CMakeLists.txt @@ -159,6 +159,7 @@ add_library(GTlab::Python ALIAS GTlabPython) target_compile_definitions(GTlabPython PRIVATE GT_PYTHON_DLL GT_LOG_USE_QT_BINDINGS + PYTHON_LIBRARY="$" ) set(INSTALL_SUBDIR python${Python3_VERSION_SUFFIX}) @@ -195,12 +196,16 @@ target_link_libraries(GTlabPython Qt5::Svg GTlab::Logging GTlab::Core - GTlab::Gui PUBLIC PythonQt::PythonQt - ) +if (GTlab_VERSION_MAJOR GREATER_EQUAL 2) + target_link_libraries(GTlabPython PRIVATE GTlab::Gui) +else() + target_link_libraries(GTlabPython PRIVATE GTlab::Mdi GTlab::Calculators GTlab::Numerics) +endif() + install (TARGETS GTlabPython EXPORT GTlabPython-targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${INSTALL_SUBDIR} diff --git a/src/setup_module/CMakeLists.txt b/src/setup_module/CMakeLists.txt index 7a3849f..0a36be0 100644 --- a/src/setup_module/CMakeLists.txt +++ b/src/setup_module/CMakeLists.txt @@ -6,6 +6,12 @@ # ###################################################################### +# only for GTlab 2.x + +if (GTlab_VERSION_MAJOR LESS 2) + return() +endif() + set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) @@ -39,7 +45,4 @@ target_include_directories(GTlabPythonSetup PUBLIC $ ) -target_link_libraries(GTlabPythonSetup - PRIVATE - GTlab::Gui -) +target_link_libraries(GTlabPythonSetup PRIVATE GTlab::Gui) From ffc55cb9e4d2b0a0c06a4d0a7cd7e46de1a25ff2 Mon Sep 17 00:00:00 2001 From: "Siggel, Martin" Date: Fri, 8 Dec 2023 13:40:25 +0000 Subject: [PATCH 004/130] switched CI to cmake --- .gitlab-ci.yml | 648 +++++++++++++------------------------------------ 1 file changed, 164 insertions(+), 484 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 644e780..e90efbd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,570 +1,250 @@ -######################################################## -############# GTlab Pipeline Version 2.1.0 ############# -######################################################## -# This is a slight changed version -# - PYVERSION variable to support the build using different Python versions -# - the Python version is appended to the build and test job names -# - debug build is not possible because PythonQt is not available as debug build +################################################################# +############### GTlab Standard Pipeline Version 2.1.0 ########### +################################################################# -# These variables are defined in the CI project settings: -# CATEGORY: 03_core_modules -# PROFILENAME: gtlab_python.pro -# UNITTESTSNAME: GTlabUnitTest -# These variables are defined in the AT-TWK group settings: -# DEVTOOLS_Linux_Stable -# DEVTOOLS_Linux_Unstable -# DEVTOOLS_Win_Stable -# DEVTOOLS_Win_Unstable -# WIN_PYTHON -# STABLE_MAJOR -# STABLE_MINOR -# UNSTABLE_MAJOR -# UNSTABLE_MINOR - -# Environment variables to use in the pipeline globally +# Variables that are defined globally for the pipeline variables: PIPELINEVERSION: "2.1.0" GIT_SUBMODULE_STRATEGY: none # Regulare expression pattern # enclose the branch name with ^ and $ - # separete several branch names with | - # e.g. /^main_1_0$|^main_1_1$/ + # separete severl branch names with | + # e.g. /^main$|^main_1_0$/ STABLE_BRANCHES: /^master$/ - PY_MAJOR_STABLE: 3 - PY_MINOR_STABLE: 7 - - PY_MAJOR_UNSTABLE: 3 - PY_MINOR_UNSTABLE: 9 - - TARGETNAME_STABLE: GTlabPython$PY_MAJOR_STABLE$PY_MINOR_STABLE - TARGETNAME_UNSTABLE: GTlabPython$PY_MAJOR_UNSTABLE$PY_MINOR_UNSTABLE - - TARGETDIRNAME_STABLE: python$PY_MAJOR_STABLE$PY_MINOR_STABLE - TARGETDIRNAME_UNSTABLE: python$PY_MAJOR_UNSTABLE$PY_MINOR_UNSTABLE - - GT_MODULE_ID_STABLE: "Python Module (Python $PY_MAJOR_STABLE.$PY_MINOR_STABLE)" - GT_MODULE_ID_UNSTABLE: "Python Module (Python $PY_MAJOR_UNSTABLE.$PY_MINOR_UNSTABLE)" - - TARGETNAME_SETUP_MODULE: GTlabPythonSetup - # Name of the unstable branch (if it exists) - #UNSTABLE_BRANCH: unstable_master - -# inlcude some templates from this file include: - project: 'at-twk/gitlab-templates' - file: '/ci-templates/.ci-templates-2-1.yml' - + file: '/ci-templates/.ci-templates-cmake-1.0.yml' + stages: - update - build - test - regressionTest - - unstableBuild - - unstableTest - - package + - build_2.0 + - test_2.0 - deploy - codequality + - package - badges -findCodeBaseStatus: - stage: .pre - extends: - - .only-tags-parent - - .findCodeBaseStatusTemplate - tags: - - Win10 - -triggerDeployment: - stage: deploy - extends: .only-tags-parent - trigger: - include: .gitlab-ci.yml - forward: - pipeline_variables: true - strategy: depend - variables: - STABLE_BASE: $BUILD_STABLE_BASE - -# DevTools update -devtoolsUpdateWindows: - stage: update - extends: .devToolsUpdateWindows - -devtoolsUpdateLinux: - stage: update - extends: .devToolsUpdateLinux # build on Windows system -.winDebugArtifacts: - artifacts: - paths: - - lib\$TARGETDIRNAME\$TARGETNAME_SETUP_MODULE-d.dll - - lib\$TARGETDIRNAME\$TARGETNAME_SETUP_MODULE-d.lib - #- lib\$TARGETDIRNAME\$TARGETNAME_SETUP_MODULE-d.pdb - - lib\$TARGETDIRNAME\$TARGETNAME-d.dll - - lib\$TARGETDIRNAME\$TARGETNAME-d.lib - #- lib\$TARGETDIRNAME\$TARGETNAME-d.pdb - - include\$TARGETDIRNAME\ - - build\$UNITTESTSNAME.exe - - build\$UNITTESTSNAME.pdb - expire_in: 1 week - when: always - -.winReleaseArtifacts: - artifacts: - paths: - - lib\$TARGETDIRNAME\$TARGETNAME_SETUP_MODULE.dll - - lib\$TARGETDIRNAME\$TARGETNAME_SETUP_MODULE.lib - - lib\$TARGETDIRNAME\$TARGETNAME.dll - - lib\$TARGETDIRNAME\$TARGETNAME.lib - - include\$TARGETDIRNAME\ - - build\$UNITTESTSNAME.exe - - build\$UNITTESTSNAME.pdb - - buildLog.txt - expire_in: 1 week - when: always - -winBuildDebug: - stage: build - extends: - - .stable-debug - - .buildWinDebug - - .winReleaseArtifacts - needs: - - job: devtoolsUpdateWindows - optional: true - variables: - PY_MAJOR: $PY_MAJOR_STABLE - PY_MINOR: $PY_MINOR_STABLE - MAJOR_VERSION: $STABLE_MAJOR - BUILDBATCH: "true" - BUILDMODE: release - DEVTOOLS: $DEVTOOLS_Win_Stable - JOM_PATH: $JOM_PATH_512 - QMAKE_PATH: $QMAKE_PATH_512 - VCvarsall: $VCVARS_2017_PS - TARGETDIRNAME: $TARGETDIRNAME_STABLE - TARGETNAME: $TARGETNAME_STABLE - -winBuildDebugUnstable: - stage: unstableBuild +windowsBuildDebug_2.0: + stage: build_2.0 extends: - - .unstable-debug - - .buildWinDebug - - .winDebugArtifacts - needs: - - job: devtoolsUpdateWindows - optional: true - variables: - PY_MAJOR: $PY_MAJOR_UNSTABLE - PY_MINOR: $PY_MINOR_UNSTABLE - MAJOR_VERSION: $UNSTABLE_MAJOR - BUILDBATCH: "true" - DEVTOOLS: $DEVTOOLS_Win_Unstable - JOM_PATH: $JOM_PATH_515 - QMAKE_PATH: $QMAKE_PATH_515 - VCvarsall: $VCVARS_2019_PS - TARGETDIRNAME: $TARGETDIRNAME_UNSTABLE - TARGETNAME: $TARGETNAME_UNSTABLE + - .build-win_20 + script: + - cmake -B build -S . -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=install-msvc2019-dbg -DGTLAB_DEVTOOLS_DIR="$env:GTLAB_DEV_TOOLS" -DBUILD_UNITTESTS=ON + - cmake --build build --target install -winBuildRelease: +windowsBuildRelease_1.7: stage: build extends: - - .stable-release - - .buildWinRelease - - .winReleaseArtifacts - needs: - - job: devtoolsUpdateWindows - optional: true - variables: - PY_MAJOR: $PY_MAJOR_STABLE - PY_MINOR: $PY_MINOR_STABLE - BUILDBATCH: "false" - MAJOR_VERSION: $STABLE_MAJOR - DEVTOOLS: $DEVTOOLS_Win_Stable - JOM_PATH: $JOM_PATH_512 - QMAKE_PATH: $QMAKE_PATH_512 - VCvarsall: $VCVARS_2017_PS - TARGETDIRNAME: $TARGETDIRNAME_STABLE - TARGETNAME: $TARGETNAME_STABLE - -winBuildReleaseUnstable: - stage: unstableBuild - extends: - - .unstable-release - - .buildWinRelease - - .winReleaseArtifacts - needs: - - job: devtoolsUpdateWindows - optional: true + - .build-win_17 + script: + - cmake -B build -S . -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install-msvc2017 -DGTLAB_DEVTOOLS_DIR="$env:GTLAB_DEV_TOOLS" -DPython3_LIBRARY="$env:PYTHON_DIR"/libs/python37.lib -DPython3_INCLUDE_DIR="$env:PYTHON_DIR"/include + - cmake --build build --target install variables: - PY_MAJOR: $PY_MAJOR_UNSTABLE - PY_MINOR: $PY_MINOR_UNSTABLE - MAJOR_VERSION: $UNSTABLE_MAJOR - BUILDBATCH: "true" - DEVTOOLS: $DEVTOOLS_Win_Unstable - JOM_PATH: $JOM_PATH_515 - QMAKE_PATH: $QMAKE_PATH_515 - VCvarsall: $VCVARS_2019_PS - TARGETDIRNAME: $TARGETDIRNAME_UNSTABLE - TARGETNAME: $TARGETNAME_UNSTABLE + PYTHON_DIR: C:\devel\GTlab-DevTools\stable\1_7\ThirdPartyLibraries\Python\Python_37 -# build on Linux system -.linuxDebugArtifacts: - artifacts: - paths: - - lib/$TARGETDIRNAME/lib$TARGETNAME_SETUP_MODULE-d.so* - - lib/$TARGETDIRNAME/lib$TARGETNAME-d.so* - - include/$TARGETDIRNAME/ - - build/$UNITTESTSNAME - - linuxBuild.txt - when: always - expire_in: 1 week - -.linuxReleaseArtifacts: - artifacts: - paths: - - lib/$TARGETDIRNAME/lib$TARGETNAME_SETUP_MODULE.so* - - lib/$TARGETDIRNAME/lib$TARGETNAME.so* - - include/$TARGETDIRNAME/ - - meta/ - - examples/ - when: always - expire_in: 1 week +windowsBuildRelease_2.0: + stage: build_2.0 + extends: + - .build-win_20 + - .run-master-and-tags + script: + - cmake -B build -S . -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install-msvc2019 -DGTLAB_DEVTOOLS_DIR="$env:GTLAB_DEV_TOOLS" + - cmake --build build --target install -linuxBuildDebug: +# build on Linux system +linuxBuildDebug_1.7: stage: build extends: - - .stable-debug - - .buildLinuxDebug - - .linuxDebugArtifacts - needs: - - job: devtoolsUpdateLinux - optional: true + - .build-linux_17 + script: + - cmake -B build -S . -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=install-linux-dbg -DGTLAB_DEVTOOLS_DIR=$GTLAB_DEV_TOOLS -DBUILD_UNITTESTS=ON -DPython3_LIBRARY=$PYTHON_DIR/libs/libpython3.7m.so -DPython3_INCLUDE_DIR=$PYTHON_DIR/include/ + - cmake --build build --target install variables: - PY_MAJOR: $PY_MAJOR_STABLE - PY_MINOR: $PY_MINOR_STABLE - MAJOR_VERSION: $STABLE_MAJOR - BUILDBATCH: "false" - DEVTOOLS: $DEVTOOLS_Linux_Stable - QMAKE_EXECUTABLE: /opt/Qt/5.12.5/gcc_64/bin/qmake - TARGETDIRNAME: $TARGETDIRNAME_STABLE - TARGETNAME: $TARGETNAME_STABLE + PYTHON_DIR: /home/gitlab-runner/GTlab-Devtools/stable/1_7/ThirdPartyLibraries/Python/Python_37/ -linuxBuildDebugUnstable: - stage: unstableBuild +linuxBuildDebug_2.0: + stage: build_2.0 extends: - - .unstable-debug - - .buildLinuxDebug - - .linuxDebugArtifacts - needs: - - job: devtoolsUpdateLinux - optional: true - variables: - PY_MAJOR: $PY_MAJOR_UNSTABLE - PY_MINOR: $PY_MINOR_UNSTABLE - BUILDUNITTESTS: "true" - BUILDBATCH: "false" - MAJOR_VERSION: $UNSTABLE_MAJOR - DEVTOOLS: $DEVTOOLS_Linux_Unstable - QMAKE_EXECUTABLE: /opt/Qt/5.15.2/gcc_64/bin/qmake - TARGETDIRNAME: $TARGETDIRNAME_UNSTABLE - TARGETNAME: $TARGETNAME_UNSTABLE - -linuxBuildRelease: + - .build-linux_20 + script: + - cmake -B build -S . -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=install-linux-dbg -DGTLAB_DEVTOOLS_DIR=$GTLAB_DEV_TOOLS -DBUILD_UNITTESTS=ON + - cmake --build build --target install + +linuxBuildRelease_1.7: stage: build extends: - - .stable-release - - .buildLinuxRelease - - .linuxReleaseArtifacts - needs: - - job: devtoolsUpdateLinux - optional: true + - .build-linux_17 + - .run-master-and-tags + script: + - cmake -B build -S . -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install-linux -DGTLAB_DEVTOOLS_DIR=$GTLAB_DEV_TOOLS -DPython3_LIBRARY=$PYTHON_DIR/libs/libpython3.7m.so -DPython3_INCLUDE_DIR=$PYTHON_DIR/include/ + - cmake --build build --target install variables: - PY_MAJOR: $PY_MAJOR_STABLE - PY_MINOR: $PY_MINOR_STABLE - MAJOR_VERSION: $STABLE_MAJOR - BUILDBATCH: "false" - DEVTOOLS: $DEVTOOLS_Linux_Stable - QMAKE_EXECUTABLE: /opt/Qt/5.12.5/gcc_64/bin/qmake - TARGETDIRNAME: $TARGETDIRNAME_STABLE - TARGETNAME: $TARGETNAME_STABLE + PYTHON_DIR: /home/gitlab-runner/GTlab-Devtools/stable/1_7/ThirdPartyLibraries/Python/Python_37/ -linuxBuildReleaseUnstable: - stage: unstableBuild +linuxBuildRelease_2.0: + stage: build_2.0 extends: - - .unstable-release - - .buildLinuxRelease - - .linuxReleaseArtifacts - needs: - - job: devtoolsUpdateLinux - optional: true - variables: - PY_MAJOR: $PY_MAJOR_UNSTABLE - PY_MINOR: $PY_MINOR_UNSTABLE - MAJOR_VERSION: $UNSTABLE_MAJOR - BUILDBATCH: "false" - DEVTOOLS: $DEVTOOLS_Linux_Unstable - QMAKE_EXECUTABLE: /opt/Qt/5.15.2/gcc_64/bin/qmake - TARGETDIRNAME: $TARGETDIRNAME_UNSTABLE - TARGETNAME: $TARGETNAME_UNSTABLE + - .build-linux_20 + - .run-master-and-tags + script: + - cmake -B build -S . -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install-linux -DGTLAB_DEVTOOLS_DIR=$GTLAB_DEV_TOOLS + - cmake --build build --target install # run tests using the binary built before -testWin: +.testWin: stage: test extends: - .stable-debug - .winTestTemplate - script: - - .\tests\unittests\runUnittestsQt512.bat - - get-content CoverageReport*\index.html needs: - - winBuildDebug + - windowsBuildRelease_1.7 + dependencies: + - windowsBuildRelease_1.7 variables: DEVTOOLS: $DEVTOOLS_Win_Stable -testWinUnstable: - stage: unstableTest - extends: - - .unstable-debug - - .winTestTemplate +testWin_2.0: + stage: test_2.0 + tags: ["windows", "docker"] + image: at-twk-hal9000.intra.dlr.de:5000/dlr-at/gtlabdev-2_0-win + needs: ["windowsBuildDebug_2.0"] + before_script: + - '& $env:GTLAB_UPDATE_TOOL up --confirm-command; $null' script: - - .\tests\unittests\runUnittestsQt515.bat - - get-content CoverageReport*\index.html - needs: - - winBuildDebugUnstable - variables: - DEVTOOLS: $DEVTOOLS_Win_Unstable - -testLinux: - stage: test - extends: - - .stable-debug - - .linuxTestTemplate - needs: - - linuxBuildDebug + - $env:path = "$env:GTLAB_DEV_TOOLS\binDebug;$env:path" + - cd build + - .\GTlabPythonUnitTest.exe --gtest_output=xml:unittests.xml + artifacts: + paths: + - "build/unittests.xml" + expire_in: 1 week + reports: + junit: build/unittests.xml + +testLinux_2.0: + stage: test_2.0 + tags: ["linux", "docker"] + image: at-twk-hal9000.intra.dlr.de:5000/dlr-at/gtlabdev-2_0-buster + needs: ["linuxBuildDebug_2.0"] + before_script: + # update to latest dev tools + - '"$GTLAB_UPDATE_TOOL" up --confirm-command' + script: + - cd build + - LD_LIBRARY_PATH="$GTLAB_DEV_TOOLS/binDebug" ./GTlabPythonUnitTest --gtest_output=xml:unittests.xml variables: - DEVTOOLS: $DEVTOOLS_Linux_Stable + GIT_SUBMODULE_STRATEGY: "none" + artifacts: + paths: + - "build/unittests.xml" + expire_in: 1 week + reports: + junit: build/unittests.xml -testLinuxUnstable: - stage: unstableTest +code-coverage: + stage: codequality + tags: ["linux", "docker"] + image: at-twk-hal9000.intra.dlr.de:5000/dlr-at/gtlabdev-2_0-buster extends: - - .unstable-debug - - .linuxTestTemplate - needs: - - linuxBuildDebugUnstable - variables: - DEVTOOLS: $DEVTOOLS_Linux_Unstable - LINUX_QT_DIR: /opt/Qt/5.15.2/gcc_64 - -# run package jobs -winPackageRelease: - stage: package - extends: - - .pkgTemplate - - .stable-release - needs: - - winBuildRelease - variables: - TARGETDIRNAME: $TARGETDIRNAME_STABLE - GT_MODULE_ID: $GT_MODULE_ID_STABLE - -winPackageDebug: - stage: package - extends: - - .pkgTemplate - - .stable-debug - needs: - - winBuildDebug - variables: - BINDIR: binDebug/modules - TARGETDIRNAME: $TARGETDIRNAME_STABLE - GT_MODULE_ID: $GT_MODULE_ID_STABLE - -winPackageReleaseUnstable: - stage: package - extends: - - .pkgTemplate - - .unstable-release - needs: - - winBuildReleaseUnstable - variables: - TARGETDIRNAME: $TARGETDIRNAME_UNSTABLE - GT_MODULE_ID: $GT_MODULE_ID_UNSTABLE - -winPackageDebugUnstable: - stage: package - extends: - - .pkgTemplate - - .unstable-debug - needs: - - winBuildDebugUnstable - variables: - BINDIR: binDebug/modules - TARGETDIRNAME: $TARGETDIRNAME_UNSTABLE - GT_MODULE_ID: $GT_MODULE_ID_UNSTABLE - -linuxPackageRelease: - stage: package - extends: - - .pkgTemplate - - .stable-release - needs: - - linuxBuildRelease + - .build-linux_20 + script: + - cmake -B build -S . -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DGTLAB_DEVTOOLS_DIR=$GTLAB_DEV_TOOLS -DBUILD_UNITTESTS=ON -DBUILD_WITH_COVERAGE=ON + - cd build + - LD_LIBRARY_PATH="$GTLAB_DEV_TOOLS/binDebug" ninja test-coverage + - mv test-coverage .. + coverage: '/^\s{2}lines\.+:\s+(\d+.\d+\%)/' variables: - TARGETDIRNAME: $TARGETDIRNAME_STABLE - GT_MODULE_ID: $GT_MODULE_ID_STABLE + GIT_SUBMODULE_STRATEGY: "none" + artifacts: + expose_as: 'TestCoverage' + name: "TestCoverage-$CI_COMMIT_REF_NAME" + paths: + - "test-coverage" -linuxPackageDebug: - stage: package - extends: - - .pkgTemplate - - .stable-debug - needs: - - linuxBuildDebug - variables: - BINDIR: binDebug/modules - TARGETDIRNAME: $TARGETDIRNAME_STABLE - GT_MODULE_ID: $GT_MODULE_ID_STABLE +# code quality +codingstyle: + stage: codequality + extends: .codingStyleTemplate + +cppcheck: + stage: codequality + extends: .cppCheckTemplate + allow_failure: true -linuxPackageReleaseUnstable: - stage: package - extends: - - .pkgTemplate - - .unstable-release - needs: - - linuxBuildReleaseUnstable - variables: - TARGETDIRNAME: $TARGETDIRNAME_UNSTABLE - GT_MODULE_ID: $GT_MODULE_ID_UNSTABLE +pages: + stage: badges + extends: .pageTemplate -linuxPackageDebugUnstable: - stage: package - extends: - - .pkgTemplate - - .unstable-debug - needs: - - linuxBuildDebugUnstable - variables: - BINDIR: binDebug/modules - TARGETDIRNAME: $TARGETDIRNAME_UNSTABLE - GT_MODULE_ID: $GT_MODULE_ID_UNSTABLE - -packageXml: +.package: stage: package - extends: .packageTemplate - -# deployment -.stable-tag: - rules: - - if: $CI_COMMIT_TAG != null && $STABLE_BASE != null && $STABLE_BASE == "True" - -.unstable-tag: - rules: - - if: $CI_COMMIT_TAG != null && $UNSTABLE_BRANCH == null && $STABLE_BASE != null && $STABLE_BASE == "True" - - if: $CI_COMMIT_TAG != null && $UNSTABLE_BRANCH != null && $STABLE_BASE != null && $STABLE_BASE == "False" - -.deploy: + tags: ["docker", "linux"] + extends: [".run-master-and-tags"] + image: debian:buster script: - - robocopy pkg C:\deployment\$PLATFORMNAME\$CATEGORY\$CI_PROJECT_NAME\$RELEASESTATUS\$CI_COMMIT_TAG /MIR; if ($lastexitcode -lt 4) { $global:LASTEXITCODE = $null } + - cp -r install-$toolchain-dbg/* install-$toolchain + - mv install-$toolchain gtlabpython-$toolchain + - tar czf gtlabpython-$toolchain.tar.gz gtlabpython-$toolchain + artifacts: + name: "gtlabpython-$toolchain" + paths: ["gtlabpython-$toolchain.tar.gz"] variables: - PLATFORMNAME: windows - RELEASESTATUS: stable + toolchain: msvc2019 + GIT_STRATEGY: "none" -winDeployStable: - stage: deploy - extends: - - .stable-tag - - .deploy - tags: - - Win10 - needs: - - winPackageDebug - - winPackageRelease +package-win_2.0: + extends: [".package"] + needs: ["windowsBuildDebug_2.0", "windowsBuildRelease_2.0"] variables: - PLATFORMNAME: windows - RELEASESTATUS: stable + toolchain: msvc2019 -winDeployUnstable: - stage: deploy - extends: - - .unstable-tag - - .deploy - tags: - - Win10 - needs: - - winPackageDebugUnstable - - winPackageReleaseUnstable +package-win_1.7: + extends: [".package"] + needs: ["windowsBuildRelease_1.7"] variables: - PLATFORMNAME: windows - RELEASESTATUS: unstable + toolchain: msvc2017 -linuxDeployStable: - stage: deploy - extends: - - .stable-tag - - .deploy - tags: - - Win10 - needs: - - linuxPackageDebug - - linuxPackageRelease +package-linux_2.0: + extends: [".package"] + needs: ["linuxBuildDebug_2.0", "linuxBuildRelease_2.0"] variables: - PLATFORMNAME: linux - RELEASESTATUS: stable + toolchain: linux -linuxDeployUnstable: - stage: deploy - extends: - - .unstable-tag - - .deploy - tags: - - Win10 - needs: - - linuxPackageDebugUnstable - - linuxPackageReleaseUnstable +package-linux_1.7: + extends: [".package"] + needs: ["linuxBuildDebug_1.7", "linuxBuildRelease_1.7"] variables: - PLATFORMNAME: linux - RELEASESTATUS: unstable - -# code quality -codingstyle: - stage: codequality - extends: .codingStyleTemplate - -cppcheck: - stage: codequality - extends: .cppCheckReportTemplate + toolchain: linux -pages: - stage: badges - extends: .pageTemplate # badges -badges: +badges_1.7: stage: badges extends: - .stable-only-master - .badgeTemplate dependencies: - - winBuildDebug - - linuxBuildDebug - - testWin - - testLinux + - windowsBuildRelease_1.7 + - linuxBuildDebug_1.7 - codingstyle -badgesUnstable: +badges_2.0: stage: badges extends: - .unstable-only-master - .badgeTemplate dependencies: - - winBuildDebugUnstable - - linuxBuildDebugUnstable - - testWinUnstable - - testLinuxUnstable + - windowsBuildDebug_2.0 + - linuxBuildDebug_2.0 + - testWin_2.0 + - testLinux_2.0 - codingstyle + From e22583e8d8ee1091db919834ef2ac06f00479650 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Fri, 8 Dec 2023 16:52:25 +0100 Subject: [PATCH 005/130] Fixed missing resources and ui forms --- src/setup_module/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/setup_module/CMakeLists.txt b/src/setup_module/CMakeLists.txt index 0a36be0..8616295 100644 --- a/src/setup_module/CMakeLists.txt +++ b/src/setup_module/CMakeLists.txt @@ -31,6 +31,8 @@ set(SOURCES gtps_pythoninterpreter.cpp gtps_pythonpreferencepage.cpp gtps_systemsettings.cpp + resources.qrc + gtps_pythonpreferencepage.ui ) add_gtlab_module(GTlabPythonSetup SOURCES ${HEADERS} ${SOURCES} From 34c7c3ae150437229d76e55e10b1b53611dbe560 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Fri, 8 Dec 2023 16:54:17 +0100 Subject: [PATCH 006/130] Removed qmake related files --- .gitignore | 8 +- deployment.pri | 138 ---------- features/gitlab_pipeline_local_settings.pri | 35 --- features/local_settings.pri | 32 --- gtlab_python.pro | 46 ---- settings.pri | 105 ------- src/batch/batch.pro | 104 ------- src/module/module.pro | 287 -------------------- src/setup_module/setup_module.pro | 108 -------- 9 files changed, 2 insertions(+), 861 deletions(-) delete mode 100644 deployment.pri delete mode 100644 features/gitlab_pipeline_local_settings.pri delete mode 100644 features/local_settings.pri delete mode 100644 gtlab_python.pro delete mode 100644 settings.pri delete mode 100644 src/batch/batch.pro delete mode 100644 src/module/module.pro delete mode 100644 src/setup_module/setup_module.pro diff --git a/.gitignore b/.gitignore index 84b234c..44647ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,9 @@ -Makefile* -build/ +build*/ lib/ include/ debug/ release/ -local_settings.pri -!features/local_settings.pri !tests/build/ -*.pro.user *.autosave -.qmake.stash .qtc_clangd/ +CMakeLists.txt.user \ No newline at end of file diff --git a/deployment.pri b/deployment.pri deleted file mode 100644 index 9cc91ed..0000000 --- a/deployment.pri +++ /dev/null @@ -1,138 +0,0 @@ -# ______________ __ -# / ____/_ __/ /___ / /_ -# / / __ / / / / __ `/ __ \ -# / /_/ / / / / / /_/ / /_/ / -# \____/ /_/ /_/\__,_/_.___/ - -###################################################################### -#### Version 1.3 -#### DO NOT CHANGE! -###################################################################### - - -## CREATE INCLUDE DIRECTORY -HEADERS_DIR_PATH = $${PWD}/include -mkpath($${HEADERS_DIR_PATH}) - -## if true, *.lib is copied to the environment path -COPY_LIB_FILE = false - -## FUNCTION DEFINITION FOR COPY FUNCTION -defineTest(copyHeaders) { - files = $$1 - dir = $${HEADERS_DIR_PATH}/$${TARGET_DIR_NAME} - win32 { - - dir ~= s,/,\\,g - - QMAKE_PRE_LINK += if exist $$shell_quote($$dir) rmdir /s /q $$shell_quote($$dir) $$escape_expand(\\n\\t) - QMAKE_POST_LINK += if not exist $$shell_quote($$dir) $$QMAKE_MKDIR $$shell_quote($$dir) $$escape_expand(\\n\\t) - - exists(*.h) { - QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote(*.h) $$shell_quote($$dir) $$escape_expand(\\n\\t) - } - - dirNames = - - for(file, files) { - - exists($$file) { - - dirName = $$dirname(file) - - !isEmpty(dirName) { - - !contains(dirNames, $$dirName) { - - dirNames += $$dirName - sourceDir = $${PWD}/$${dirName}/*.h - - sourceDir ~= s,/,\\,g - - exists($${sourceDir}) { - - QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote($${sourceDir}) $$shell_quote($$dir) $$escape_expand(\\n\\t) - } - } - } - } - } - - } - unix { - - QMAKE_POST_LINK += $$QMAKE_CHK_DIR_EXISTS $$shell_quote($$dir) || $$QMAKE_MKDIR $$shell_quote($$dir) $$escape_expand(\\n\\t) - QMAKE_POST_LINK += find . -name $$shell_quote(*.h) -exec cp $$shell_quote({}) $$shell_quote($$dir) \; $$escape_expand(\\n\\t) - } - - export(QMAKE_POST_LINK) - - return(true) -} - -defineTest(copyToEnvironmentPathModules) { - - isEmpty(GTLAB_ENVIRONMENT_PATH) { - - return(false) - } - - environmentPath = $${GTLAB_ENVIRONMENT_PATH}/modules - - copyToEnvironmentPath($$environmentPath) -} - -defineTest(copyToEnvironmentPath) { - - isEmpty(GTLAB_ENVIRONMENT_PATH) { - - return(false) - } - - isEmpty(DESTDIR) { - - return(false) - } - - args = $$ARGS - - count(args, 1) { - - environmentPath = $$1 - } else { - - environmentPath = $${GTLAB_ENVIRONMENT_PATH} - } - - win32:environmentPath ~= s,/,\\,g - - exists($$environmentPath) { - - win32 { - dllPath = $${DESTDIR}/$${TARGET}.dll - dllPath ~= s,/,\\,g - - QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote($$dllPath) $$shell_quote($$environmentPath) $$escape_expand(\\n\\t) - - equals(COPY_LIB_FILE, true) { - - libPath = $${DESTDIR}/$${TARGET}.lib - libPath ~= s,/,\\,g - - QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote($$libPath) $$shell_quote($$environmentPath) $$escape_expand(\\n\\t) - } - } - - unix: QMAKE_POST_LINK += find $${DESTDIR} -name $$shell_quote(*$${TARGET}.so*) -exec cp $$shell_quote({}) $$shell_quote($$environmentPath) \; $$escape_expand(\\n\\t) - - export(QMAKE_POST_LINK) - - return(true) - } else { - - warning(GTLAB_ENVIRONMENT_PATH ($${environmentPath}) does not exist!) - } - - return(true) -} -###################################################################### diff --git a/features/gitlab_pipeline_local_settings.pri b/features/gitlab_pipeline_local_settings.pri deleted file mode 100644 index b1613ec..0000000 --- a/features/gitlab_pipeline_local_settings.pri +++ /dev/null @@ -1,35 +0,0 @@ -# ______________ __ -# / ____/_ __/ /___ / /_ -# / / __ / / / / __ `/ __ \ -# / /_/ / / / / / /_/ / /_/ / -# \____/ /_/ /_/\__,_/_.___/ - -BUILD_BATCH = $$(BUILDBATCH) -BUILD_UNITTESTS = $$(BUILDUNITTESTS) - -MAJOR_VERSION = $$(MAJOR_VERSION) - -PY_MAJOR_VERSION = $$(PY_MAJOR) -PY_MINOR_VERSION = $$(PY_MINOR) - -# path to dev tools -DEV_TOOLS = $$(DEVTOOLS) -USE_HDF5 = $$(USE_HDF5) - -# path to GTlab Core repository -GTLAB_CORE_PATH = $${DEV_TOOLS} -GTLAB_LOGGING_PATH = $${DEV_TOOLS} -GENH5_PATH = $${DEV_TOOLS} - -# Third Party -PYTHON_PATH = $${DEV_TOOLS}/ThirdPartyLibraries/Python/Python_$${PY_MAJOR_VERSION}$${PY_MINOR_VERSION} -PYTHON_QT_PATH = $${DEV_TOOLS}/ThirdPartyLibraries/PythonQt/PythonQt_$${PY_MAJOR_VERSION}$${PY_MINOR_VERSION} -GOOGLE_TEST_PATH = $${DEV_TOOLS}/ThirdPartyLibraries/GoogleTest -HDF5_PATH = $${DEV_TOOLS}/ThirdPartyLibraries/hdf5 - - -# Deployment -GTLAB_ENVIRONMENT_PATH = - - - diff --git a/features/local_settings.pri b/features/local_settings.pri deleted file mode 100644 index 77a3639..0000000 --- a/features/local_settings.pri +++ /dev/null @@ -1,32 +0,0 @@ -# ______________ __ -# / ____/_ __/ /___ / /_ -# / / __ / / / / __ `/ __ \ -# / /_/ / / / / / /_/ / /_/ / -# \____/ /_/ /_/\__,_/_.___/ - -BUILD_BATCH = true -BUILD_UNITTESTS = true - -MAJOR_VERSION = 2 - -PY_MAJOR_VERSION = 3 -PY_MINOR_VERSION = 9 - -# path to dev tools -DEV_TOOLS = PATH/TO/DEVTOOLS -USE_HDF5 = false - -# path to GTlab Core repository -GTLAB_CORE_PATH = $${DEV_TOOLS} -GTLAB_LOGGING_PATH = $${DEV_TOOLS} -GTLAB_H5_PATH = $${DEV_TOOLS} -GENH5_PATH = $${DEV_TOOLS} - -# Third Party -PYTHON_PATH = $${DEV_TOOLS}\ThirdPartyLibraries\Python\Python_$${PY_MAJOR_VERSION}$${PY_MINOR_VERSION} -PYTHON_QT_PATH = $${DEV_TOOLS}\ThirdPartyLibraries\PythonQt\PythonQt_$${PY_MAJOR_VERSION}$${PY_MINOR_VERSION} -GOOGLE_TEST_PATH = $${DEV_TOOLS}\ThirdPartyLibraries\GoogleTest -HDF5_PATH = $${DEV_TOOLS}/ThirdPartyLibraries/hdf5 - -# Deployment -GTLAB_ENVIRONMENT_PATH = diff --git a/gtlab_python.pro b/gtlab_python.pro deleted file mode 100644 index 4e768ff..0000000 --- a/gtlab_python.pro +++ /dev/null @@ -1,46 +0,0 @@ -# ______________ __ -# / ____/_ __/ /___ / /_ -# / / __ / / / / __ `/ __ \ -# / /_/ / / / / / /_/ / /_/ / -# \____/ /_/ /_/\__,_/_.___/ - -###################################################################### -#### DO NOT CHANGE! -###################################################################### - -include( local_settings.pri ) - -#### ARTISTIC STYLE FILE -DISTFILES += style.astylerc - -TEMPLATE = subdirs -CONFIG += console -CONFIG += c++14 - -SUBDIRS += module -module.subdir = src/module - -#### BATCH #### -contains(BUILD_BATCH, true) { - message("BUILD_BATCH = true") - SUBDIRS += batch - batch.subdir = src/batch - batch.depends = module -} - -#### SETUP MODULE #### -greaterThan(MAJOR_VERSION, 1) { - message("BUILD_SETUP_MODULE = true") - SUBDIRS += setup_module - setup_module.subdir = src/setup_module - module.depends = setup_module -} - -#### UNIT TESTS #### -contains(BUILD_UNITTESTS, true) { - message("BUILD_UNITTESTS = true") - SUBDIRS += unittests - unittests.subdir = tests/unittests - unittests.depends = module -} -###################################################################### diff --git a/settings.pri b/settings.pri deleted file mode 100644 index 41689c2..0000000 --- a/settings.pri +++ /dev/null @@ -1,105 +0,0 @@ -# ______________ __ -# / ____/_ __/ /___ / /_ -# / / __ / / / / __ `/ __ \ -# / /_/ / / / / / /_/ / /_/ / -# \____/ /_/ /_/\__,_/_.___/ - -###################################################################### -#### DO NOT CHANGE! -###################################################################### -# -#### LOCAL SETTINGS -include( local_settings.pri ) -include( deployment.pri ) - -PY_VERSION = $${PY_MAJOR_VERSION}$${PY_MINOR_VERSION} - -TARGET_DIR_NAME = python$${PY_VERSION} -LIB_BUILD_DEST = lib/$${TARGET_DIR_NAME} - -greaterThan(MAJOR_VERSION, 1) { - USE_HDF5 = true -} else { - USE_HDF5 = false -} - -#### GTlab -LIBS += -L$${GTLAB_CORE_PATH}/lib/core -DEPENDPATH += $${GTLAB_CORE_PATH}/lib/core -INCLUDEPATH += $${GTLAB_CORE_PATH}/include/core - -DEFINES += GT_LOG_USE_QT_BINDINGS -LIBS += -L$${GTLAB_LOGGING_PATH}/lib/logging -DEPENDPATH += $${GTLAB_LOGGING_PATH}/lib/logging -INCLUDEPATH += $${GTLAB_LOGGING_PATH}/include/logging - -#### THIRD PARTY LIBRARIES -# Python -LIBS += -L$${PYTHON_PATH}/libs -LIBS += -L$${PYTHON_PATH} -DEPENDPATH += $${PYTHON_PATH} -INCLUDEPATH += $${PYTHON_PATH}/include -unix: INCLUDEPATH += $${PYTHON_PATH}/include/python3.7m - - -#### THIRD PARTY LIBRARIES -equals(QT_MAJOR_VERSION, 5):!lessThan(QT_MINOR_VERSION, 12) { - message(Qt Version 5.12 or newer) - - # Google Test - INCLUDEPATH += $${GOOGLE_TEST_PATH}/include - LIBS += -L$${GOOGLE_TEST_PATH}/lib - DEPENDPATH += $${GOOGLE_TEST_PATH}/lib - -} else { - message(Qt Version older than 5.12) - - # Google Test - INCLUDEPATH += $${GOOGLE_TEST_PATH}/include - win32 { - CONFIG(debug, debug|release){ - LIBS += -L$${GOOGLE_TEST_PATH}/libDebug - DEPENDPATH += $${GOOGLE_TEST_PATH}/libDebug - } else { - LIBS += -L$${GOOGLE_TEST_PATH}/lib - DEPENDPATH += $${GOOGLE_TEST_PATH}/lib - } - } - unix { - LIBS += -L$${GOOGLE_TEST_PATH}/lib - DEPENDPATH += $${GOOGLE_TEST_PATH}/lib - } -} - -# PythonQt -INCLUDEPATH += $${PYTHON_QT_PATH}/include -win32 { - CONFIG(debug, debug|release){ - LIBS += -L$${PYTHON_QT_PATH}/libDebug - DEPENDPATH += $${PYTHON_QT_PATH}/libDebug - } else { - LIBS += -L$${PYTHON_QT_PATH}/lib - DEPENDPATH += $${PYTHON_QT_PATH}/lib - } -} -unix { - LIBS += -L$${PYTHON_QT_PATH}/lib - DEPENDPATH += $${PYTHON_QT_PATH}/lib -} - -# GTlab HDF5 Wrapper -INCLUDEPATH += $${GENH5_PATH}/include/h5 -LIBS += -L$${GENH5_PATH}/lib/h5 -DEPENDPATH += $${GENH5_PATH}/lib/h5 - -## HDF5 -INCLUDEPATH += $${HDF5_PATH}/include -CONFIG(debug, debug|release) { - LIBS += -L$${HDF5_PATH}/libDebug - DEPENDPATH += $${HDF5_PATH}/libDebug -} else { - LIBS += -L$${HDF5_PATH}/lib - DEPENDPATH += $${HDF5_PATH}/lib -} - -###################################################################### diff --git a/src/batch/batch.pro b/src/batch/batch.pro deleted file mode 100644 index 67dc1d0..0000000 --- a/src/batch/batch.pro +++ /dev/null @@ -1,104 +0,0 @@ -# ______________ __ -# / ____/_ __/ /___ / /_ -# / / __ / / / / __ `/ __ \ -# / /_/ / / / / / /_/ / /_/ / -# \____/ /_/ /_/\__,_/_.___/ - -###################################################################### -#### DO NOT CHANGE! -###################################################################### - -include( ../../settings.pri ) - -BUILD_DEST = ../../build -MOC_BUILD_DEST = $${BUILD_DEST} - -GT_MODULE_ID="Python Batch Application" - -CONFIG(debug, debug|release){ - TARGET = GTlabPythonConsole$${PY_VERSION}-d -} else { - TARGET = GTlabPythonConsole$${PY_VERSION} -} - -QT += core xml gui widgets -TEMPLATE = app -CONFIG += console -CONFIG += silent -CONFIG += c++14 - -isEmpty(GT_MODULE_ID) { - error("GT_MODULE_ID undefined. Please define variable GT_MODULE_ID=\"My Module ID\" in project file.") -} - -DEFINES += GT_MODULE_ID='"\\\"$${GT_MODULE_ID}\\\""' - -win32 { - RC_FILE = batch-script.rc -} - -CONFIG(debug, debug|release){ - DESTDIR = $${MOC_BUILD_DEST}/debug-batch-script - OBJECTS_DIR = $${MOC_BUILD_DEST}/debug-batch-script/obj - MOC_DIR = $${MOC_BUILD_DEST}/debug-batch-script/moc - RCC_DIR = $${MOC_BUILD_DEST}/debug-batch-script/rcc - UI_DIR = $${MOC_BUILD_DEST}/debug-batch-script/ui -} else { - DESTDIR = $${MOC_BUILD_DEST}/release-batch-script - OBJECTS_DIR = $${MOC_BUILD_DEST}/release-batch-script/obj - MOC_DIR = $${MOC_BUILD_DEST}/release-batch-script/moc - RCC_DIR = $${MOC_BUILD_DEST}/release-batch-script/rcc - UI_DIR = $${MOC_BUILD_DEST}/release-batch-script/ui -} - -INCLUDEPATH += .\ - ../module \ - ../module/utilities - -DESTDIR = $${BUILD_DEST} - -HEADERS += - -SOURCES += \ - batch-script.cpp - -LIBS += -L../../$${LIB_BUILD_DEST} - -CONFIG(debug, debug|release){ - # GTLAB CORE - greaterThan(MAJOR_VERSION, 1) { - message(GTlab Version 2 or newer) - LIBS += -lGTlabCore-d -lGTlabGui-d -lGTlabDataProcessor-d - } else { - message(GTlab Version older than 2) - # GTLAB CORE - LIBS += -lGTlabDatamodel-d -lGTlabCalculators-d - LIBS += -lGTlabCore-d -lGTlabMdi-d -lGTlabNetwork-d - } - - # GTLAB MODULES - LIBS += -lGTlabPython$${PY_VERSION}-d - - # THIRD PARTY -} else { - # GTLAB CORE - greaterThan(MAJOR_VERSION, 1) { - message(GTlab Version 2 or newer) - LIBS += -lGTlabCore -lGTlabGui -lGTlabDataProcessor - } else { - message(GTlab Version older than 2) - # GTLAB CORE - LIBS += -lGTlabDatamodel -lGTlabCalculators - LIBS += -lGTlabCore -lGTlabMdi -lGTlabNetwork - } - - # GTLAB MODULES - LIBS += -lGTlabPython$${PY_VERSION} - - # THIRD PARTY -} - -# add search paths to shared libraries -unix: QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN:\$$ORIGIN/modules\'' - -###################################################################### diff --git a/src/module/module.pro b/src/module/module.pro deleted file mode 100644 index 2f05a9e..0000000 --- a/src/module/module.pro +++ /dev/null @@ -1,287 +0,0 @@ -# ______________ __ -# / ____/_ __/ /___ / /_ -# / / __ / / / / __ `/ __ \ -# / /_/ / / / / / /_/ / /_/ / -# \____/ /_/ /_/\__,_/_.___/ - -###################################################################### -#### DO NOT CHANGE! -###################################################################### - -include( $${PWD}/../../settings.pri ) - -BUILD_DEST = ../../$${LIB_BUILD_DEST} -MOC_BUILD_DEST = ../../build - -GT_MODULE_ID="Python Module (Python $${PY_MAJOR_VERSION}.$${PY_MINOR_VERSION})" - -CONFIG(debug, debug|release){ - TARGET = GTlabPython$${PY_VERSION}-d -} else { - TARGET = GTlabPython$${PY_VERSION} -} - -QT += core widgets xml svg -TEMPLATE = lib -CONFIG += plugin -CONFIG += silent -CONFIG += c++14 - -DEFINES += GT_PYTHON_DLL -DEFINES += GT_LOG_USE_QT_BINDINGS - -isEmpty(GT_MODULE_ID) { - error("GT_MODULE_ID undefined. Please define variable GT_MODULE_ID=\"My Module ID\" in project file.") -} - -DEFINES += GT_MODULE_ID='"\\\"$${GT_MODULE_ID}\\\""' -DEFINES += PY_MAJOR_VERSION=$${PY_MAJOR_VERSION} -DEFINES += PY_MINOR_VERSION=$${PY_MINOR_VERSION} - -CONFIG(debug, debug|release){ - DESTDIR = $${MOC_BUILD_DEST}/debug-$${TARGET_DIR_NAME} - OBJECTS_DIR = $${MOC_BUILD_DEST}/debug-$${TARGET_DIR_NAME}/obj - MOC_DIR = $${MOC_BUILD_DEST}/debug-$${TARGET_DIR_NAME}/moc - RCC_DIR = $${MOC_BUILD_DEST}/debug-$${TARGET_DIR_NAME}/rcc - UI_DIR = $${MOC_BUILD_DEST}/debug-$${TARGET_DIR_NAME}/ui -} else { - DESTDIR = $${MOC_BUILD_DEST}/release-$${TARGET_DIR_NAME} - OBJECTS_DIR = $${MOC_BUILD_DEST}/release-$${TARGET_DIR_NAME}/obj - MOC_DIR = $${MOC_BUILD_DEST}/release-$${TARGET_DIR_NAME}/moc - RCC_DIR = $${MOC_BUILD_DEST}/release-$${TARGET_DIR_NAME}/rcc - UI_DIR = $${MOC_BUILD_DEST}/release-$${TARGET_DIR_NAME}/ui -} - -INCLUDEPATH += .\ - collection \ - collection/browser \ - collection/browser/items \ - collection/itemwidget \ - collection/localwidget \ - collection/localwidget/items \ - extensions \ - models \ - post \ - processcomponents \ - utilities \ - utilities/pythonextensions \ - widgets \ - wizards \ - wizards/editor_settings \ - wizards/editor_settings/pages \ - wizards/script_calculator \ - wizrads/python_task - - -DESTDIR = $${BUILD_DEST} - -HEADERS += \ - collection/browser/gtpy_collectionbrowser.h \ - collection/browser/gtpy_collectionbrowsermodel.h \ - collection/browser/gtpy_collectionbrowsersortmodel.h \ - collection/browser/items/gtpy_abstractbrowseritem.h \ - collection/browser/items/gtpy_browseritem.h \ - collection/browser/items/gtpy_collapsiblebrowseritem.h \ - collection/browser/items/gtpy_rootbrowseritem.h \ - collection/gtpy_collectionwidget.h \ - collection/gtpy_scriptcollectionsettings.h \ - collection/itemwidget/gtpy_collectionitemwidget.h \ - collection/localwidget/gtpy_collectionlocalmodel.h \ - collection/localwidget/gtpy_collectionlocalwidget.h \ - collection/localwidget/items/gtpy_abstractlocalitem.h \ - collection/localwidget/items/gtpy_collapsiblelocalitem.h \ - collection/localwidget/items/gtpy_localitem.h \ - extensions/gtpy_pythonfunctions.h \ - gt_compat.h \ - gt_python.h \ - gt_pythonmodule_exports.h \ - gtpy_icons_compat.h \ - gtpy_stylesheet_compat.h \ - models/gtpy_completermodel.h \ - models/gtpy_objectmodel.h \ - models/gtpy_taskstylemodel.h \ - post/gtpy_pythonplotconfigdialog.h \ - post/gtpy_pythonplotdata.h \ - post/gtpy_pythonplotitem.h \ - post/gtpy_pythonplotwidget.h \ - post/gtpy_pythonsvgwidget.h \ - processcomponents/gtpy_abstractscriptcomponent.h \ - processcomponents/gtpy_scriptcalculator.h \ - processcomponents/gtpy_task.h \ - utilities/gtpy_calculatorfactory.h \ - utilities/gtpy_codegenerator.h \ - utilities/gtpy_constants.h \ - utilities/gtpy_contextmanager.h \ - utilities/gtpy_decorator.h \ - utilities/gtpy_gilscope.h \ - utilities/gtpy_globals.h \ - utilities/gtpy_interruptrunnable.h \ - utilities/gtpy_matplotlib.h \ - utilities/gtpy_packageiteration.h \ - utilities/gtpy_processdatadistributor.h \ - utilities/gtpy_regexp.h \ - utilities/gtpy_scriptrunnable.h \ - utilities/gtpy_tempdir.h \ - utilities/gtpy_transfer.h \ - utilities/pythonextensions/gtpy_createhelperfunction.h \ - utilities/pythonextensions/gtpy_extendedwrapper.h \ - utilities/pythonextensions/gtpy_importfunction.h \ - utilities/pythonextensions/gtpy_loggingmodule.h \ - utilities/pythonextensions/gtpy_propertysetter.h \ - utilities/pythonextensions/gtpy_stdout.h \ - widgets/gtpy_completer.h \ - widgets/gtpy_console.h \ - widgets/gtpy_scripteditor.h \ - widgets/gtpy_taskdelegate.h \ - widgets/gtpy_tasktreeview.h \ - wizards/editor_settings/gtpy_editorsettings.h \ - wizards/editor_settings/gtpy_editorsettingsdialog.h \ - wizards/editor_settings/pages/gtpy_abstractsettingspage.h \ - wizards/editor_settings/pages/gtpy_generalpage.h \ - wizards/gtpy_abstractscriptingwizardpage.h \ - wizards/gtpy_wizardgeometries.h \ - wizards/gtpy_wizardgeometryitem.h \ - wizards/python_task/gtpy_taskwizardpage.h \ - wizards/script_calculator/gtpy_scriptcalculatorwizardpage.h - - -SOURCES += \ - collection/browser/gtpy_collectionbrowser.cpp \ - collection/browser/gtpy_collectionbrowsermodel.cpp \ - collection/browser/gtpy_collectionbrowsersortmodel.cpp \ - collection/browser/items/gtpy_abstractbrowseritem.cpp \ - collection/browser/items/gtpy_browseritem.cpp \ - collection/browser/items/gtpy_collapsiblebrowseritem.cpp \ - collection/browser/items/gtpy_rootbrowseritem.cpp \ - collection/gtpy_collectionwidget.cpp \ - collection/gtpy_scriptcollectionsettings.cpp \ - collection/itemwidget/gtpy_collectionitemwidget.cpp \ - collection/localwidget/gtpy_collectionlocalmodel.cpp \ - collection/localwidget/gtpy_collectionlocalwidget.cpp \ - collection/localwidget/items/gtpy_abstractlocalitem.cpp \ - collection/localwidget/items/gtpy_collapsiblelocalitem.cpp \ - collection/localwidget/items/gtpy_localitem.cpp \ - extensions/gtpy_pythonfunctions.cpp \ - gt_python.cpp \ - models/gtpy_completermodel.cpp \ - models/gtpy_objectmodel.cpp \ - models/gtpy_taskstylemodel.cpp \ - post/gtpy_pythonplotconfigdialog.cpp \ - post/gtpy_pythonplotdata.cpp \ - post/gtpy_pythonplotitem.cpp \ - post/gtpy_pythonplotwidget.cpp \ - post/gtpy_pythonsvgwidget.cpp \ - processcomponents/gtpy_abstractscriptcomponent.cpp \ - processcomponents/gtpy_scriptcalculator.cpp \ - processcomponents/gtpy_task.cpp \ - utilities/gtpy_calculatorfactory.cpp \ - utilities/gtpy_codegenerator.cpp \ - utilities/gtpy_contextmanager.cpp \ - utilities/gtpy_decorator.cpp \ - utilities/gtpy_gilscope.cpp \ - utilities/gtpy_globals.cpp \ - utilities/gtpy_interruptrunnable.cpp \ - utilities/gtpy_processdatadistributor.cpp \ - utilities/gtpy_regexp.cpp \ - utilities/gtpy_scriptrunnable.cpp \ - utilities/gtpy_tempdir.cpp \ - utilities/gtpy_transfer.cpp \ - utilities/pythonextensions/gtpy_calculatorsmodule.cpp \ - utilities/pythonextensions/gtpy_createhelperfunction.cpp \ - utilities/pythonextensions/gtpy_extendedwrapper.cpp \ - utilities/pythonextensions/gtpy_importfunction.cpp \ - utilities/pythonextensions/gtpy_loggingmodule.cpp \ - utilities/pythonextensions/gtpy_propertysetter.cpp \ - utilities/pythonextensions/gtpy_stdout.cpp \ - widgets/gtpy_completer.cpp \ - widgets/gtpy_console.cpp \ - widgets/gtpy_scripteditor.cpp \ - widgets/gtpy_taskdelegate.cpp \ - widgets/gtpy_tasktreeview.cpp \ - wizards/editor_settings/gtpy_editorsettings.cpp \ - wizards/editor_settings/gtpy_editorsettingsdialog.cpp \ - wizards/editor_settings/pages/gtpy_abstractsettingspage.cpp \ - wizards/editor_settings/pages/gtpy_generalpage.cpp \ - wizards/gtpy_abstractscriptingwizardpage.cpp \ - wizards/gtpy_wizardgeometries.cpp \ - wizards/gtpy_wizardgeometryitem.cpp \ - wizards/python_task/gtpy_taskwizardpage.cpp \ - wizards/script_calculator/gtpy_scriptcalculatorwizardpage.cpp - -CONFIG(debug, debug|release){ - # GTLAB CORE - LIBS += -lGTlabLogging-d - - greaterThan(MAJOR_VERSION, 1) { - message(GTlab Version 2 or newer) - LIBS += -lGTlabCore-d -lGTlabGui-d -lGTlabDataProcessor-d - } else { - message(GTlab Version older than 2) - # GTLAB CORE - LIBS += -lGTlabDatamodel-d -lGTlabCalculators-d - LIBS += -lGTlabCore-d -lGTlabMdi-d -lGTlabNetwork-d - } - - # THIRD PARTY - greaterThan(MAJOR_VERSION, 1) { - win32: LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}.$${PY_MINOR_VERSION}_d - } else { - win32: LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}$${PY_MINOR_VERSION}_d - } - - unix { - LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}.$${PY_MINOR_VERSION} - equals(PY_VERSION, 37) { - DEFINES += PYTHON_LIBRARY=\\\"libpython3.7m.so.1.0\\\" - } else { - DEFINES += PYTHON_LIBRARY=\\\"libpython$${PY_MAJOR_VERSION}.$${PY_MINOR_VERSION}d.so.1.0\\\" - } - } -} else { - # GTLAB CORE - LIBS += -lGTlabLogging - - greaterThan(MAJOR_VERSION, 1) { - message(GTlab Version 2 or newer) - LIBS += -lGTlabCore -lGTlabGui -lGTlabDataProcessor - } else { - message(GTlab Version older than 2) - # GTLAB CORE - LIBS += -lGTlabDatamodel -lGTlabCalculators - LIBS += -lGTlabCore -lGTlabMdi -lGTlabNetwork - } - - # GTLAB MODULES - - # THIRD PARTY - greaterThan(MAJOR_VERSION, 1) { - win32: LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}.$${PY_MINOR_VERSION} - } else { - win32: LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}$${PY_MINOR_VERSION} - } - - unix { - LIBS += -lPythonQt-Qt5-Python$${PY_MAJOR_VERSION}.$${PY_MINOR_VERSION} - - equals(PY_VERSION, 37) { - - DEFINES += PYTHON_LIBRARY=\\\"libpython3.7m.so.1.0\\\" - } else { - - DEFINES += PYTHON_LIBRARY=\\\"libpython$${PY_MAJOR_VERSION}.$${PY_MINOR_VERSION}.so.1.0\\\" - } - } -} - -unix:{ - # suppress the default RPATH if you wish - QMAKE_LFLAGS_RPATH= - # add your own with quoting gyrations to make sure $ORIGIN gets to the command line unexpanded - QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN:\$$ORIGIN/..\'' -} - -###################################################################### - -copyHeaders($$HEADERS) -copyToEnvironmentPathModules() -###################################################################### diff --git a/src/setup_module/setup_module.pro b/src/setup_module/setup_module.pro deleted file mode 100644 index d466dac..0000000 --- a/src/setup_module/setup_module.pro +++ /dev/null @@ -1,108 +0,0 @@ -# ______________ __ -# / ____/_ __/ /___ / /_ -# / / __ / / / / __ `/ __ \ -# / /_/ / / / / / /_/ / /_/ / -# \____/ /_/ /_/\__,_/_.___/ - -###################################################################### -#### DO NOT CHANGE! -###################################################################### - -include( $${PWD}/../../settings.pri ) - -BUILD_DEST = ../../$${LIB_BUILD_DEST} -MOC_BUILD_DEST = ../../build - - -GT_MODULE_ID="Python Setup" - -CONFIG(debug, debug|release){ - TARGET = GTlabPythonSetup-d -} else { - TARGET = GTlabPythonSetup -} - -QT += core widgets -TEMPLATE = lib -CONFIG += plugin -CONFIG += silent -CONFIG += c++14 - -DEFINES += GT_PYTHON_SETUP_DLL - - -isEmpty(GT_MODULE_ID) { - error("GT_MODULE_ID undefined. Please define variable GT_MODULE_ID=\"My Module ID\" in project file.") -} - -DEFINES += GT_MODULE_ID='"\\\"$${GT_MODULE_ID}\\\""' - -CONFIG(debug, debug|release){ - DESTDIR = $${MOC_BUILD_DEST}/debug-$${TARGET_DIR_NAME} - OBJECTS_DIR = $${MOC_BUILD_DEST}/debug-$${TARGET_DIR_NAME}/obj - MOC_DIR = $${MOC_BUILD_DEST}/debug-$${TARGET_DIR_NAME}/moc - RCC_DIR = $${MOC_BUILD_DEST}/debug-$${TARGET_DIR_NAME}/rcc - UI_DIR = $${MOC_BUILD_DEST}/debug-$${TARGET_DIR_NAME}/ui -} else { - DESTDIR = $${MOC_BUILD_DEST}/release-$${TARGET_DIR_NAME} - OBJECTS_DIR = $${MOC_BUILD_DEST}/release-$${TARGET_DIR_NAME}/obj - MOC_DIR = $${MOC_BUILD_DEST}/release-$${TARGET_DIR_NAME}/moc - RCC_DIR = $${MOC_BUILD_DEST}/release-$${TARGET_DIR_NAME}/rcc - UI_DIR = $${MOC_BUILD_DEST}/release-$${TARGET_DIR_NAME}/ui -} - -INCLUDEPATH += . - -DESTDIR = $${BUILD_DEST} - -HEADERS += \ - find_libpython.h \ - gt_python_setup.h \ - gtps_constants.h \ - gtps_globals.h \ - gtps_pythoninterpreter.h \ - gtps_pythonpreferencepage.h \ - gtps_systemsettings.h - -SOURCES += \ - gt_python_setup.cpp \ - gtps_globals.cpp \ - gtps_pythoninterpreter.cpp \ - gtps_pythonpreferencepage.cpp \ - gtps_systemsettings.cpp - - -CONFIG(debug, debug|release){ - # GTLAB CORE - LIBS += -lGTlabLogging-d - LIBS += -lGTlabGui-d -lGTlabCore-d -lGTlabDataProcessor-d - - # THIRD PARTY -} else { - # GTLAB CORE - LIBS += -lGTlabLogging - LIBS += -lGTlabGui -lGTlabCore -lGTlabDataProcessor - - # THIRD PARTY -} - -unix:{ - # suppress the default RPATH if you wish - QMAKE_LFLAGS_RPATH= - # add your own with quoting gyrations to make sure $ORIGIN gets to the command line unexpanded - QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN:\$$ORIGIN/..\'' -} - -###################################################################### - -copyHeaders($$HEADERS) -copyToEnvironmentPathModules() -###################################################################### - -###################################################################### - -FORMS += \ - gtps_pythonpreferencepage.ui - -RESOURCES += \ - resources.qrc From 087efcdd23677b2eb883c296450044c956869620 Mon Sep 17 00:00:00 2001 From: "Siggel, Martin" Date: Mon, 11 Dec 2023 08:02:35 +0000 Subject: [PATCH 007/130] Fixed windows packaging Note: Debug builds for GTlab 1.7 or not supported under windows due to a missing pythonqt library. --- .gitlab-ci.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e90efbd..26ec68a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -207,10 +207,21 @@ package-win_2.0: toolchain: msvc2019 package-win_1.7: - extends: [".package"] + stage: package + tags: ["docker", "linux"] + extends: [".run-master-and-tags"] needs: ["windowsBuildRelease_1.7"] + image: debian:buster + script: + - mv install-$toolchain gtlabpython-$toolchain + - tar czf gtlabpython-$toolchain.tar.gz gtlabpython-$toolchain + artifacts: + name: "gtlabpython-$toolchain" + paths: ["gtlabpython-$toolchain.tar.gz"] variables: toolchain: msvc2017 + GIT_STRATEGY: "none" + package-linux_2.0: extends: [".package"] From 461bb333acce719207c52a26525e18b56d6823c0 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Tue, 12 Dec 2023 13:16:57 +0100 Subject: [PATCH 008/130] Fixed deadlock, when calling python calculators via the python console The implementation releases the GIL for the process executor. We can assume, that no python code is executed in this block. If so, it needs to lock the GIL, which is done anyhow. Closes #251 --- src/module/CMakeLists.txt | 1 + src/module/utilities/gtpy_decorator.cpp | 12 +++++++--- src/module/utilities/gtpy_threadscope.h | 29 +++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 src/module/utilities/gtpy_threadscope.h diff --git a/src/module/CMakeLists.txt b/src/module/CMakeLists.txt index c925525..a87b150 100644 --- a/src/module/CMakeLists.txt +++ b/src/module/CMakeLists.txt @@ -48,6 +48,7 @@ set(HEADERS utilities/gtpy_contextmanager.h utilities/gtpy_decorator.h utilities/gtpy_gilscope.h + utilities/gtpy_threadscope.h utilities/gtpy_globals.h utilities/gtpy_interruptrunnable.h utilities/gtpy_matplotlib.h diff --git a/src/module/utilities/gtpy_decorator.cpp b/src/module/utilities/gtpy_decorator.cpp index f3be02e..2ed3531 100644 --- a/src/module/utilities/gtpy_decorator.cpp +++ b/src/module/utilities/gtpy_decorator.cpp @@ -28,6 +28,7 @@ #include "gtpy_processdatadistributor.h" #include "gtpy_extendedwrapper.h" #include "gtpy_task.h" +#include "gtpy_threadscope.h" #include "gtpy_decorator.h" @@ -431,9 +432,14 @@ GtpyDecorator::runProcess(GtProject* pro, const QString& processId, return false; } - // execute process - GtCoreProcessExecutor executor; - executor.runTask(process); + { + // The executor runs python tasks in a different thread, so we need to call this first + auto _ = GtpyThreadScope(); + + // execute process + GtCoreProcessExecutor executor; + executor.runTask(process); + } if (process->currentState() != GtProcessComponent::FINISHED) { diff --git a/src/module/utilities/gtpy_threadscope.h b/src/module/utilities/gtpy_threadscope.h new file mode 100644 index 0000000..50accfe --- /dev/null +++ b/src/module/utilities/gtpy_threadscope.h @@ -0,0 +1,29 @@ +/* GTlab - Gas Turbine laboratory + * + * SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR) + * + * Author: Martin Siggelr (AT-TWK) + */ + +#ifndef GTPYTHREADSCOPE_H +#define GTPYTHREADSCOPE_H + +#include "PythonQtPythonInclude.h" + +class GtpyThreadScope +{ +public: + GtpyThreadScope() + : state(PyEval_SaveThread()) + {} + + ~GtpyThreadScope() + { + PyEval_RestoreThread(state); + } + +private: + PyThreadState* state; +}; + +#endif // GTPYTHREADSCOPE_H From 859a5783ae9d54fd99e95f9799eca5c4dd2c7805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=B6then=2C=20Marvin?= Date: Wed, 20 Dec 2023 10:46:41 +0000 Subject: [PATCH 009/130] Resolve "It should be possible to access the input and output arguments of any Python task or calculator from the Python script" --- src/module/CMakeLists.txt | 2 + .../gtpy_abstractscriptcomponent.cpp | 70 +++++++++- .../gtpy_abstractscriptcomponent.h | 32 ++++- src/module/utilities/gtpy_contextmanager.cpp | 3 +- src/module/utilities/gtpy_convert.cpp | 57 ++++++++ src/module/utilities/gtpy_convert.h | 47 +++++++ src/module/utilities/gtpy_decorator.cpp | 127 ++++++++++++++++++ src/module/utilities/gtpy_decorator.h | 89 ++++++++++++ 8 files changed, 416 insertions(+), 11 deletions(-) create mode 100644 src/module/utilities/gtpy_convert.cpp create mode 100644 src/module/utilities/gtpy_convert.h diff --git a/src/module/CMakeLists.txt b/src/module/CMakeLists.txt index c925525..43c99a4 100644 --- a/src/module/CMakeLists.txt +++ b/src/module/CMakeLists.txt @@ -46,6 +46,7 @@ set(HEADERS utilities/gtpy_codegenerator.h utilities/gtpy_constants.h utilities/gtpy_contextmanager.h + utilities/gtpy_convert.h utilities/gtpy_decorator.h utilities/gtpy_gilscope.h utilities/gtpy_globals.h @@ -111,6 +112,7 @@ set(SOURCES utilities/gtpy_calculatorfactory.cpp utilities/gtpy_codegenerator.cpp utilities/gtpy_contextmanager.cpp + utilities/gtpy_convert.cpp utilities/gtpy_decorator.cpp utilities/gtpy_gilscope.cpp utilities/gtpy_globals.cpp diff --git a/src/module/processcomponents/gtpy_abstractscriptcomponent.cpp b/src/module/processcomponents/gtpy_abstractscriptcomponent.cpp index e289e23..d2a5019 100644 --- a/src/module/processcomponents/gtpy_abstractscriptcomponent.cpp +++ b/src/module/processcomponents/gtpy_abstractscriptcomponent.cpp @@ -7,7 +7,8 @@ * Tel.: +49 2203 601 2692 */ -#include "gt_globals.h" +#include "gtpy_abstractscriptcomponent.h" + #include "gt_package.h" #include "gt_objectpath.h" #include "gt_objectpathproperty.h" @@ -20,8 +21,48 @@ #endif #include "gtpy_transfer.h" +#include "gtpy_contextmanager.h" -#include "gtpy_abstractscriptcomponent.h" +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) + +namespace { + +bool +setStructContainerValue(GtPropertyStructContainer& con, const QString& argName, + const QVariant& value) +{ + auto entry = std::find_if(con.begin(), con.end(), + [&argName](const GtPropertyStructInstance& entry){ + return entry.getMemberVal("name") == argName; + }); + + if (entry == con.end()) + { + return false; + } + + return entry->setMemberVal("value", value); +} + +QVariant +structContainerValue(const GtPropertyStructContainer& con, const QString& argName) +{ + auto entry = std::find_if(con.begin(), con.end(), + [&argName](const GtPropertyStructInstance& entry){ + return entry.getMemberVal("name") == argName; + }); + + if (entry == con.end()) + { + return {}; + } + + return entry->getMemberValToVariant("value"); +} + +} + +#endif GtpyAbstractScriptComponent::GtpyAbstractScriptComponent() : m_pyThreadId{-1}, @@ -116,16 +157,35 @@ GtpyAbstractScriptComponent::setTabSize(int tabSize) #if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) const GtPropertyStructContainer& -GtpyAbstractScriptComponent::inputArgs() +GtpyAbstractScriptComponent::inputArgs() const { return m_inputArgs; } +QVariant +GtpyAbstractScriptComponent::inputArg(const QString& argName) const +{ + return structContainerValue(m_inputArgs, argName); +} + +bool +GtpyAbstractScriptComponent::setInputArg( + const QString& argName, const QVariant& value) +{ + return setStructContainerValue(m_inputArgs, argName, value); +} + const GtPropertyStructContainer& -GtpyAbstractScriptComponent::outputArgs() +GtpyAbstractScriptComponent::outputArgs() const { return m_outputArgs; } + +QVariant +GtpyAbstractScriptComponent::outputArg(const QString& argName) const +{ + return structContainerValue(m_outputArgs, argName); +} #endif bool @@ -169,4 +229,4 @@ GtpyAbstractScriptComponent::evalScript(int contextId) gtInfo() << "...done!"; return success; -}; +} diff --git a/src/module/processcomponents/gtpy_abstractscriptcomponent.h b/src/module/processcomponents/gtpy_abstractscriptcomponent.h index 4bd3189..a7a43f8 100644 --- a/src/module/processcomponents/gtpy_abstractscriptcomponent.h +++ b/src/module/processcomponents/gtpy_abstractscriptcomponent.h @@ -10,12 +10,11 @@ #ifndef GTPYCOMPONENTASSISTANT_H #define GTPYCOMPONENTASSISTANT_H +#include "gt_globals.h" #include "gt_stringproperty.h" #include "gt_intproperty.h" #include "gt_boolproperty.h" -#include "gtpy_contextmanager.h" - #if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) #include "gt_propertystructcontainer.h" #endif @@ -74,13 +73,38 @@ class GtpyAbstractScriptComponent * @brief Returns the input arguments as property struct container. * @return Input arguments property struct container. */ - const GtPropertyStructContainer& inputArgs(); + const GtPropertyStructContainer& inputArgs() const; + + /** + * @brief Returns the input argument identified by the given argName. + * @param argName Name of the input argument for which the value should be + * returned. + * @return The value of the input arguement identified by argName. + */ + QVariant inputArg(const QString& argName) const; + + /** + * @brief Sets the value of the input argument identified by the given + * argName to the given value. + * @param argName Name of the input argument for which the value should be + * set. + * @param value New argument value. + */ + bool setInputArg(const QString& argName, const QVariant& value); /** * @brief Returns the output arguments as property struct container. * @return Output arguments property struct container. */ - const GtPropertyStructContainer& outputArgs(); + const GtPropertyStructContainer& outputArgs() const; + + /** + * @brief Returns the output argument identified by the given argName. + * @param argName Name of the output argument for which the value should be + * returned. + * @return The value of the output arguement identified by argName. + */ + QVariant outputArg(const QString& argName) const; #endif protected: diff --git a/src/module/utilities/gtpy_contextmanager.cpp b/src/module/utilities/gtpy_contextmanager.cpp index 3675d5b..d2f3838 100644 --- a/src/module/utilities/gtpy_contextmanager.cpp +++ b/src/module/utilities/gtpy_contextmanager.cpp @@ -508,7 +508,7 @@ GtpyContextManager::addGtObject(int contextId, const QString& name, } bool -GtpyContextManager::addVariable(int contextId, const QString &name, const QVariant &value) +GtpyContextManager::addVariable(int contextId, const QString& name, const QVariant& value) { PythonQtObjectPtr con = context(contextId); @@ -537,7 +537,6 @@ GtpyContextManager::getVariable(int contextId, const QString &name) GTPY_GIL_SCOPE return con.getVariable(name); - } bool diff --git a/src/module/utilities/gtpy_convert.cpp b/src/module/utilities/gtpy_convert.cpp new file mode 100644 index 0000000..f736771 --- /dev/null +++ b/src/module/utilities/gtpy_convert.cpp @@ -0,0 +1,57 @@ +/* GTlab - Gas Turbine laboratory + * Source File: gtpy_convert.cpp + * copyright 2009-2019 by DLR + * + * Created on: 15.11.2023 + * Author: Marvin Noethen (AT-TW) + * Tel.: +49 2203 601 2692 + */ + +#include "gtpy_convert.h" + +#include "PythonQtConversion.h" + +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) +#include "gt_structproperty.h" +#endif + +#include "gtpy_gilscope.h" + + +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) + +PyObject* +gtpy::convert::fromPropertyStructContainer(const GtPropertyStructContainer& con) +{ + GTPY_GIL_SCOPE + + PyObject* result = PyDict_New(); + + /// iterate through the container entries + for (const auto& entry : con) + { + auto name = entry.getMemberVal("name"); + + if (!name.isEmpty()) + { + bool ok{true}; + auto val = entry.getMemberValToVariant("value", &ok); + + if (ok) + { + /// convert value to PyObject* + auto* valObj = PythonQtConv::QVariantToPyObject(val); + + /// sets name and val to the result dict + PyDict_SetItemString(result, name.toUtf8().data(), valObj); + + /// decrement the reference count for valObj + Py_DECREF(valObj); + } + } + } + + return result; +} + +#endif diff --git a/src/module/utilities/gtpy_convert.h b/src/module/utilities/gtpy_convert.h new file mode 100644 index 0000000..ce0e25b --- /dev/null +++ b/src/module/utilities/gtpy_convert.h @@ -0,0 +1,47 @@ +/* GTlab - Gas Turbine laboratory + * Source File: gtpy_convert.h + * copyright 2009-2019 by DLR + * + * Created on: 15.11.2023 + * Author: Marvin Noethen (AT-TW) + * Tel.: +49 2203 601 2692 + */ + +#ifndef GTPYCONVERT_H +#define GTPYCONVERT_H + +#include "gt_globals.h" + +#include + +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) +#include "gt_propertystructcontainer.h" +#endif + +namespace gtpy { + +namespace convert { + +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) +/** + * @brief Converts the passed GtPropertyStructContainer into a Python dict + * and returns it. The entries in the GtPropertyStructContainer require a + * member named 'name' and a member named 'value'. In Python dict, the name + * is used as a key to identify the corresponding value. The dict is an + * independent instance and changes to it do not affect + * the GtPropertyStructContainer. + * @param con GtPropertyStructContainer to convert. + * @return Python dict with name and value pairs from the passed + * GtPropertyStructContainer. + */ +PyObject* +fromPropertyStructContainer(const GtPropertyStructContainer& con); +#endif + +} // namespace convert + +} // namespace gtpy + + + +#endif // GTPYCONVERT_H diff --git a/src/module/utilities/gtpy_decorator.cpp b/src/module/utilities/gtpy_decorator.cpp index f3be02e..599791a 100644 --- a/src/module/utilities/gtpy_decorator.cpp +++ b/src/module/utilities/gtpy_decorator.cpp @@ -28,6 +28,8 @@ #include "gtpy_processdatadistributor.h" #include "gtpy_extendedwrapper.h" #include "gtpy_task.h" +#include "gtpy_scriptcalculator.h" +#include "gtpy_convert.h" #include "gtpy_decorator.h" @@ -502,6 +504,68 @@ GtpyDecorator::run(GtCalculator* calc) return success; } +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) +PyObject* +GtpyDecorator::inputArgs(GtpyScriptCalculator* calc) const +{ + return gtpy::convert::fromPropertyStructContainer(calc->inputArgs()); +} + +QVariant +GtpyDecorator::inputArg(GtpyScriptCalculator* calc, const QString& argName) const +{ + QVariant value = calc->inputArg(argName); + + if (!value.isValid()) + { + throw std::runtime_error( + tr("\n\nKeyError: '%1'\n" + "%2 has no input argument with the name '%1'") + .arg(argName, calc->objectName()) + .toStdString()); + } + + return value; +} + +void +GtpyDecorator::setInputArg(GtpyScriptCalculator* calc, const QString& argName, + const QVariant& value) +{ + if (!calc->setInputArg(argName, value)) + { + throw std::runtime_error( + tr("\n\nKeyError: '%1'\n" + "%2 has no input argument with the name '%1'") + .arg(argName, calc->objectName()) + .toStdString()); + } +} + +PyObject* +GtpyDecorator::outputArgs(GtpyScriptCalculator* calc) const +{ + return gtpy::convert::fromPropertyStructContainer(calc->outputArgs()); +} + +QVariant +GtpyDecorator::outputArg(GtpyScriptCalculator* calc, const QString& argName) const +{ + QVariant value = calc->outputArg(argName); + + if (!value.isValid()) + { + throw std::runtime_error( + tr("\n\nKeyError: '%1'\n" + "%2 has no output argument with the name '%1'") + .arg(argName, calc->objectName()) + .toStdString()); + } + + return value; +} +#endif + bool GtpyDecorator::run(GtTask* task) { @@ -634,6 +698,69 @@ GtpyDecorator::deleteAllCalculators(GtTask* task) Py_END_ALLOW_THREADS } +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) +PyObject* +GtpyDecorator::inputArgs(GtpyTask* task) const +{ + return gtpy::convert::fromPropertyStructContainer(task->inputArgs()); +} + +QVariant +GtpyDecorator::inputArg(GtpyTask* task, const QString& argName) const +{ + QVariant value = task->inputArg(argName); + + if (!value.isValid()) + { + throw std::runtime_error( + tr("\n\nKeyError: '%1'\n" + "%2 has no input argument with the name '%1'") + .arg(argName, task->objectName()) + .toStdString()); + } + + return value; +} + +void +GtpyDecorator::setInputArg(GtpyTask* task, const QString& argName, + const QVariant& value) +{ + if (!task->setInputArg(argName, value)) + { + throw std::runtime_error( + tr("\n\nKeyError: '%1'\n" + "%2 has no input argument with the name '%1'") + .arg(argName, task->objectName()) + .toStdString()); + } +} + +PyObject* +GtpyDecorator::outputArgs(GtpyTask* task) const +{ + return gtpy::convert::fromPropertyStructContainer(task->outputArgs()); +} + +QVariant +GtpyDecorator::outputArg(GtpyTask* task, const QString& argName) const +{ + QVariant value = task->outputArg(argName); + + if (!value.isValid()) + { + throw std::runtime_error( + tr("\n\nKeyError: '%1'\n" + "%2 has no output argument with the name '%1'") + .arg(argName, task->objectName()) + .toStdString()); + } + + return value; +} +#endif + + bool GtpyDecorator::hasWarnings(GtProcessComponent* comp) { diff --git a/src/module/utilities/gtpy_decorator.h b/src/module/utilities/gtpy_decorator.h index a2c454c..e58dbe0 100644 --- a/src/module/utilities/gtpy_decorator.h +++ b/src/module/utilities/gtpy_decorator.h @@ -26,6 +26,7 @@ class GtCalculator; class GtpyTask; class GtpyProcessDataDistributor; class GtProcessComponent; +class GtpyScriptCalculator; #if GT_VERSION < GT_VERSION_CHECK(2, 0, 0) class GtDataZone0D; @@ -209,6 +210,49 @@ public slots: */ bool run(GtCalculator* calc); +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) + /** + * @brief Decorates inputArgs() method of GtpyScriptCalculator. + * @param calc Pointer to GtpyScriptCalculator + * @return The input arguments of the given component as Python dict. + */ + PyObject* inputArgs(GtpyScriptCalculator* calc) const; + + /** + * @brief Decorates inputArg() method of GtpyScriptCalculator. + * @param calc Pointer to GtpyScriptCalculator + * @param argName Name of the argument whose value should be returned + * @return Value of the argument with the given name. If there is no + * argument with the given name, a std::runtime_error is thrown. + */ + QVariant inputArg(GtpyScriptCalculator* calc, const QString& argName) const; + + /** + * @brief Decorates setInputArg() method of GtpyScriptCalculator. + * @param calc Pointer to GtpyScriptCalculator + * @param argName Name of the argument whose value should be set + * @param value The new value of the argument with the given name. + */ + void setInputArg(GtpyScriptCalculator* calc, const QString& argName, + const QVariant& value); + + /** + * @brief Decorates outputArgs() method of GtpyScriptCalculator. + * @param calc Pointer to GtpyScriptCalculator + * @return The output arguments of the given component as Python dict. + */ + PyObject* outputArgs(GtpyScriptCalculator* calc) const; + + /** + * @brief Decorates outputArg() method of GtpyScriptCalculator. + * @param calc Pointer to GtpyScriptCalculator + * @param argName Name of the argument whose value should be returned + * @return Value of the argument with the given name. If there is no + * argument with the given name, a std::runtime_error is thrown. + */ + QVariant outputArg(GtpyScriptCalculator* calc, const QString& argName) const; +#endif + ///-------> functions of GtTask <-------\\\ /** @@ -224,6 +268,49 @@ public slots: */ void deleteAllCalculators(GtTask* task); +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) + /** + * @brief Decorates inputArgs() method of GtpyTask. + * @param task Pointer to GtpyTask + * @return The input arguments of the given component as Python dict. + */ + PyObject* inputArgs(GtpyTask* task) const; + + /** + * @brief Decorates inputArg() method of GtpyTask. + * @param task Pointer to GtpyTask + * @param argName Name of the argument whose value should be returned + * @return Value of the argument with the given name. If there is no + * argument with the given name, a std::runtime_error is thrown. + */ + QVariant inputArg(GtpyTask* task, const QString& argName) const; + + /** + * @brief Decorates setInputArg() method of GtpyTask. + * @param task Pointer to GtpyTask + * @param argName Name of the argument whose value should be set + * @param value The new value of the argument with the given name. + */ + void setInputArg(GtpyTask* task, const QString& argName, + const QVariant& value); + + /** + * @brief Decorates outputArgs() method of GtpyTask. + * @param task Pointer to GtpyTask + * @return The output arguments of the given component as Python dict. + */ + PyObject* outputArgs(GtpyTask* task) const; + + /** + * @brief Decorates outputArg() method of GtpyTask. + * @param task Pointer to GtpyTask + * @param argName Name of the argument whose value should be returned + * @return Value of the argument with the given name. If there is no + * argument with the given name, a std::runtime_error is thrown. + */ + QVariant outputArg(GtpyTask* task, const QString& argName) const; +#endif + ///-------> functions of GtProcessComponent <-------\\\ /** @@ -463,6 +550,8 @@ public slots: bool appendData(GtDataZone0D* dataZone, const QString& paramName, const QString& unit, double value); #endif + + signals: /** * @brief sendPythonConsoleOutput signal for transmitting an output message From 1141f334285a043cdcab4ba74a0da898957cec40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=B6then=2C=20Marvin?= Date: Wed, 20 Dec 2023 11:04:15 +0000 Subject: [PATCH 010/130] Resolve "Create a scirpt editor component that provides redo/undo and searching" --- src/module/CMakeLists.txt | 8 + src/module/gtpy_icons_compat.h | 5 + src/module/gtpy_stylesheet_compat.h | 4 +- src/module/widgets/gtpy_lineedit.cpp | 50 ++ src/module/widgets/gtpy_lineedit.h | 86 ++ src/module/widgets/gtpy_replacewidget.cpp | 256 ++++++ src/module/widgets/gtpy_replacewidget.h | 172 ++++ .../widgets/gtpy_scripteditorwidget.cpp | 215 +++++ src/module/widgets/gtpy_scripteditorwidget.h | 122 +++ src/module/widgets/gtpy_scriptview.cpp | 808 ++++++++++++++++++ src/module/widgets/gtpy_scriptview.h | 331 +++++++ 11 files changed, 2055 insertions(+), 2 deletions(-) create mode 100644 src/module/widgets/gtpy_lineedit.cpp create mode 100644 src/module/widgets/gtpy_lineedit.h create mode 100644 src/module/widgets/gtpy_replacewidget.cpp create mode 100644 src/module/widgets/gtpy_replacewidget.h create mode 100644 src/module/widgets/gtpy_scripteditorwidget.cpp create mode 100644 src/module/widgets/gtpy_scripteditorwidget.h create mode 100644 src/module/widgets/gtpy_scriptview.cpp create mode 100644 src/module/widgets/gtpy_scriptview.h diff --git a/src/module/CMakeLists.txt b/src/module/CMakeLists.txt index 43c99a4..e6ad62f 100644 --- a/src/module/CMakeLists.txt +++ b/src/module/CMakeLists.txt @@ -66,7 +66,11 @@ set(HEADERS utilities/pythonextensions/gtpy_stdout.h widgets/gtpy_completer.h widgets/gtpy_console.h + widgets/gtpy_lineedit.h + widgets/gtpy_replacewidget.h widgets/gtpy_scripteditor.h + widgets/gtpy_scripteditorwidget.h + widgets/gtpy_scriptview.h widgets/gtpy_taskdelegate.h widgets/gtpy_tasktreeview.h wizards/editor_settings/gtpy_editorsettings.h @@ -131,7 +135,11 @@ set(SOURCES utilities/pythonextensions/gtpy_stdout.cpp widgets/gtpy_completer.cpp widgets/gtpy_console.cpp + widgets/gtpy_lineedit.cpp + widgets/gtpy_replacewidget.cpp widgets/gtpy_scripteditor.cpp + widgets/gtpy_scripteditorwidget.cpp + widgets/gtpy_scriptview.cpp widgets/gtpy_taskdelegate.cpp widgets/gtpy_tasktreeview.cpp wizards/editor_settings/gtpy_editorsettings.cpp diff --git a/src/module/gtpy_icons_compat.h b/src/module/gtpy_icons_compat.h index 515616b..2576aa5 100644 --- a/src/module/gtpy_icons_compat.h +++ b/src/module/gtpy_icons_compat.h @@ -50,6 +50,11 @@ #define GTPY_PNG_ICON_triangleSmallLeft "arrowleftIcon.png" #define GTPY_PNG_ICON_triangleSmallRight "arrowrightIcon.png" #define GTPY_PNG_ICON_update "updateIcon_16.png" +#define GTPY_PNG_ICON_undo "undoIcon_24.png" +#define GTPY_PNG_ICON_redo "undoIcon_24.png" +#define GTPY_PNG_ICON_swap "reloadIcon.png" +#define GTPY_PNG_ICON_search "searchIcon_24.png" +#define GTPY_PNG_ICON_backspaceFlipped "clearIcon2_16.png" #endif diff --git a/src/module/gtpy_stylesheet_compat.h b/src/module/gtpy_stylesheet_compat.h index c961003..33b4cea 100644 --- a/src/module/gtpy_stylesheet_compat.h +++ b/src/module/gtpy_stylesheet_compat.h @@ -11,11 +11,10 @@ #define GTPY_STYLESHEET_COMPAT_H #include "gt_globals.h" +#include "gt_stylesheets.h" #if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) -#include "gt_stylesheets.h" - #define GTPY_STYLESHEET(x) gt::gui::stylesheet::x() #else @@ -26,6 +25,7 @@ "#frame {border-image: " \ "url(:/pixmaps/startup-background.png)}" +#define GTPY_STYLESHEET_standardLineEdit GtStyleSheets::standardLineEdit() #endif #endif // GTPY_STYLESHEET_COMPAT_H diff --git a/src/module/widgets/gtpy_lineedit.cpp b/src/module/widgets/gtpy_lineedit.cpp new file mode 100644 index 0000000..751220a --- /dev/null +++ b/src/module/widgets/gtpy_lineedit.cpp @@ -0,0 +1,50 @@ +/* GTlab - Gas Turbine laboratory + * Source File: gtpy_lineedit.cpp + * copyright 2009-2019 by DLR + * + * Created on: 24.10.2023 + * Author: Marvin Noethen (AT-TW) + * Tel.: +49 2203 601 2692 + */ + +#include "gtpy_lineedit.h" + +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) + +GtpyLineEdit::GtpyLineEdit(QWidget* parent) : GtLineEdit(parent) +{ + +} + +#else + +GtpyLineEdit::GtpyLineEdit(QWidget* parent) : QLineEdit(parent) +{ + +} + +void +GtpyLineEdit::focusInEvent(QFocusEvent* event) +{ + emit focusIn(); + + QLineEdit::focusInEvent(event); +} + +void +GtpyLineEdit::focusOutEvent(QFocusEvent* event) +{ + if (text().isEmpty()) + { + emit clearFocusOut(); + } + else + { + emit focusOut(); + } + + QLineEdit::focusOutEvent(event); +} + + +#endif diff --git a/src/module/widgets/gtpy_lineedit.h b/src/module/widgets/gtpy_lineedit.h new file mode 100644 index 0000000..dde93d6 --- /dev/null +++ b/src/module/widgets/gtpy_lineedit.h @@ -0,0 +1,86 @@ +/* GTlab - Gas Turbine laboratory + * Source File: gtpy_lineedit.h + * copyright 2009-2019 by DLR + * + * Created on: 24.10.2023 + * Author: Marvin Noethen (AT-TW) + * Tel.: +49 2203 601 2692 + */ + +#ifndef GTPYLINEEDIT_H +#define GTPYLINEEDIT_H + +#include "gt_globals.h" + +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) +#include "gt_lineedit.h" +/** + * @brief The GtpyLineEdit class + */ +class GtpyLineEdit : public GtLineEdit +{ + Q_OBJECT + +public: + /** + * @brief GtpyLineEdit + * @param parent + */ + explicit GtpyLineEdit(QWidget* parent = nullptr); +}; + +#else +#include +/** + * @brief The GtpyLineEdit class + */ +class GtpyLineEdit : public QLineEdit +{ + Q_OBJECT + +public: + /** + * @brief GtpyLineEdit + * @param parent + */ + explicit GtpyLineEdit(QWidget* parent = nullptr); + +protected: + + /** + * @brief focusInEvent overloaded to emit the focusIn event + * @param event + */ + void focusInEvent(QFocusEvent* event) override; + + /** + * @brief focusOutEvent overloaded to emit the focusOut events + * @param event + */ + void focusOutEvent(QFocusEvent* event) override; + +signals: + + /** + * @brief focusIn emitted once the lineedit receives the focus for input + */ + void focusIn(); + + /** + * @brief focusOut emitted once the lineedit looses focus and contains any + * text + */ + void focusOut(); + + /** + * @brief clearFocusOut emitted once the lineedit looses focus and does not + * contain any text + */ + void clearFocusOut(); +}; + +#endif + + + +#endif // GTPYLINEEDIT_H diff --git a/src/module/widgets/gtpy_replacewidget.cpp b/src/module/widgets/gtpy_replacewidget.cpp new file mode 100644 index 0000000..7f86817 --- /dev/null +++ b/src/module/widgets/gtpy_replacewidget.cpp @@ -0,0 +1,256 @@ +/* GTlab - Gas Turbine laboratory + * Source File: gtpy_replacewidget.cpp + * copyright 2009-2019 by DLR + * + * Created on: 20.10.2023 + * Author: Marvin Noethen (AT-TW) + * Tel.: +49 2203 601 2692 + */ + +#include +#include +#include + +#include "gtpy_lineedit.h" + +#include "gtpy_icons_compat.h" +#include "gtpy_stylesheet_compat.h" + +#include "gtpy_replacewidget.h" + +GtpyReplaceWidget::GtpyReplaceWidget(QWidget* parent) : QWidget(parent), + m_searchLine{nullptr}, + m_replaceLine{nullptr}, + m_searchButton{nullptr}, + m_clearButton{nullptr}, + m_backwardButton{nullptr}, + m_forwardButton{nullptr} +{ + /// main layout + auto* mainLayout = new QHBoxLayout; + mainLayout->setContentsMargins(0, 0, 0, 0); + mainLayout->setSpacing(0); + + /// search button + m_searchButton = new QPushButton; + m_searchButton->setIcon(GTPY_ICON(search)); + m_searchButton->setMaximumSize(QSize(20, 20)); + m_searchButton->setFlat(true); + m_searchButton->setToolTip(tr("Search")); + + mainLayout->addWidget(m_searchButton); + + /// clear button + m_clearButton = new QPushButton; + m_clearButton->setIcon(GTPY_ICON(backspaceFlipped)); + m_clearButton->setMaximumSize(QSize(20, 20)); + m_clearButton->setFlat(true); + m_clearButton->setToolTip(tr("Clear Search")); + m_clearButton->setVisible(false); + + mainLayout->addWidget(m_clearButton); + + /// search line + m_searchLine = new GtpyLineEdit; + m_searchLine->setMaximumHeight(17); + m_searchLine->setStyleSheet(GTPY_STYLESHEET(standardLineEdit)); + m_searchLine->setVisible(false); + m_searchLine->setPlaceholderText(tr("Search for")); + m_searchLine->installEventFilter(this); + + mainLayout->addWidget(m_searchLine); + + /// search backward button + m_backwardButton = new QPushButton; + m_backwardButton->setIcon(GTPY_ICON(triangleSmallLeft)); + m_backwardButton->setToolTip(tr("Search backwards")); + m_backwardButton->setMaximumSize(QSize(15, 20)); + m_backwardButton->setFlat(true); + m_backwardButton->setVisible(false); + + mainLayout->addWidget(m_backwardButton); + + /// search forward button + m_forwardButton = new QPushButton; + m_forwardButton->setIcon(GTPY_ICON(triangleSmallRight)); + m_forwardButton->setToolTip(tr("Search forwards")); + m_forwardButton->setMaximumSize(QSize(15, 20)); + m_forwardButton->setFlat(true); + m_forwardButton->setVisible(false); + + mainLayout->addWidget(m_forwardButton); + + /// search line + m_replaceLine = new GtpyLineEdit; + m_replaceLine->setMaximumHeight(17); + m_replaceLine->setStyleSheet(GTPY_STYLESHEET(standardLineEdit)); + m_replaceLine->setVisible(false); + m_replaceLine->setPlaceholderText(tr("Replace by")); + m_replaceLine->installEventFilter(this); + + mainLayout->addWidget(m_replaceLine); + + /// replace button + m_replaceButton = new QPushButton; + m_replaceButton->setIcon(GTPY_ICON(swap)); + m_replaceButton->setMaximumSize(QSize(20, 20)); + m_replaceButton->setFlat(true); + m_replaceButton->setToolTip(tr("Replace")); + m_replaceButton->installEventFilter(this); + + mainLayout->addWidget(m_replaceButton); + + mainLayout->addStretch(1); + + setLayout(mainLayout); + + /// connect serach button + connect(m_searchButton, SIGNAL(clicked(bool)), this, SLOT(enableSearch())); + + /// connect clear button + connect(m_clearButton, SIGNAL(clicked(bool)), this, + SLOT(disableSearchAndReplace())); + + /// connect replace button + connect(m_replaceButton, SIGNAL(clicked(bool)), this, + SLOT(onReplaceClicked())); + + /// connect serach line + connect(m_searchLine, SIGNAL(textEdited(QString)), this, + SIGNAL(searchTextEdited(QString))); + connect(m_searchLine, SIGNAL(textChanged(QString)), this, + SLOT(onSearchTextChanged())); + connect(m_searchLine, SIGNAL(returnPressed()), this, + SIGNAL(searchLineReturnPressed())); + + /// connect replace line + connect(m_replaceLine, SIGNAL(returnPressed()), this, + SLOT(onReplaceClicked())); + + /// connect forward and backward button + connect(m_backwardButton, SIGNAL(clicked(bool)), this, + SIGNAL(backwardButtonClicked())); + connect(m_forwardButton, SIGNAL(clicked(bool)), this, + SIGNAL(forwardButtonClicked())); +} + +QString +GtpyReplaceWidget::searchText() const +{ + return m_searchLine->text(); +} + +QString +GtpyReplaceWidget::replaceText() const +{ + return m_replaceLine->text(); +} + +void +GtpyReplaceWidget::setSearchText(const QString& text) +{ + m_searchLine->setText(text); +} + +void +GtpyReplaceWidget::setReplaceText(const QString& text) +{ + m_replaceLine->setText(text); +} + +bool +GtpyReplaceWidget::eventFilter(QObject* obj, QEvent* event) +{ + if (obj == m_replaceLine || obj == m_searchLine || obj == m_replaceButton) + { + if (event->type() == QEvent::FocusOut) + { + if (!m_clearButton->hasFocus()) + { + if (m_replaceLine->text().isEmpty() && + m_searchLine->text().isEmpty() && + !m_replaceButton->hasFocus() && + !m_searchLine->hasFocus() && + !m_replaceLine->hasFocus()) + { + disableSearchAndReplace(); + return true; + } + } + } + } + + return QWidget::eventFilter(obj, event); +} + +void +GtpyReplaceWidget::enableSearch() +{ + enableSearchComponentes(); + emit searchEnabled(); +} + +void +GtpyReplaceWidget::enableReplace() +{ + enableSearchComponentes(); + m_replaceLine->setVisible(true); + + if (!m_searchLine->text().isEmpty()) + { + m_replaceLine->setFocus(); + } + + emit replaceEnabled(); +} + +void +GtpyReplaceWidget::disableSearchAndReplace() +{ + m_searchButton->setVisible(true); + m_clearButton->setVisible(false); + m_backwardButton->setVisible(false); + m_forwardButton->setVisible(false); + m_searchLine->setVisible(false); + m_replaceLine->setVisible(false); + m_searchLine->clear(); + m_replaceLine->clear(); + + emit searchAndReplaceDisabled(); +} + +void +GtpyReplaceWidget::enableSearchComponentes() +{ + enableSearchNavigation(); + m_searchButton->setVisible(false); + m_clearButton->setVisible(true); + m_backwardButton->setVisible(true); + m_forwardButton->setVisible(true); + m_searchLine->setVisible(true); + m_searchLine->selectAll(); + m_searchLine->setFocus(); +} + +void +GtpyReplaceWidget::enableSearchNavigation() +{ + bool enable = !m_searchLine->text().isEmpty(); + m_forwardButton->setEnabled(enable); + m_backwardButton->setEnabled(enable); +} + +void +GtpyReplaceWidget::onSearchTextChanged() +{ + enableSearchNavigation(); + emit searchTextChanged(m_searchLine->text()); +} + +void +GtpyReplaceWidget::onReplaceClicked() +{ + m_replaceLine->isVisible() ? + emit replace(m_searchLine->text(), m_replaceLine->text()) : + enableReplace(); +} diff --git a/src/module/widgets/gtpy_replacewidget.h b/src/module/widgets/gtpy_replacewidget.h new file mode 100644 index 0000000..5692610 --- /dev/null +++ b/src/module/widgets/gtpy_replacewidget.h @@ -0,0 +1,172 @@ +/* GTlab - Gas Turbine laboratory + * Source File: gtpy_replacewidget.h + * copyright 2009-2019 by DLR + * + * Created on: 20.10.2023 + * Author: Marvin Noethen (AT-TW) + * Tel.: +49 2203 601 2692 + */ + +#ifndef GTPYREPLACEWIDGET_H +#define GTPYREPLACEWIDGET_H + +#include + +class GtpyLineEdit; +class QPushButton; + +/** + * @brief The GtpyReplaceWidget class + */ +class GtpyReplaceWidget : public QWidget +{ + Q_OBJECT + +public: + /** + * @brief GtSearchWidget + * @param parent + */ + explicit GtpyReplaceWidget(QWidget* parent = nullptr); + + /** + * @brief text + * @return + */ + QString searchText() const; + + /** + * @brief text + * @return + */ + QString replaceText() const; + +public slots: + + /** + * @brief Sets text to the search line edit. + * @param text Text to be set to the search line edit. + */ + void setSearchText(const QString& text); + + /** + * @brief Sets text to the replace line edit. + * @param text Text to be set to the replace line edit.. + */ + void setReplaceText(const QString& text); + + /** + * @brief enableSearch + */ + void enableSearch(); + + /** + * @brief enableReplace + */ + void enableReplace(); + + /** + * @brief disableSearch + */ + void disableSearchAndReplace(); + +protected: + + /** + * @brief eventFilter + * @param obj + * @param event + * @return + */ + bool eventFilter(QObject* obj, QEvent* event) override; + +private: + /// Search line + GtpyLineEdit* m_searchLine; + + /// Replace line + GtpyLineEdit* m_replaceLine; + + /// Search button + QPushButton* m_searchButton; + + /// Replace button + QPushButton* m_replaceButton; + + /// Clear search button + QPushButton* m_clearButton; + + /// Search backward button + QPushButton* m_backwardButton; + + /// Search forward button + QPushButton* m_forwardButton; + + /** + * @brief enableSearchComponentes + */ + void enableSearchComponentes(); + + /** + * @brief enableSearchNavigation + */ + void enableSearchNavigation(); + +private slots: + /** + * @brief onSearchTextChanged + */ + void onSearchTextChanged(); + + /** + * @brief onReplaceClicked + */ + void onReplaceClicked(); +signals: + /** + * @brief searchTextEdited + */ + void searchTextEdited(const QString&); + + /** + * @brief searchTextChanged + */ + void searchTextChanged(const QString&); + + /** + * @brief searchLineReturnPressed + */ + void searchLineReturnPressed(); + + /** + * @brief searchEnabled + */ + void searchEnabled(); + + /** + * @brief replaceEnabled + */ + void replaceEnabled(); + + /** + * @brief replace + */ + void replace(const QString&, const QString&); + + /** + * @brief searchAndReplaceDisabled + */ + void searchAndReplaceDisabled(); + + /** + * @brief backwardButtonClicked + */ + void backwardButtonClicked(); + + /** + * @brief forwardButtonClicked + */ + void forwardButtonClicked(); +}; + +#endif // GTPYREPLACEWIDGET_H diff --git a/src/module/widgets/gtpy_scripteditorwidget.cpp b/src/module/widgets/gtpy_scripteditorwidget.cpp new file mode 100644 index 0000000..95cd676 --- /dev/null +++ b/src/module/widgets/gtpy_scripteditorwidget.cpp @@ -0,0 +1,215 @@ +/* GTlab - Gas Turbine laboratory + * Source File: gtpy_scripteditorwidget.cpp + * copyright 2009-2019 by DLR + * + * Created on: 19.10.2023 + * Author: Marvin Noethen (AT-TW) + * Tel.: +49 2203 601 2692 + */ + +#include +#include +#include +#include + +#include "gt_pyhighlighter.h" + +#include "gtpy_scriptview.h" +#include "gtpy_replacewidget.h" +#include "gtpy_icons_compat.h" + +#include "gtpy_scripteditorwidget.h" + +struct GtpyScriptEditorWidget::Impl +{ + /// Script view + QPointer m_scriptView{nullptr}; + + /// Undo button + QPointer m_undoButton{nullptr}; + + /// Redo button + QPointer m_redoButton{nullptr}; + + /// Replace widget + QPointer m_replaceWidget{nullptr}; +}; + +GtpyScriptEditorWidget::GtpyScriptEditorWidget(int contextId, QWidget* parent) : + QWidget(parent), + m_pimpl{std::make_unique()} +{ + /// main layout + auto* mainLayout = new QVBoxLayout; + mainLayout->setContentsMargins(0, 0, 0, 0); + + /// top layout + auto* topLayout = new QHBoxLayout(); + topLayout->setSpacing(0); + topLayout->setMargin(0); + topLayout->setContentsMargins(0, 0, 0, 0); + + m_pimpl->m_undoButton = new QPushButton; + m_pimpl->m_undoButton->setIcon(GTPY_ICON(undo)); + m_pimpl->m_undoButton->setToolTip(tr("Undo")); + m_pimpl->m_undoButton->setFlat(true); + m_pimpl->m_undoButton->setEnabled(false); + + topLayout->addWidget(m_pimpl->m_undoButton); + + m_pimpl->m_redoButton = new QPushButton; + m_pimpl->m_redoButton->setIcon(GTPY_ICON(redo)); + m_pimpl->m_redoButton->setToolTip(tr("Redo")); + m_pimpl->m_redoButton->setFlat(true); + m_pimpl->m_redoButton->setEnabled(false); + + topLayout->addWidget(m_pimpl->m_redoButton); + + topLayout->addStretch(1); + + m_pimpl->m_replaceWidget = new GtpyReplaceWidget(this); + topLayout->addWidget(m_pimpl->m_replaceWidget); + + /// script editor + m_pimpl->m_scriptView = new GtpyScriptView(contextId); + m_pimpl->m_scriptView->setStyleSheet("QPlainTextEdit { border: 0px; }"); + + QTextOption defaultOps = m_pimpl->m_scriptView->document()->defaultTextOption(); + defaultOps.setFlags(defaultOps.flags() | QTextOption::ShowTabsAndSpaces); + m_pimpl->m_scriptView->document()->setDefaultTextOption(defaultOps); + + auto* highlighter = new GtPyHighlighter(m_pimpl->m_scriptView->document()); + Q_UNUSED(highlighter) + + mainLayout->addLayout(topLayout); + mainLayout->addWidget(m_pimpl->m_scriptView); + + setLayout(mainLayout); + + /// conect editor + connect(m_pimpl->m_scriptView, SIGNAL(redoAvailable(bool)), this, + SLOT(setRedoButtonEnabled(bool))); + connect(m_pimpl->m_scriptView, SIGNAL(undoAvailable(bool)), this, + SLOT(setUndoButtonEnabled(bool))); + + /// connect redo/undo button + connect(m_pimpl->m_redoButton, SIGNAL(clicked(bool)), m_pimpl->m_scriptView, + SLOT(redo())); + connect(m_pimpl->m_undoButton, SIGNAL(clicked(bool)), m_pimpl->m_scriptView, + SLOT(undo())); + + /// connect serach and replace + connect(m_pimpl->m_replaceWidget, SIGNAL(searchTextChanged(QString)), this, + SLOT(onSearchTextChanged(QString))); + connect(m_pimpl->m_replaceWidget, SIGNAL(searchLineReturnPressed()), this, + SLOT(onSearchForward())); + connect(m_pimpl->m_replaceWidget, SIGNAL(backwardButtonClicked()), this, + SLOT(onSearchBackward())); + connect(m_pimpl->m_replaceWidget, SIGNAL(forwardButtonClicked()), this, + SLOT(onSearchForward())); + connect(m_pimpl->m_replaceWidget, SIGNAL(replace(QString, QString)), this, + SLOT(onReplace(QString, QString))); +} + +GtpyScriptEditorWidget::~GtpyScriptEditorWidget() = default; + +void +GtpyScriptEditorWidget::setScript(const QString& script) const +{ + m_pimpl->m_scriptView->setScript(script); +} + +QString +GtpyScriptEditorWidget::script() const +{ + return m_pimpl->m_scriptView->script(); +} + +void +GtpyScriptEditorWidget::keyPressEvent(QKeyEvent* event) +{ + if (event->modifiers() == Qt::ControlModifier) + { + switch (event->key()) + { + case Qt::Key_F: + onFindShortcut(); + break; + case Qt::Key_R: + onReplaceShortcut(); + break; + case Qt::Key_E: + emit evaluationTriggered(); + break; + default: + break; + } + } + + QWidget::keyPressEvent(event); +} + +void +GtpyScriptEditorWidget::setSearchText() const +{ + if (m_pimpl->m_scriptView->hasSelection()) + { + m_pimpl->m_replaceWidget->setSearchText( + m_pimpl->m_scriptView->selectedText()); + } +} + +void +GtpyScriptEditorWidget::setRedoButtonEnabled(bool enable) const +{ + m_pimpl->m_redoButton->setEnabled(enable); +} + +void +GtpyScriptEditorWidget::setUndoButtonEnabled(bool enable) const +{ + m_pimpl->m_undoButton->setEnabled(enable); +} + +void +GtpyScriptEditorWidget::onSearchBackward() const +{ + m_pimpl->m_scriptView->selectNextMatch( + m_pimpl->m_replaceWidget->searchText(), true); +} + +void +GtpyScriptEditorWidget::onSearchForward() const +{ + m_pimpl->m_scriptView->selectNextMatch( + m_pimpl->m_replaceWidget->searchText()); +} + +void +GtpyScriptEditorWidget::onReplace(const QString& find, + const QString& replaceBy) const +{ + m_pimpl->m_scriptView->findAndReplace(find, replaceBy); + m_pimpl->m_scriptView->selectNextMatch( + m_pimpl->m_replaceWidget->searchText()); +} + +void +GtpyScriptEditorWidget::onSearchTextChanged(const QString& text) const +{ + m_pimpl->m_scriptView->setHighlight({text, Qt::CaseSensitive}); +} + +void +GtpyScriptEditorWidget::onFindShortcut() const +{ + setSearchText(); + m_pimpl->m_replaceWidget->enableSearch(); +} + +void +GtpyScriptEditorWidget::onReplaceShortcut() const +{ + setSearchText(); + m_pimpl->m_replaceWidget->enableReplace(); +} diff --git a/src/module/widgets/gtpy_scripteditorwidget.h b/src/module/widgets/gtpy_scripteditorwidget.h new file mode 100644 index 0000000..fc1460e --- /dev/null +++ b/src/module/widgets/gtpy_scripteditorwidget.h @@ -0,0 +1,122 @@ +/* GTlab - Gas Turbine laboratory + * Source File: gtpy_scripteditorwidget.h + * copyright 2009-2019 by DLR + * + * Created on: 19.10.2023 + * Author: Marvin Noethen (AT-TW) + * Tel.: +49 2203 601 2692 + */ + +#ifndef GTPYSCRIPTEDITORWIDGET_H +#define GTPYSCRIPTEDITORWIDGET_H + +#include + +#include + +#include "gt_pythonmodule_exports.h" + +class QPushButton; +class GtpyScriptView; +class GtSearchWidget; +class GtpyReplaceWidget; + +/** + * @brief The GtpyScriptEditorWidget class + */ +class GT_PYTHON_EXPORT GtpyScriptEditorWidget : public QWidget +{ + Q_OBJECT + +public: + /** + * @brief GtpyScriptEditorWidget + * @param contextId Context id + * @param parent Parent widget + */ + explicit GtpyScriptEditorWidget(int contextId, QWidget* parent = nullptr); + + ~GtpyScriptEditorWidget(); + + /** + * @brief Sets the given script to the script view. + * @param script Script + */ + void setScript(const QString& script) const; + + /** + * @brief Returns the script displayed in the script view. + * @return The script from the script view. + */ + QString script() const; + +protected: + /** + * @brief keyPressEvent + * @param event Key press event to handle + */ + void keyPressEvent(QKeyEvent* event) override; + +private: + /// Private implementation + struct Impl; + std::unique_ptr m_pimpl; + + void setSearchText() const; + +private slots: + + /** + * @brief Enables or disables the redo button. + * @param enable + */ + void setRedoButtonEnabled(bool enable) const; + + /** + * @brief Enables or disables the undo button. + * @param enable + */ + void setUndoButtonEnabled(bool enable) const; + + /** + * @brief Instructs the editor to continue the current search backward. + */ + void onSearchBackward() const; + + /** + * @brief Instructs the editor to continue the current search. + */ + void onSearchForward() const; + + /** + * @brief Finds the given string in the text view and replaces it by + * replaceBy. + * @param find Text to find. + * @param replaceBy Text to insert. + */ + void onReplace(const QString& find, const QString& replaceBy) const; + + /** + * @brief Highlights the given text in the text view. + * @param text Text to highlight. + */ + void onSearchTextChanged(const QString& text) const; + + /** + * @brief Enables search widget. + */ + void onFindShortcut() const; + + /** + * @brief Enalbes search and replace widget. + */ + void onReplaceShortcut() const; + +signals: + /** + * @brief evaluationTriggered + */ + void evaluationTriggered(); +}; + +#endif // GTPYSCRIPTEDITORWIDGET_H diff --git a/src/module/widgets/gtpy_scriptview.cpp b/src/module/widgets/gtpy_scriptview.cpp new file mode 100644 index 0000000..5986468 --- /dev/null +++ b/src/module/widgets/gtpy_scriptview.cpp @@ -0,0 +1,808 @@ +/* GTlab - Gas Turbine laboratory + * Source File: gtpy_scriptview.cpp + * copyright 2009-2019 by DLR + * + * Created on: 19.10.2023 + * Author: Marvin Noethen (AT-TW) + * Tel.: +49 2203 601 2692 + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gt_application.h" + +#include "gtpy_completer.h" + +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) +#include "gt_colors.h" +#endif + +#include "gtpy_scriptview.h" + +namespace { + +int +lineFromMessage(const QString& message) +{ + static QRegularExpression re{R"((?<="", line )\d+)"}; + QRegularExpressionMatch match = re.match(message); + + if (!match.hasMatch()) + { + return -1; + } + + return match.captured().toInt() - 1; +} + +bool +iterateSelectedLines(QTextCursor& c, std::function callback) +{ + int lineCount = c.selectedText().count(QChar::ParagraphSeparator); + + c.beginEditBlock(); + + c.setPosition(c.selectionStart()); + + /// iterate over the selected lines + for (int i = 0; i <= lineCount; ++i) + { + c.movePosition(QTextCursor::StartOfLine); + + callback(c); + + if(!c.movePosition(QTextCursor::Down)) + { + break; + } + } + + c.endEditBlock(); + + return true; +} + +} + +GtpyScriptView::GtpyScriptView(int contextId, QWidget* parent) : + GtCodeEditor(parent), + m_cpl{nullptr}, + m_contextId{contextId}, + m_indentSize{4}, + m_replaceTabBySpaces{true} +{ + QFont sysFont; +#ifdef Q_OS_LINUX + sysFont.setFamily("Monospace"); +#elif defined(Q_OS_MAC) + sysFont.setFamily("Menlo"); +#else + sysFont.setFamily("Consolas"); +#endif + setFont(sysFont); + + m_cpl = new GtpyCompleter(m_contextId, this); + + setMouseTracking(true); + setAcceptDrops(false); + setIndentSize(m_indentSize); + + QPalette p = palette(); + const QColor cHighlight = p.color(QPalette::Active, QPalette::Highlight); + const QColor cHighlightText = p.color(QPalette::Active, + QPalette::HighlightedText); + + p.setColor(QPalette::Inactive, QPalette::Highlight, cHighlight); + p.setColor(QPalette::Inactive, QPalette::HighlightedText, cHighlightText); + setPalette(p); + + /// current line highlighting +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) + auto lineColor = gt::gui::color::code_editor::highlightLine(); + if (gtApp->inDarkMode()) + lineColor.setAlpha(100); + m_lineHighlight.format.setBackground(lineColor); +#else + m_lineHighlight.format.setBackground(QColor{Qt::yellow}.lighter(160)); +#endif + m_lineHighlight.format.setProperty(QTextFormat::FullWidthSelection, true); + + /// error line highlighting + m_errorHighlight.format.setBackground(QColor{Qt::red}.lighter(160)); + m_errorHighlight.format.setProperty(QTextFormat::FullWidthSelection, true); + + connect(GtpyContextManager::instance(), SIGNAL(errorMessage(QString, int)), + this, SLOT(appendErrorMessage(QString, int))); + connect(m_cpl, SIGNAL(activated(QModelIndex)), this, + SLOT(insertCompletion())); + + disconnect(this, SIGNAL(cursorPositionChanged()), this, + SLOT(highlightCurrentLine())); + connect(this, SIGNAL(cursorPositionChanged()), this, + SLOT(lineHighlighting())); + + connect(this, SIGNAL(textChanged()), this, SLOT(onTextChanged())); +} + +bool +GtpyScriptView::event(QEvent* event) +{ + if (event->type() == QEvent::ToolTip) + { + if (!m_errorHighlight.cursor.isNull()) + { + QHelpEvent* helpEvent = static_cast(event); + + if (cursorForPosition(helpEvent->pos()).block().position() == + m_errorHighlight.cursor.block().position()) + { + QToolTip::setFont(QFontDatabase::systemFont( + QFontDatabase::FixedFont)); + QToolTip::showText(helpEvent->globalPos(), + m_errorMessage.trimmed()); + } + } + } + + return QPlainTextEdit::event(event); +} + +void +GtpyScriptView::wheelEvent(QWheelEvent* event) +{ + if (event->modifiers() == Qt::ControlModifier && !isReadOnly()) + { + if (event->angleDelta().y() > 0) + { + zoomIn(2); + } + else + { + zoomOut(2); + } + + setTabStopDistance(m_indentSize * + QFontMetrics{font()}.horizontalAdvance(' ')); + return; + } + + GtCodeEditor::wheelEvent(event); +} + +QString +GtpyScriptView::script() +{ + return toPlainText(); +} + +void +GtpyScriptView::setScript(const QString& script) +{ + setPlainText(script); +} + +bool +GtpyScriptView::findAndReplace(const QString& find, const QString& replaceBy, + Qt::CaseSensitivity cs) +{ + if (find.isEmpty()) + { + return false; + } + else if (find == replaceBy) + { + return true; + } + + QTextDocument::FindFlags flags = (cs == Qt::CaseSensitive) ? + QTextDocument::FindCaseSensitively : QTextDocument::FindFlags(); + + /// Move the start position to make sure that the cursor is not already in + /// the middle of a valid find. + int startPos = textCursor().position() - find.size(); + + QRegularExpression expr{find}; + + /// Find and replace the next match from the cursor position. + if (startPos > 0) + { + if (!findAndReplace(expr, replaceBy, startPos, flags).isNull()) + { + return true; + } + } + + /// Find and replace the next match from the beginning of the document. + return !findAndReplace(expr, replaceBy, 0, flags).isNull(); +} + +void +GtpyScriptView::findAndReplaceAll(const QString& find, const QString& replaceBy, + Qt::CaseSensitivity cs) +{ + if (find == replaceBy) + { + return; + } + + QTextDocument::FindFlags flags = (cs == Qt::CaseSensitive) ? + QTextDocument::FindCaseSensitively : QTextDocument::FindFlags(); + findAndReplaceAll(QRegularExpression{find}, replaceBy, flags); +} + +void +GtpyScriptView::setIndentSize(int size) +{ + m_indentSize = size; + setTabStopDistance(m_indentSize * QFontMetrics(font()).horizontalAdvance(' ')); +} + +void +GtpyScriptView::replaceTabsBySpaces() +{ + textCursor().beginEditBlock(); + + QTextCursor cursor = document()->find("\t", 0); + + while (!cursor.isNull()) + { + /// Calculate the number of spaces that replace the tab + int tabSize = m_indentSize - + (cursor.positionInBlock() - 1) % m_indentSize; + + cursor.insertText(QString{tabSize, ' '}); + + /// Find next tab + cursor = document()->find("\t", cursor.position()); + } + + textCursor().endEditBlock(); +} + +void +GtpyScriptView::keyPressEvent(QKeyEvent* event) +{ + QToolTip::hideText(); + + if (m_cpl->getPopup()->isVisible()) + { + switch (event->key()) + { + case Qt::Key_Enter: + case Qt::Key_Return: + case Qt::Key_Tab: + insertCompletion(); + return; + + case Qt::Key_Right: + case Qt::Key_Left: + GtCodeEditor::keyPressEvent(event); + handleCompletion(); + return; + + default: + break; + } + } + + if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) + { + switch (event->key()) + { + case Qt::Key_Apostrophe: + commentSelectedLines(textCursor()); + return; + + default: + break; + } + } + else if (event->modifiers() == Qt::ControlModifier) + { + switch (event->key()) + { + case Qt::Key_Space: + if (!isCurrentLineCommentedOut(textCursor())) + { + handleCompletion(); + } + + return; + + default: + break; + } + } + else if (event->modifiers() == Qt::ShiftModifier) + { + switch (event->key()) + { + case Qt::Key_QuoteDbl: + insertFramingCharacters("\""); + return; + + case Qt::Key_Apostrophe: + insertFramingCharacters("\'"); + return; + + /// remove indentation from selected text + case Qt::Key_Backtab: + removeIndent(textCursor()); + return; + + default: + break; + } + } + else + { + switch (event->key()) + { + /// indent new line + case Qt::Key_Return: + GtCodeEditor::keyPressEvent(event); + insertPlainText(currentLineIndent(textCursor())); + return; + + /// indent selected text + case Qt::Key_Tab: + insertIndent(textCursor()); + return; + + default: + break; + } + } + + GtCodeEditor::keyPressEvent(event); + + if (!event->text().isEmpty() && !isCurrentLineCommentedOut(textCursor())) + { + handleCompletion(); + } +} + +void +GtpyScriptView::focusOutEvent(QFocusEvent* event) +{ + m_lineHighlight.cursor = {}; + setExtraSelections(); + + GtCodeEditor::focusOutEvent(event); +} + +void +GtpyScriptView::focusInEvent(QFocusEvent* event) +{ + lineHighlighting(); + + GtCodeEditor::focusInEvent(event); +} + +void +GtpyScriptView::selectNextMatch(const QString& text, bool backward, + Qt::CaseSensitivity cs) +{ + /// translates given options in QTextDocument::FindFlags + QTextDocument::FindFlags flags = backward ? + QTextDocument::FindBackward : QTextDocument::FindFlags(); + flags = (cs == Qt::CaseSensitive) ? + (flags | QTextDocument::FindCaseSensitively) : flags; + + /// find next match + QTextCursor cursor = textCursor(); + QTextCursor nextCursor = findNextCursor(text, cursor, flags); + + if (!nextCursor.isNull()) + { + setTextCursor(nextCursor); + } + else + { + cursor.setPosition(cursor.selectionStart()); + setTextCursor(cursor); + } +} + +void +GtpyScriptView::setHighlight(const Highlight& highlight) +{ + m_highlighted = highlight; + highlightText(m_highlighted); + selectNextMatch(m_highlighted.text, false, m_highlighted.cs); +} + +QString +GtpyScriptView::selectedText() const +{ + return textCursor().selectedText(); +} + +bool +GtpyScriptView::hasSelection() const +{ + return textCursor().hasSelection(); +} + +void +GtpyScriptView::commentSelectedLines(QTextCursor cursor) +{ + cursor.beginEditBlock(); + + int startPos = cursor.selectionStart(); + int endPos = cursor.selectionEnd(); + + cursor.setPosition(startPos); + cursor.movePosition(QTextCursor::StartOfLine); + + bool atStartOfLine = (cursor.position() == startPos); + + cursor.setPosition(endPos, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor); + + QString selectedText = cursor.selection().toPlainText().prepend("\n"); + + if (selectedText.contains("\n#")) + { + endPos -= selectedText.count("\n#"); + startPos = atStartOfLine || !selectedText.startsWith("\n#") ? + startPos : startPos - 1; + selectedText.replace("\n#", "\n"); + } + else + { + endPos += selectedText.count("\n"); + startPos = atStartOfLine ? startPos : startPos + 1; + selectedText.replace("\n", "\n#"); + } + + selectedText.remove(0, 1); + + cursor.insertText(selectedText); + cursor.setPosition(startPos); + cursor.setPosition(endPos, QTextCursor::KeepAnchor); + + setTextCursor(cursor); + + cursor.endEditBlock(); +} + +void GtpyScriptView::handleCompletion() +{ + if (m_cpl != nullptr) + { + QTextCursor cursor = textCursor(); + QRect rect = cursorRect(cursor); + m_cpl->handleTabCompletion(cursor, rect); + } +} + +bool +GtpyScriptView::isCurrentLineCommentedOut(QTextCursor cursor) const +{ + cursor.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor); + return cursor.selectedText().contains("#"); +} + +QString +GtpyScriptView::currentLineIndent(QTextCursor cursor) const +{ + cursor.movePosition(QTextCursor::Up); + cursor.select(QTextCursor::LineUnderCursor); + + /// get leading whitespace characters + static QRegularExpression indentRegExp{R"(^\s+)"}; + QString indent = indentRegExp.match(cursor.selectedText()).captured(); + + /// check if the last character in the current line is a colon + /// (e.g. def func():) + static QRegularExpression colonRegExp{R"(:\s*\Z)"}; + + if (colonRegExp.match(cursor.selectedText()).hasMatch()) + { + indent.append(indentCharacters()); + } + + return indent; +} + +void +GtpyScriptView::setExtraSelections() +{ + QList es{m_lineHighlight, m_errorHighlight}; + es.append(m_searchHighlights); + GtCodeEditor::setExtraSelections(es); +} + +QTextCursor +GtpyScriptView::find(const QString& text, int pos, FindFlags options) const +{ + /// ensure that a match is found even if the cursor is positioned in the + /// middle of a match + pos = (options & QTextDocument::FindBackward) ? + pos : pos - text.length() + 1; + + if (pos < 0) + { + pos = 0; + } + else if (pos >= document()->characterCount()) + { + pos = document()->characterCount() - 1; + } + + return document()->find(text, pos, options); +} + +QTextCursor +GtpyScriptView::findAndReplace(const QRegularExpression& expr, + const QString& replaceBy, int pos, + FindFlags options) +{ + QTextCursor cursor = document()->find(expr, pos, options); + + if (!cursor.isNull()) + { + cursor.insertText(replaceBy); + setTextCursor(cursor); + } + + return cursor; +} + +void +GtpyScriptView::findAndReplaceAll(const QRegularExpression& expr, + const QString& replaceBy, FindFlags options) +{ + textCursor().beginEditBlock(); + + /// Find first match in the script and replace it. + QTextCursor cursor = findAndReplace(expr, replaceBy, 0); + + /// If a match is found and replaced, search for the next match. + while (!cursor.isNull()) + { + cursor = findAndReplace(expr, replaceBy, cursor.position(), options); + } + + textCursor().endEditBlock(); +} + +QTextCursor +GtpyScriptView::findNextCursor(const QString& text, const QTextCursor& cursor, + FindFlags options) const +{ + QString selectedText{cursor.selectedText()}; + bool findBackward = (options & QTextDocument::FindBackward); + + /// determine the correct starting position + int pos = ((selectedText == text && findBackward) || + ((selectedText != text) && selectedText.startsWith(text))) ? + cursor.selectionStart() : cursor.position(); + + QTextCursor match = find(text, pos, options); + + if (match.isNull()) + { + match = findBackward ? + find(text, document()->characterCount(), options): + find(text, 0, options); + } + + return match; +} + +void +GtpyScriptView::highlightText(const Highlight& highlight) +{ +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) + auto color = !gtApp->inDarkMode() ? + QColor{Qt::green}.lighter(160) : + gt::gui::color::code_editor::highlightLine(); +#else + auto color = QColor{Qt::green}.lighter(160); +#endif + + m_searchHighlights.clear(); + + FindFlags flags = (highlight.cs == Qt::CaseSensitive) ? + QTextDocument::FindCaseSensitively : QTextDocument::FindFlags(); + + QTextCursor cursor = find(highlight.text, 0, flags); + + while (!cursor.isNull()) + { + QTextEdit::ExtraSelection selection; + selection.format.setBackground(color); + selection.cursor = cursor; + m_searchHighlights.append(selection); + + cursor = find(highlight.text, cursor.selectionEnd(), flags); + } + + setExtraSelections(); +} + +void +GtpyScriptView::insertFramingCharacters(const QString& character) +{ + QTextCursor cursor = textCursor(); + + if (!cursor.hasSelection()) + { + insertPlainText(character); + cursor.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor); + + if ((cursor.selectedText().count(character) % 2) != 0) + { + insertPlainText(character); + moveCursor(QTextCursor::PreviousCharacter); + } + } + else + { + cursor.insertText(cursor.selectedText() + .prepend(character) + .append(character)); + } +} + +QString +GtpyScriptView::indentCharacters() const +{ + return m_replaceTabBySpaces ? QString{" "}.repeated(m_indentSize) : "\t"; +} + +void +GtpyScriptView::insertIndent(QTextCursor cursor) +{ + QString selectedText{cursor.selectedText()}; + QString indent{indentCharacters()}; + + /// check if cursor has no selection + if (selectedText.isEmpty()) + { + cursor.insertText(indent); + } + /// check if multiple lines are selected + else if (selectedText.count(QChar::ParagraphSeparator) > 0) + { + iterateSelectedLines(cursor, [&indent](QTextCursor& c){ + c.insertText(indent); + }); + } + else + { + QTextCursor cursorCopy{cursor}; + cursorCopy.select(QTextCursor::LineUnderCursor); + + /// check if not the entire text of the line is selected + if (selectedText != cursorCopy.selectedText()) + { + cursor.insertText(indent); + return; + } + + cursorCopy.movePosition(QTextCursor::StartOfLine); + cursorCopy.insertText(indent); + cursorCopy.select(QTextCursor::LineUnderCursor); + setTextCursor(cursorCopy); + } +} + +bool +GtpyScriptView::removeIndent(QTextCursor cursor) +{ + QString selectedText{cursor.selectedText()}; + + /// check if only one line is selected + if (selectedText.count(QChar::ParagraphSeparator) == 0) + { + cursor.select(QTextCursor::LineUnderCursor); + + /// check if the entire text of the line is selected + if (selectedText != cursor.selectedText()) + { + return false; + } + } + + QRegularExpression re{}; + re.setPattern(QString{"^(\\t| {1,%1}\\t| {%2})"} + .arg(QString::number(m_indentSize - 1), + QString::number(m_indentSize))); + + auto removeLineIndet = [&re](QTextCursor& c){ + + c.movePosition(QTextCursor::StartOfLine); + c.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor); + + QRegularExpressionMatch match = re.match(c.selectedText()); + + if (match.hasMatch()) + { + c.movePosition(QTextCursor::StartOfLine); + c.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, + match.capturedLength()); + c.removeSelectedText(); + } + }; + + return iterateSelectedLines(cursor, removeLineIndet); +} + +void +GtpyScriptView::lineHighlighting() +{ + if (!isReadOnly()) + { + m_lineHighlight.cursor = textCursor(); + m_lineHighlight.cursor.clearSelection(); + + resetErrorHighlighting(); + + setExtraSelections(); + } +} + +void +GtpyScriptView::highlightErrorLine(int codeLine) +{ + if (!isReadOnly()) + { + m_errorHighlight.cursor = QTextCursor{ + document()->findBlockByLineNumber(codeLine)}; + m_lineHighlight.cursor = {}; + + setExtraSelections(); + } +} + +void +GtpyScriptView::appendErrorMessage(const QString& message, int contextId) +{ + if (contextId == m_contextId) + { + m_errorMessage += message; + + int line = lineFromMessage(message); + + if (line > -1) + { + highlightErrorLine(line); + } + } +} + +void +GtpyScriptView::resetErrorHighlighting() +{ + m_errorHighlight.cursor = {}; + m_errorMessage = ""; + setExtraSelections(); +} + +void +GtpyScriptView::insertCompletion() +{ + if (m_cpl != nullptr) + { + QTextCursor cursor = textCursor(); + m_cpl->insertCompletion(cursor); + setTextCursor(cursor); + m_cpl->getPopup()->hide(); + } +} + +void +GtpyScriptView::onTextChanged() +{ + highlightText(m_highlighted); +} diff --git a/src/module/widgets/gtpy_scriptview.h b/src/module/widgets/gtpy_scriptview.h new file mode 100644 index 0000000..8ba56ba --- /dev/null +++ b/src/module/widgets/gtpy_scriptview.h @@ -0,0 +1,331 @@ +/* GTlab - Gas Turbine laboratory + * Source File: gtpy_scriptview.h + * copyright 2009-2019 by DLR + * + * Created on: 19.10.2023 + * Author: Marvin Noethen (AT-TW) + * Tel.: +49 2203 601 2692 + */ + +#ifndef GTPYSCRIPTVIEW_H +#define GTPYSCRIPTVIEW_H + +#include "gt_codeeditor.h" + +class GtpyCompleter; + +/** + * @brief The GtpyScriptView class + */ +class GtpyScriptView : public GtCodeEditor +{ + Q_OBJECT + +public: + struct Highlight { + QString text; + Qt::CaseSensitivity cs{Qt::CaseSensitive}; + }; + + /** + * @brief GtpyScriptView + * @param contextId Id of the context in which the scripts written in the + * editor are evaluated. + * @param parent Parent of the editor. + */ + explicit GtpyScriptView(int contextId, QWidget* parent = nullptr); + + /** + * @brief Handles the tooltips after error messages. + * @param event received event + * @return true if the event was recognized and processed + */ + virtual bool event(QEvent* event) override; + + /** + * @brief Handles the wheel events. + * @param event Wheel event + */ + virtual void wheelEvent(QWheelEvent* event) override; + + /** + * @brief Returns the script that is shown in the view. + * @return The script that is shown in the view. + */ + QString script(); + + /** + * @brief Sets the given script so that it is shown in the view. + * @param script The script to be set. + */ + void setScript(const QString& script); + + /** + * @brief Searches for the given string and replaces it by replaceBy. + * @param find Text to search for. + * @param replaceBy Text that replaces the match. + * @param cs Specifies whether the search should be CaseSensitive or + * CaseInsensitive. + */ + bool findAndReplace(const QString& find, const QString& replaceBy, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + + /** + * @brief Searches for all occurrences of the given string find and + * replaces them with replaceBy. + * @param find Text to search for. + * @param replaceBy Text that replaces the matches. + * @param cs Specifies whether the search should be CaseSensitive or + * CaseInsensitive. + */ + void findAndReplaceAll(const QString& find, const QString& replaceBy, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + + /** + * @brief Sets the indent size to the given size. + * @param size Indent size. + */ + void setIndentSize(int size); + + /** + * @brief Repalces all tab characters by spaces. + */ + void replaceTabsBySpaces(); + + /** + * @brief Selects the next string in the script view that matches the + * given text. + * @param text Text to find. + * @param backward If True, the search is carried out backwards. + * @param cs Specifies whether the search should be CaseSensitive or + * CaseInsensitive. + */ + void selectNextMatch(const QString& text, bool backward = false, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + + /** + * @brief Set text to highlight. + * @param highlight Text to highlight. + */ + void setHighlight(const Highlight& highlight); + + /** + * @brief Returns the currently selected text. + * @return The currently selected text. + */ + QString selectedText() const; + + /** + * @brief Returns ture if text is selected. + * @return Ture if text is selected. + */ + bool hasSelection() const; + +protected: + /** + * @brief Called when user presses a key. + * @param e Event which was send by pressing a key. + */ + void keyPressEvent(QKeyEvent* event) override; + + /** + * @brief Called when the editor loses the focus. Deletes the highlighting + * of the current line. + * @param event Event sent by losing the focus. + */ + void focusOutEvent(QFocusEvent* event) override; + + /** + * @brief Called when the editor gets the focused. Highlights the current + * line. + * @param event Event sent by getting the focus. + */ + void focusInEvent(QFocusEvent* event) override; + +private: + /// Line highlight + QTextEdit::ExtraSelection m_lineHighlight; + + /// Error highlight + QTextEdit::ExtraSelection m_errorHighlight; + + /// Search highlights + QList m_searchHighlights; + + /// Currently highlighted text + Highlight m_highlighted; + + /// Error message + QString m_errorMessage; + + /// Pointer to cmpleter + GtpyCompleter* m_cpl; + + /// Python Context id + int m_contextId; + + /// Tab size + int m_indentSize; + + /// Whether tabs are replaced by spaces + bool m_replaceTabBySpaces; + + /** + * @brief Comments out the lines the cursor seletes. + * @param cursor + */ + void commentSelectedLines(QTextCursor cursor); + + /** + * @brief Calls completer to handle completion. + */ + void handleCompletion(); + + /** + * @brief Checks whether the line in which the cursor is currently located + * is commented out. + * @return True if current line is commented out. + */ + bool isCurrentLineCommentedOut(QTextCursor cursor) const; + + /** + * @brief Returns the indent characters for the line in which the cursor + * is located. + * @param cursor Text cursor. + * @return The indent characters for the line in which the cursor + * is located. + */ + QString currentLineIndent(QTextCursor cursor) const; + + /** + * @brief Sets the extra selections consisting of line highlighting, + * error highlighting and search highlighting. + */ + void setExtraSelections(); + + using FindFlags = QTextDocument::FindFlags; + + /** + * @brief Finds the next cursor from the given position that matches the + * given text and returns it. + * @param text Text to search for. + * @param pos Position from which the search is started. + * @param options Find flags. + * @return The next cursor that matches the given text. + */ + QTextCursor find(const QString& text, int pos, + FindFlags options = FindFlags()) const; + + /** + * @brief Searches for the next string that matches the regular expression + * and replaces it by replaceBy. + * @param expr Regular expression for the search. + * @param replaceBy Text that replaces the match. + * @param pos Position from which the search is started. + * @param options Find flags. + * @return The cursor after replacing the string. It is null if no match + * was found. + */ + QTextCursor findAndReplace(const QRegularExpression& expr, + const QString& replaceBy, int pos, + FindFlags options = FindFlags()); + + /** + * @brief Searches for all strings that match the regular expression and + * replaces them with replaceBy. + * @param expr Regular expression for the search. + * @param replaceBy Text that replaces the match. + * @param options Find flags. + */ + void findAndReplaceAll(const QRegularExpression& expr, + const QString& replaceBy, + FindFlags options = FindFlags()); + + /** + * @brief Searches for the next occurrences of the given text, starting + * from the position of the specified cursor. It returns the cursor that + * selects the text that was searched for. + * @param text Text to search for. + * @param cursor Cursor to start searching from. + * @param options Find flags. + * @return The next cursor that selects the text that was searched for. + */ + QTextCursor findNextCursor(const QString& text, const QTextCursor& cursor, + FindFlags options = FindFlags()) const; + + /** + * @brief Highlights the specified text. + * @param highlight Text to be highlighted + */ + void highlightText(const Highlight& highlight); + + /** + * @brief Inserts the given character twice and places the cursor in the + * middle of the characters (e.g. for inserting quotation marks). + * @param character Character to insert. + */ + void insertFramingCharacters(const QString& character); + + /** + * @brief Returns the indentation characters that correspond to the + * current settings. It is a user-defined number of spaces or a + * tab character. + * @return The indentation characters. + */ + QString indentCharacters() const; + + /** + * @brief Inserts an indent in the line where the cursor is located and in + * all lines that the cursor selects. It returns true if the indent + * was successful. + * @param cursor The text cursor that selects the lines to be indented. + */ + void insertIndent(QTextCursor cursor); + + /** + * @brief Removes an indent from the line in which the cursor is located + * and from all lines that the cursor selects. It returns true if the + * removal of the indent was successful. + * @param cursor The text cursor that selects the lines the indent should + * be removed from. + * @return True if the removal of the indent was successful. + */ + bool removeIndent(QTextCursor cursor); + +private slots: + /** + * @brief Highlights the current line. + */ + void lineHighlighting(); + + /** + * @brief Highlights the given line as error line (red). + * @param codeLine the line number to be highlighted + */ + void highlightErrorLine(int codeLine); + + /** + * @brief Receives the error messages. + * @param message that has been send + * @param contextId Id of the context in which the error has been triggered. + */ + void appendErrorMessage(const QString& message, int contextId); + + /** + * @brief Resets the error message and the error highlighting. + */ + void resetErrorHighlighting(); + + /** + * @brief Inserts the selected completion into the text editor. + * @param index of completion + */ + void insertCompletion(); + + /** + * @brief onTextChanged + */ + void onTextChanged(); +}; + +#endif // GTPYSCRIPTVIEW_H From 65ef9fcc6398155383f0fc45979b7c20e62c6a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=B6then=2C=20Marvin?= Date: Wed, 20 Dec 2023 11:53:15 +0000 Subject: [PATCH 011/130] Resolve "Prepare release 1.5.0" --- CHANGELOG.md | 12 ++++++++++++ CMakeLists.txt | 2 +- src/module/gt_python.cpp | 2 +- src/setup_module/gt_python_setup.cpp | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71e8721..113256d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.5.0] - 2023-12-20 +### Fixed + - Deadlock when calling Python Calculator via Python Console - #251 + +### Changed + - Builds against PythonQt 3.4.2 - #246 + - Changed build system to cmake + +### Added + - New script editor widget that provides redo/undo buttons and find and replace functionality. - #240 + - Input and output arguments of any Python task or calculator are accessible from Python scripts. - #249 + ## [1.4.2] - 2023-09-18 ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f24eca..cce00d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.15) -project(GTlab-Python VERSION 1.4.2) +project(GTlab-Python VERSION 1.5.0) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) diff --git a/src/module/gt_python.cpp b/src/module/gt_python.cpp index bef1165..95aeaf4 100644 --- a/src/module/gt_python.cpp +++ b/src/module/gt_python.cpp @@ -60,7 +60,7 @@ GtVersionNumber GtPythonModule::version() { - return GtVersionNumber(1, 4, 2); + return GtVersionNumber(1, 5, 0); } #else int diff --git a/src/setup_module/gt_python_setup.cpp b/src/setup_module/gt_python_setup.cpp index c83e48d..1f8a8f9 100644 --- a/src/setup_module/gt_python_setup.cpp +++ b/src/setup_module/gt_python_setup.cpp @@ -43,7 +43,7 @@ getSetting(const QString& settingId) GtVersionNumber GtPythonSetupModule::version() { - return GtVersionNumber(1, 4, 2); + return GtVersionNumber(1, 5, 0); } QString From a301ece5dfeadaeee229fba9219fc9bf01ba3b83 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Tue, 12 Dec 2023 13:16:57 +0100 Subject: [PATCH 012/130] Fixed deadlock, when calling python calculators via the python console The implementation releases the GIL for the process executor. We can assume, that no python code is executed in this block. If so, it needs to lock the GIL, which is done anyhow. Closes #251 --- src/module/CMakeLists.txt | 1 + src/module/utilities/gtpy_decorator.cpp | 12 +++++++--- src/module/utilities/gtpy_threadscope.h | 29 +++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 src/module/utilities/gtpy_threadscope.h diff --git a/src/module/CMakeLists.txt b/src/module/CMakeLists.txt index e6ad62f..fab3806 100644 --- a/src/module/CMakeLists.txt +++ b/src/module/CMakeLists.txt @@ -49,6 +49,7 @@ set(HEADERS utilities/gtpy_convert.h utilities/gtpy_decorator.h utilities/gtpy_gilscope.h + utilities/gtpy_threadscope.h utilities/gtpy_globals.h utilities/gtpy_interruptrunnable.h utilities/gtpy_matplotlib.h diff --git a/src/module/utilities/gtpy_decorator.cpp b/src/module/utilities/gtpy_decorator.cpp index 599791a..24c0fc4 100644 --- a/src/module/utilities/gtpy_decorator.cpp +++ b/src/module/utilities/gtpy_decorator.cpp @@ -30,6 +30,7 @@ #include "gtpy_task.h" #include "gtpy_scriptcalculator.h" #include "gtpy_convert.h" +#include "gtpy_threadscope.h" #include "gtpy_decorator.h" @@ -433,9 +434,14 @@ GtpyDecorator::runProcess(GtProject* pro, const QString& processId, return false; } - // execute process - GtCoreProcessExecutor executor; - executor.runTask(process); + { + // The executor runs python tasks in a different thread, so we need to call this first + auto _ = GtpyThreadScope(); + + // execute process + GtCoreProcessExecutor executor; + executor.runTask(process); + } if (process->currentState() != GtProcessComponent::FINISHED) { diff --git a/src/module/utilities/gtpy_threadscope.h b/src/module/utilities/gtpy_threadscope.h new file mode 100644 index 0000000..50accfe --- /dev/null +++ b/src/module/utilities/gtpy_threadscope.h @@ -0,0 +1,29 @@ +/* GTlab - Gas Turbine laboratory + * + * SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR) + * + * Author: Martin Siggelr (AT-TWK) + */ + +#ifndef GTPYTHREADSCOPE_H +#define GTPYTHREADSCOPE_H + +#include "PythonQtPythonInclude.h" + +class GtpyThreadScope +{ +public: + GtpyThreadScope() + : state(PyEval_SaveThread()) + {} + + ~GtpyThreadScope() + { + PyEval_RestoreThread(state); + } + +private: + PyThreadState* state; +}; + +#endif // GTPYTHREADSCOPE_H From 795520f873b8a8e4bb997de201ce316cc24314cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=B6then=2C=20Marvin?= Date: Tue, 30 Jan 2024 12:16:15 +0000 Subject: [PATCH 013/130] Resolve "Auto completion does not generate a valid command for objects that start with a number" --- src/module/utilities/gtpy_contextmanager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/module/utilities/gtpy_contextmanager.cpp b/src/module/utilities/gtpy_contextmanager.cpp index d2f3838..1099f32 100644 --- a/src/module/utilities/gtpy_contextmanager.cpp +++ b/src/module/utilities/gtpy_contextmanager.cpp @@ -1824,8 +1824,10 @@ GtpyContextManager::introspectObject(PyObject* object) const } else { - if (!objName.contains( - QRegExp(QStringLiteral("^[a-zA-Z0-9_]*$")))) + static QRegularExpression regexp{ + "^[a-zA-Z_][a-zA-Z0-9_]*$"}; + + if (!objName.contains(regexp)) { QString funcName = m_decorator->getFunctionName( FIND_GT_CHILD_TAG); From c6e6bb667b34aa27b85bb21d37e70ba53200cce3 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 28 Feb 2024 15:21:03 +0100 Subject: [PATCH 014/130] Implemented the GTObject::clone function Note. I added also another wrapGtObject method, using a unique_ptr as an argument, denoting that the ownership needs to be transferred to python, i.e. C++ is not the owner anymore. --- src/module/utilities/gtpy_decorator.cpp | 35 +++++++++++++++++++++++++ src/module/utilities/gtpy_decorator.h | 21 +++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/src/module/utilities/gtpy_decorator.cpp b/src/module/utilities/gtpy_decorator.cpp index 24c0fc4..07c6fa9 100644 --- a/src/module/utilities/gtpy_decorator.cpp +++ b/src/module/utilities/gtpy_decorator.cpp @@ -114,6 +114,31 @@ GtpyDecorator::wrapGtObject(GtObject* obj) return wrapped; } +PyObject* +GtpyDecorator::wrapGtObject(std::unique_ptr&& obj) +{ + if (!obj) + { + return nullptr; + } + + auto pyObj = wrapGtObject(obj.get()); + + // C++ is still owner of pyObj. Now make Python the owner + // wrapGtObject actually returns a GtpyExtendedWrapper + GtpyExtendedWrapper* self = (GtpyExtendedWrapper*)(pyObj); + + // transfer ownership to python, since nothing own + // this clone anymore + if (self->_obj) + { + self->_obj->passOwnershipToPython(); + obj.release(); + } + + return pyObj; +} + void GtpyDecorator::init(GtCoreApplication* app, const QString& id) { @@ -1057,6 +1082,16 @@ GtpyDecorator::objectByUUID(GtObject* obj, const QString& uuid) return wrapGtObject(obj->getObjectByUuid(uuid)); } +PyObject* +GtpyDecorator::clone(GtObject *obj) +{ + if (!obj) return nullptr; + + // the clone is a new object, we transfer ownership to python + std::unique_ptr cloned_obj(obj->clone()); + return wrapGtObject(std::move(cloned_obj)); +} + QString GtpyDecorator::calcHash(GtObject* obj) { diff --git a/src/module/utilities/gtpy_decorator.h b/src/module/utilities/gtpy_decorator.h index e58dbe0..7bbe1ed 100644 --- a/src/module/utilities/gtpy_decorator.h +++ b/src/module/utilities/gtpy_decorator.h @@ -15,6 +15,8 @@ #include #include +#include + #include "gt_globals.h" class GtCoreApplication; @@ -85,6 +87,15 @@ class GtpyDecorator: public QObject static PyObject* wrapGtObject(GtObject* obj); + /** + * @brief Creates a Python object from obj and transfers ownership to + * Python. + * + * @param obj Object to be returned to python + * @return + */ + static PyObject* wrapGtObject(std::unique_ptr&& obj); + public slots: ///-------> functions of GtCoreApplication <-------\\\ @@ -410,6 +421,16 @@ public slots: */ PyObject* objectByUUID(GtObject* obj, const QString& uuid); + /** + * @brief Clones the given object + * + * A new object is returned, the ownership is transferred to python. + * + * @param obj The object to be cloned + * @return A new object + */ + PyObject* clone(GtObject* obj); + /** * @brief Decorator function to calcHash function of GtObject. * @param obj Pointer to GtObject. From 9bcc2826ed95f764963342db128a3855b0bf40f4 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Mon, 4 Mar 2024 12:14:08 +0100 Subject: [PATCH 015/130] Added tp_traverse and tp_clear for PropertySetterType Without these functions, python raised an error when setting properties via setMyProp(value). With python 3.12, this type could not even be created anymore. Fixes #259 --- .../pythonextensions/gtpy_propertysetter.cpp | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp b/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp index 92c93be..709a652 100644 --- a/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp +++ b/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp @@ -223,6 +223,25 @@ GtpyPropertySetter_New(QString const& propId, PyObject* self, PyObject* module) return (PyObject*)op; } +static int +GtpyPropertySetter_traverse(GtpyPropertySetterObject *self, visitproc visit, void *arg) +{ + Py_VISIT(self->m_propId); + Py_VISIT(self->m_self); + Py_VISIT(self->m_module); + + return 0; +} + +static int +GtpyPropertySetter_clear(GtpyPropertySetterObject *self) +{ + Py_CLEAR(self->m_propId); + Py_CLEAR(self->m_self); + Py_CLEAR(self->m_module); + return 0; +} + PyTypeObject GtpyPropertySetter_Type = { @@ -251,8 +270,8 @@ GtpyPropertySetter_Type = 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ 0, /* tp_doc */ - 0,//(traverseproc)meth_traverse, /* tp_traverse */ - 0, /* tp_clear */ + (traverseproc) GtpyPropertySetter_traverse, /* tp_traverse */ + (inquiry)GtpyPropertySetter_clear, /* tp_clear */ (richcmpfunc)meth_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ From 16a464f6ffb71ea2f7a76bbe214d30c2cb60f8a6 Mon Sep 17 00:00:00 2001 From: "Schmeink, Jens" Date: Wed, 6 Mar 2024 13:32:56 +0000 Subject: [PATCH 016/130] Resolve "Add decorator functions to access structproperties in a nice way" --- src/module/utilities/gtpy_decorator.cpp | 58 +++++++++++++++++++++++-- src/module/utilities/gtpy_decorator.h | 30 +++++++++++++ 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/src/module/utilities/gtpy_decorator.cpp b/src/module/utilities/gtpy_decorator.cpp index 07c6fa9..be146a0 100644 --- a/src/module/utilities/gtpy_decorator.cpp +++ b/src/module/utilities/gtpy_decorator.cpp @@ -21,6 +21,10 @@ #include "gt_calculator.h" #include "gt_objectlinkproperty.h" #include "gt_abstractrunnable.h" +#if GT_VERSION >= 0x020000 +#include "gt_structproperty.h" +#include "gt_propertystructcontainer.h" +#endif #if GT_VERSION < GT_VERSION_CHECK(2, 0, 0) #include "gt_datazone0d.h" #endif @@ -922,15 +926,61 @@ GtpyDecorator::findGtParent(GtObject* obj) return wrapGtObject(obj->findParent()); } +#if GT_VERSION >= 0x020000 +QVariant +GtpyDecorator::getPropertyContainerVal(GtObject* obj, QString const& id, + int index, QString const& memberId) +{ + if (!obj) + { + gtError() << __func__ << " -> Invalid object given!"; + return {}; + } -QList -GtpyDecorator::findGtProperties(GtObject* obj) + GtPropertyStructContainer* s = obj->findPropertyContainer(id); + + if (!s) + { + gtError() << __func__ << " -> PropertyStruct container of " + "object not fund!"; + return {}; + } + + GtPropertyStructInstance& structCon = s->at(index); + + return structCon.getMemberValToVariant(memberId); +} + +bool +GtpyDecorator::setPropertyContainerVal(GtObject* obj, const QString& id, + int index, const QString& memberId, + const QVariant& val) { - if (obj == Q_NULLPTR) + if (!obj) { - return QList(); + gtError() << __func__ << " -> Invalid object given!"; + return false; } + GtPropertyStructContainer* s = obj->findPropertyContainer(id); + + if (!s) + { + gtError() << __func__ << " -> PropertyStruct container of " + "object not fund!"; + return false; + } + + GtPropertyStructInstance& structCon = s->at(index); + + return structCon.setMemberVal(memberId, val); +} +#endif +QList +GtpyDecorator::findGtProperties(GtObject* obj) +{ + if (!obj) return {}; + return obj->fullPropertyList(); } diff --git a/src/module/utilities/gtpy_decorator.h b/src/module/utilities/gtpy_decorator.h index 7bbe1ed..0929601 100644 --- a/src/module/utilities/gtpy_decorator.h +++ b/src/module/utilities/gtpy_decorator.h @@ -370,7 +370,37 @@ public slots: * @return parent object (GtObject) */ PyObject* findGtParent(GtObject* obj); +#if GT_VERSION >= 0x020000 + /** + * @brief getPropertyContainerVal + * Find a struct container property and return a value of + * a defined propety + * @param obj - parent object of the struct propety + * @param id of the property struct container + * @param index of the element of the items of the container + * @param memberId of the property to call + * @return the value as a variant + * + * Example call in python: + * task.getPropertyContainerVal("args_input", 0, "name") + */ + QVariant getPropertyContainerVal (GtObject* obj, const QString& id, + int index, const QString& memberId); + /** + * @brief setPropertyContainerVal + * Find a struct container property and sets a value of + * a defined propety + * @param obj - parent object of the struct propety + * @param id of the property struct container + * @param index of the element of the items of the container + * @param memberId of the property to call + * @param val - value to set + * @return true in case of success, else false + */ + bool setPropertyContainerVal(GtObject* obj, QString const& id, int index, + QString const& memberId, const QVariant& val); +#endif /** * @brief findGtProperties returns all properties of a GtObject * @param obj pointer to GtObject From b8c44a089eaf5459428f041575af53b6c67ffc64 Mon Sep 17 00:00:00 2001 From: "Schmeink, Jens" Date: Thu, 7 Mar 2024 14:40:36 +0000 Subject: [PATCH 017/130] Add python function findGtChildrenByClass --- src/module/utilities/gtpy_decorator.cpp | 7 +++++++ src/module/utilities/gtpy_decorator.h | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/module/utilities/gtpy_decorator.cpp b/src/module/utilities/gtpy_decorator.cpp index be146a0..66d5992 100644 --- a/src/module/utilities/gtpy_decorator.cpp +++ b/src/module/utilities/gtpy_decorator.cpp @@ -914,6 +914,13 @@ GtpyDecorator::findGtChildren(GtObject* obj, const QString& childrenName, return retval; } +QList +GtpyDecorator::findGtChildrenByClass(GtObject* obj, + const QString& objectClassName) +{ + return findGtChildren(obj, QString(), objectClassName); +} + PyObject* GtpyDecorator::findGtParent(GtObject* obj) { diff --git a/src/module/utilities/gtpy_decorator.h b/src/module/utilities/gtpy_decorator.h index 0929601..b67f95e 100644 --- a/src/module/utilities/gtpy_decorator.h +++ b/src/module/utilities/gtpy_decorator.h @@ -364,6 +364,16 @@ public slots: const QString& childrenName = QString(), const QString& objectClassName = QString()); + /** + * @brief findGtChildrenByClass returns the children of type GtObject + * of the given class name + * @param obj pointer to GtObject + * @param objectClassName : class name filter + * @return See GtObject class documentation. + */ + QList findGtChildrenByClass(GtObject* obj, + const QString& objectClassName); + /** * @brief find parent object (GtObject) * @param obj : child object From dcb95e9f92c5ce73496210f1703b0a14d9024694 Mon Sep 17 00:00:00 2001 From: "Siggel, Martin" Date: Fri, 8 Mar 2024 10:26:54 +0000 Subject: [PATCH 018/130] Resolve ""GTlabConsole python" does not print python error" --- src/batch/batch-script.cpp | 30 +++--------------------------- src/module/gt_python.cpp | 38 +++++++++++++++++++------------------- src/module/gt_python.h | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 46 deletions(-) diff --git a/src/batch/batch-script.cpp b/src/batch/batch-script.cpp index 5216ab7..db9dd92 100644 --- a/src/batch/batch-script.cpp +++ b/src/batch/batch-script.cpp @@ -19,6 +19,7 @@ #include "gtpy_contextmanager.h" #include "gt_globals.h" #include "gt_versionnumber.h" +#include "gt_python.h" using namespace std; @@ -92,34 +93,9 @@ int main(int argc, char* argv[]) // save to system environment (temporary) app.saveSystemEnvironment(); - GtpyContextManager* python = GtpyContextManager::instance(); - - if (python) - { - python->initContexts(); - } - QStringList args = qApp->arguments(); + args.removeAt(0); - if (args.size() < 2) - { - cout << "ERROR: invalid arguments!" << endl; - return -1; - } - - QString scriptContent = parseScriptFile(args[1]); - - if (scriptContent.isEmpty()) - { - cout << "ERROR: empty script file!" << endl; - return -1; - } - - if (python) - { - python->evalScript(GtpyContextManager::BatchContext, scriptContent, - true); - } + return PythonExecution::runPythonInterpreter(args); - return 0; } diff --git a/src/module/gt_python.cpp b/src/module/gt_python.cpp index 95aeaf4..f511b05 100644 --- a/src/module/gt_python.cpp +++ b/src/module/gt_python.cpp @@ -321,7 +321,7 @@ parseScriptFile(QFile& file) } int -execPython(const QStringList& args) +runPythonInterpreter(const QStringList& args) { if (args.isEmpty()) { @@ -329,12 +329,6 @@ execPython(const QStringList& args) } QFile f(args.first()); - - gtInfo() << "Start Python Script Execution for file" << args.first(); - GtpyContextManager* python = GtpyContextManager::instance(); - - python->initContexts(); - QString scriptContent = parseScriptFile(f); if (scriptContent.isEmpty()) @@ -343,21 +337,27 @@ execPython(const QStringList& args) return -1; } - if (python) - { - bool success = python->evalScript(GtpyContextManager::BatchContext, - scriptContent, true); + gtInfo() << "Start Python Script Execution for file" << args.first(); + GtpyContextManager* python = GtpyContextManager::instance(); + assert(python); - if (success) - { - return 0; - } - } + python->initContexts(); - return -1; -} + // print errors to console + QObject::connect(python, + &GtpyContextManager::errorMessage, + GtpyContextManager::instance(), + [](const QString& message, int contextId){ + std::cerr << message.toStdString(); + }); + + bool success = python->evalScript(GtpyContextManager::BatchContext, + scriptContent, true); + return success ? 0 : -1; } +} // namespace PythonExecution + #if GT_VERSION >= 0x020000 QList GtPythonModule::commandLineFunctions() const @@ -365,7 +365,7 @@ GtPythonModule::commandLineFunctions() const QList args; args.append(GtCommandLineArgument{"", "python file to execute"}); auto fun = gt::makeCommandLineFunction( - "python", PythonExecution::execPython, + "python", PythonExecution::runPythonInterpreter, "Executes python").setArgs(args); return {fun}; diff --git a/src/module/gt_python.h b/src/module/gt_python.h index cc16058..fa4c35c 100644 --- a/src/module/gt_python.h +++ b/src/module/gt_python.h @@ -10,6 +10,8 @@ #ifndef GTPYTHON_H #define GTPYTHON_H +#include "gt_pythonmodule_exports.h" + #include "gt_moduleinterface.h" #include "gt_processinterface.h" #include "gt_mdiinterface.h" @@ -187,4 +189,16 @@ class GtPythonModule: public QObject, public GtModuleInterface, }; +namespace PythonExecution +{ + +/** + * @brief Runs a standalone python interpreter given the file passed in args + * @param args The first parameter is the file to execute + * @return 0 on success, -1 otherwise + */ +GT_PYTHON_EXPORT int runPythonInterpreter(const QStringList& args); + +} + #endif // GTPYTHON_H From b17fadae255891324e631dd2b09658d36d622ec6 Mon Sep 17 00:00:00 2001 From: "Siggel, Martin" Date: Tue, 19 Mar 2024 08:34:36 +0000 Subject: [PATCH 019/130] Implemented C++ RAII wrapper to reduce memleaks Closes #264, #263, and #256 --- .gitlab-ci.yml | 2 +- src/module/CMakeLists.txt | 1 + .../extensions/gtpy_pythonfunctions.cpp | 55 +-- src/module/extensions/gtpy_pythonfunctions.h | 9 +- src/module/gt_python.cpp | 23 + src/module/gt_python.h | 2 + src/module/utilities/gtpy_contextmanager.cpp | 433 ++++++----------- src/module/utilities/gtpy_contextmanager.h | 78 ++-- src/module/utilities/gtpy_convert.cpp | 11 +- src/module/utilities/gtpy_convert.h | 3 +- src/module/utilities/gtpy_decorator.cpp | 87 ++-- src/module/utilities/gtpy_decorator.h | 40 +- src/module/utilities/gtpy_gilscope.h | 3 +- src/module/utilities/gtpy_globals.h | 2 + src/module/utilities/gtpypp.h | 437 ++++++++++++++++++ .../gtpy_calculatorsmodule.cpp | 245 ++++------ .../gtpy_createhelperfunction.cpp | 81 ++-- .../pythonextensions/gtpy_extendedwrapper.cpp | 176 +++---- .../pythonextensions/gtpy_extendedwrapper.h | 8 +- .../pythonextensions/gtpy_importfunction.cpp | 77 +-- .../pythonextensions/gtpy_loggingmodule.cpp | 147 ++---- .../pythonextensions/gtpy_loggingmodule.h | 10 +- .../pythonextensions/gtpy_propertysetter.cpp | 4 +- .../pythonextensions/gtpy_propertysetter.h | 7 + .../pythonextensions/gtpy_stdout.cpp | 57 +-- tests/unittests/CMakeLists.txt | 7 +- tests/unittests/test_helper.h | 41 ++ tests/unittests/test_variantconvert.cpp | 81 ++++ 28 files changed, 1161 insertions(+), 966 deletions(-) create mode 100644 src/module/utilities/gtpypp.h create mode 100644 tests/unittests/test_helper.h create mode 100644 tests/unittests/test_variantconvert.cpp diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 26ec68a..854aba3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -120,7 +120,7 @@ testWin_2.0: before_script: - '& $env:GTLAB_UPDATE_TOOL up --confirm-command; $null' script: - - $env:path = "$env:GTLAB_DEV_TOOLS\binDebug;$env:path" + - $env:path = "$env:PYTHON3_HOME;$env:GTLAB_DEV_TOOLS\binDebug;$env:path" - cd build - .\GTlabPythonUnitTest.exe --gtest_output=xml:unittests.xml artifacts: diff --git a/src/module/CMakeLists.txt b/src/module/CMakeLists.txt index fab3806..ca846e2 100644 --- a/src/module/CMakeLists.txt +++ b/src/module/CMakeLists.txt @@ -65,6 +65,7 @@ set(HEADERS utilities/pythonextensions/gtpy_loggingmodule.h utilities/pythonextensions/gtpy_propertysetter.h utilities/pythonextensions/gtpy_stdout.h + utilities/gtpypp.h widgets/gtpy_completer.h widgets/gtpy_console.h widgets/gtpy_lineedit.h diff --git a/src/module/extensions/gtpy_pythonfunctions.cpp b/src/module/extensions/gtpy_pythonfunctions.cpp index dded259..e26dcde 100644 --- a/src/module/extensions/gtpy_pythonfunctions.cpp +++ b/src/module/extensions/gtpy_pythonfunctions.cpp @@ -19,6 +19,7 @@ #endif #include "gtpy_pythonfunctions.h" +#include "gtpypp.h" PyObject* gtpy::extension::func::projectPath(PyObject* /*self*/) @@ -37,7 +38,7 @@ gtpy::extension::func::projectPath(PyObject* /*self*/) #if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) -PyObject* +PyObjectAPIReturn gtpy::extension::func::sharedFunc(PyObject* /*self*/, PyObject* args, PyObject* keywds) { @@ -78,26 +79,24 @@ gtpy::extension::func::sharedFunc(PyObject* /*self*/, PyObject* args, PyEval_GetGlobals(), nullptr); } -PyObject* +PyObjectAPIReturn gtpy::extension::func::callSharedFunc(PyObject* /*self*/, PyObject* args, PyObject* keywds) { const char* moduleId; const char* functionId; - PyObject* argTuple = nullptr; + PyObject* argTupleIn = nullptr; static const char* kwlist[] = {"module_id", "function_id", "args", nullptr}; if (!PyArg_ParseTupleAndKeywords(args, keywds, "ssO!", const_cast(kwlist), &moduleId, &functionId, - &PyTuple_Type, &argTuple)) + &PyTuple_Type, &argTupleIn)) { return nullptr; } - Py_INCREF(argTuple); - auto func = gt::interface::getSharedFunction(moduleId, functionId); if (func.isNull()) @@ -110,14 +109,24 @@ gtpy::extension::func::callSharedFunc(PyObject* /*self*/, PyObject* args, return nullptr; } - auto argList = PythonQtConv::PyObjToQVariant(argTuple).toList(); - Py_DECREF(argTuple); + const auto argTuple = PyPPObject::Borrow(argTupleIn); + assert(PyPPTuple_Check(argTuple)); - PyObject* res = nullptr; + // Convert args to variants + QVariantList funcArgs; + for (int i = 0; i < PyPPTuple_Size(argTuple); i++) + { + funcArgs.append(PyPPObject_AsQVariant(PyPPTuple_GetItem(argTuple, i))); + } try { - res = PythonQtConv::QVariantListToPyObject(func(argList)); + // call the shared function + return PythonQtConv::QVariantListToPyObject(func(funcArgs)); + } + catch (const std::runtime_error& err) + { + PyErr_SetString(PyExc_TypeError, err.what()); } catch (...) { @@ -128,38 +137,32 @@ gtpy::extension::func::callSharedFunc(PyObject* /*self*/, PyObject* args, PyErr_SetString(PyExc_TypeError, e.toLatin1().constData()); } - return res; + return nullptr; } -PyObject* +PyObjectAPIReturn gtpy::extension::func::sharedFuncIds(PyObject* /*self*/) { auto ids = gt::interface::sharedFunctionIDs(); - auto list = PyList_New(0); + auto list = PyPPList_New(0); using FuncId = gt::interface::SharedFunctionID; for (const FuncId& id : qAsConst(ids)) { /// convert the ids to PyObject pointers - auto modId = PythonQtConv::QStringToPyObject(id.moduleId); - auto funcId = PythonQtConv::QStringToPyObject(id.functionId); + auto modId = PyPPObject::fromQString(id.moduleId); + auto funcId = PyPPObject::fromQString(id.functionId); /// set ids to a new dictionary - auto dict = PyDict_New(); - PyDict_SetItemString(dict, "module_id", modId); - PyDict_SetItemString(dict, "function_id", funcId); + auto dict = PyPPDict_New(); + PyPPDict_SetItem(dict, "module_id", modId); + PyPPDict_SetItem(dict, "function_id", funcId); /// append dict to list - PyList_Append(list, dict); - - /// decrement the object counter, because PyDict_SetItemString and - /// PyList_Append do not steal the value reference - Py_DECREF(modId); - Py_DECREF(funcId); - Py_DECREF(dict); + PyPPList_Append(list, dict); } - return list; + return list.release(); } #endif diff --git a/src/module/extensions/gtpy_pythonfunctions.h b/src/module/extensions/gtpy_pythonfunctions.h index 3f63c49..f7a538a 100644 --- a/src/module/extensions/gtpy_pythonfunctions.h +++ b/src/module/extensions/gtpy_pythonfunctions.h @@ -15,6 +15,7 @@ #include "PythonQtPythonInclude.h" #include "gtpy_constants.h" +#include "gtpy_globals.h" namespace gtpy { @@ -25,7 +26,7 @@ namespace extension namespace func { -PyObject* projectPath(PyObject* self); +PyObjectAPIReturn projectPath(PyObject* self); static PyMethodDef PROJECT_PATH_F_DEF[] = { @@ -40,11 +41,11 @@ static PyMethodDef PROJECT_PATH_F_DEF[] = #if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) -PyObject* sharedFunc(PyObject* self, PyObject* args, PyObject* keywds); +PyObjectAPIReturn sharedFunc(PyObject* self, PyObject* args, PyObject* keywds); -PyObject* callSharedFunc(PyObject* self, PyObject* args, PyObject* keywds); +PyObjectAPIReturn callSharedFunc(PyObject* self, PyObject* args, PyObject* keywds); -PyObject* sharedFuncIds(PyObject* self); +PyObjectAPIReturn sharedFuncIds(PyObject* self); static PyMethodDef SHARED_FUNC_F_DEF[] = { diff --git a/src/module/gt_python.cpp b/src/module/gt_python.cpp index f511b05..d25a96e 100644 --- a/src/module/gt_python.cpp +++ b/src/module/gt_python.cpp @@ -19,6 +19,7 @@ #include "gt_logging.h" #if GT_VERSION >= 0x020000 +#include "gt_functionalinterface.h" #include "gt_commandlinefunction.h" #endif @@ -297,6 +298,28 @@ GtPythonModule::accessConnection() return GT_METADATA(GtAccessDataConnection); } +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) +QList GtPythonModule::sharedFunctions() const +{ + auto result = QList(); + + // add some shared methods for testing + if(gtApp->devMode()) + { + result.append(gt::interface::makeSharedFunction("get_object_name", [](GtObject* o) ->QString { + if (!o) return ""; + return o->objectName(); + })); + + result.append(gt::interface::makeSharedFunction("add", [](double a, double b) { + return a+b; + })); + } + + return result; +} +#endif + namespace PythonExecution { diff --git a/src/module/gt_python.h b/src/module/gt_python.h index fa4c35c..37a5201 100644 --- a/src/module/gt_python.h +++ b/src/module/gt_python.h @@ -174,6 +174,8 @@ class GtPythonModule: public QObject, public GtModuleInterface, * @return baic meta information about the module */ QList commandLineFunctions() const override; + + QList sharedFunctions() const override; #endif private: diff --git a/src/module/utilities/gtpy_contextmanager.cpp b/src/module/utilities/gtpy_contextmanager.cpp index 1099f32..28d684c 100644 --- a/src/module/utilities/gtpy_contextmanager.cpp +++ b/src/module/utilities/gtpy_contextmanager.cpp @@ -56,6 +56,8 @@ #include "gtpy_contextmanager.h" +#include "gtpypp.h" + ///critical static strings const QString GtpyContextManager::LIST_DATATYPE = QStringLiteral("QList"); const QString GtpyContextManager::VARIANT_DATATYPE = @@ -88,9 +90,9 @@ GtpyContextManager::GtpyContextManager(QObject* parent) : #endif PythonQt::init(PythonQt::RedirectStdOut); - GtpyGilScope::setGILScopeEnabled(true); + PythonQt::self()->setSystemExitExceptionHandlerEnabled(true); PythonQt::self()->registerClass(&GtProject::staticMetaObject, @@ -416,6 +418,7 @@ GtpyContextManager::addObject(int contextId, return false; } + GTPY_GIL_SCOPE PythonQtObjectPtr currentContext = context(contextId); if (currentContext == Q_NULLPTR) @@ -436,8 +439,6 @@ GtpyContextManager::addObject(int contextId, m_addedObjectNames.insert(contextId, list); } - GTPY_GIL_SCOPE - currentContext.addObject(name, obj); return true; @@ -457,9 +458,10 @@ GtpyContextManager::addGtObject(int contextId, const QString& name, return false; } - PythonQtObjectPtr currentContext = context(contextId); + GTPY_GIL_SCOPE + auto currentContext = PyPPObject::Borrow(context(contextId)); - if (currentContext == Q_NULLPTR) + if (!currentContext) { return false; } @@ -477,32 +479,24 @@ GtpyContextManager::addGtObject(int contextId, const QString& name, m_addedObjectNames.insert(contextId, list); } - GTPY_GIL_SCOPE - - PyObject* argsTuple = PyTuple_New(1); + auto argsTuple = PyPPTuple_New(1); - PyObject* pyQtWrapper = PythonQt::priv()->wrapQObject(obj); + auto pyQtWrapper = PyPPObject::fromQObject(obj); if (pyQtWrapper && (pyQtWrapper->ob_type->tp_base == &PythonQtInstanceWrapper_Type)) { - PyTuple_SetItem(argsTuple, 0, pyQtWrapper); - } - else - { - Py_XDECREF(pyQtWrapper); - Py_DECREF(argsTuple); - return false; + PyPPTuple_SetItem(argsTuple, 0, std::move(pyQtWrapper)); } - PyObject* wrapped = + + auto wrapped = PyPPObject::NewRef( GtpyExtendedWrapperModule::GtpyExtendedWrapper_Type.tp_new( - &GtpyExtendedWrapperModule::GtpyExtendedWrapper_Type, argsTuple, - NULL); + &GtpyExtendedWrapperModule::GtpyExtendedWrapper_Type, argsTuple.get(), + NULL)); - Py_DECREF(argsTuple); - PyModule_AddObject(currentContext, name.toLatin1().data(), wrapped); + PyPPModule_AddObject(currentContext, name.toLatin1().data(), std::move(wrapped)); return true; } @@ -510,6 +504,8 @@ GtpyContextManager::addGtObject(int contextId, const QString& name, bool GtpyContextManager::addVariable(int contextId, const QString& name, const QVariant& value) { + GTPY_GIL_SCOPE + PythonQtObjectPtr con = context(contextId); if (!con) @@ -517,7 +513,6 @@ GtpyContextManager::addVariable(int contextId, const QString& name, const QVaria return false; } - GTPY_GIL_SCOPE con.addVariable(name, value); @@ -527,6 +522,7 @@ GtpyContextManager::addVariable(int contextId, const QString& name, const QVaria QVariant GtpyContextManager::getVariable(int contextId, const QString &name) { + GTPY_GIL_SCOPE PythonQtObjectPtr con = context(contextId); if (!con) @@ -534,9 +530,8 @@ GtpyContextManager::getVariable(int contextId, const QString &name) return {}; } - GTPY_GIL_SCOPE - - return con.getVariable(name); + auto obj = PyPPObject::Borrow(PythonQt::self()->lookupObject(con, name)); + return PyPPObject_AsQVariant(obj); } bool @@ -632,14 +627,7 @@ QString GtpyContextManager::qvariantToPyStr(const QVariant& val) const { GTPY_GIL_SCOPE - - PyObject* pyObj = PythonQtConv::QVariantToPyObject(val); - - QString retVal = PythonQtConv::PyObjGetString(pyObj); - - Py_XDECREF(pyObj); - - return retVal; + return PyPPString_AsQString(PyPPObject::fromQVariant(val)); } QString @@ -745,29 +733,16 @@ GtpyContextManager::deleteContext(int contextId, bool emitSignal) GTPY_GIL_SCOPE - PythonQtObjectPtr sys; - sys.setNewRef(PyImport_ImportModule("sys")); - - PyObject* dict = PyModule_GetDict(sys); - - if (!dict) - { - return false; - } - - Py_INCREF(dict); + auto sys = PyPPImport_ImportModule("sys"); + auto dict = PyPPModule_GetDict(sys); - PyObject* modules = PyDict_GetItemString(dict, "modules"); + if (!dict) return false; - if (!modules) - { - Py_DECREF(dict); - return false; - } + auto modules = PyPPDict_GetItem(dict, "modules"); - Py_INCREF(modules); + if (!modules) return false; - PyDict_DelItemString(modules, con.contextName.toStdString().c_str()); + PyPPDict_DelItem(modules, con.contextName.toStdString().c_str()); con.module.setNewRef(Q_NULLPTR); @@ -778,9 +753,6 @@ GtpyContextManager::deleteContext(int contextId, bool emitSignal) m_calcAccessibleContexts.removeOne(contextId); - Py_DECREF(modules); - Py_DECREF(dict); - return true; } @@ -845,49 +817,34 @@ GtpyContextManager::threadDictMetaData() GtpyGlobals::StdOutMetaData retval; - PyObject* threadDict = PyThreadState_GetDict(); + auto threadDict = PyPPThreadState_GetDict(); if (!threadDict) { return retval; } - Py_INCREF(threadDict); + auto valItem = PyPPDict_GetItem(threadDict, GtpyGlobals::CONTEXT_KEY); - PyObject* valItem = PyDict_GetItem(threadDict, PyString_FromString( - GtpyGlobals::CONTEXT_KEY)); - - if (valItem && PyString_Check(valItem)) + if (valItem && PyPPUnicode_Check(valItem)) { - Py_INCREF(valItem); - const char* val = PyString_AsString(valItem); - retval.contextName = QString(val); - Py_DECREF(valItem); + retval.contextName = PyPPString_AsQString(valItem); } - PyObject* outputItem = PyDict_GetItem(threadDict, PyString_FromString( - GtpyGlobals::OUTPUT_KEY)); + auto outputItem = PyPPDict_GetItem(threadDict, GtpyGlobals::OUTPUT_KEY); - if (outputItem && PyLong_Check(outputItem)) + if (outputItem && PyPPLong_Check(outputItem)) { - Py_INCREF(outputItem); - retval.output = (bool)PyLong_AsLong(outputItem); - Py_DECREF(outputItem); + retval.output = (bool)PyPPLong_AsLong(outputItem); } - PyObject* errorItem = PyDict_GetItem(threadDict, PyString_FromString( - GtpyGlobals::ERROR_KEY)); + auto errorItem = PyPPDict_GetItem(threadDict, GtpyGlobals::ERROR_KEY); - if (errorItem && PyLong_Check(errorItem)) + if (errorItem && PyPPLong_Check(errorItem)) { - Py_INCREF(errorItem); - retval.error = (bool)PyLong_AsLong(errorItem); - - Py_DECREF(errorItem); + retval.error = (bool)PyPPLong_AsLong(errorItem); } - Py_DECREF(threadDict); - return retval; } @@ -981,42 +938,37 @@ GtpyContextManager::context(int contextId) const #ifdef PY3K -PyObject* +PyPPObject GtpyContextManager::initExtensionModule(const QString& moduleName, PyModuleDef* def) { if (!def) { - return nullptr; + return {}; } GTPY_GIL_SCOPE QByteArray name = moduleName.toUtf8(); - PyObject* myMod = PyModule_Create(def); + auto myMod = PyPPModule_Create(def); modulenameToBuiltins(moduleName); - PyObject* sys = PyImport_ImportModule("sys"); + auto sys = PyPPImport_ImportModule("sys"); if (!sys) { - return nullptr; + return {}; } - PyObject* modules = PyObject_GetAttrString(sys, "modules"); - - PyDict_SetItemString(modules, name.constData(), myMod); - - Py_DECREF(modules); - - Py_DECREF(sys); + auto modules = PyPPObject_GetAttr(sys, "modules"); + PyPPDict_SetItem(modules, name.constData(), myMod); return myMod; } #else -PyObject* +PyPPObject GtpyContextManager::initExtensionModule(const QString& moduleName, PyMethodDef* methods) { @@ -1030,7 +982,7 @@ GtpyContextManager::initExtensionModule(const QString& moduleName, modulenameToBuiltins(moduleName); - return myMod; + return PyPPObject::NewRef(myMod); } #endif @@ -1039,7 +991,7 @@ GtpyContextManager::modulenameToBuiltins(QString name) { GTPY_GIL_SCOPE - PyObject* sys = PyImport_ImportModule("sys"); + auto sys = PyPPImport_ImportModule("sys"); if (!sys) { @@ -1047,58 +999,38 @@ GtpyContextManager::modulenameToBuiltins(QString name) } // add the new module to the list of builtin module names - PyObject* old_module_names = - PyObject_GetAttrString(sys, "builtin_module_names"); - - if (old_module_names && PyTuple_Check(old_module_names)) - { - Py_ssize_t old_size = PyTuple_Size(old_module_names); - PyObject* module_names = PyTuple_New(old_size + 1); - - for (Py_ssize_t i = 0; i < old_size; i++) - { - PyObject* item = PyTuple_GetItem(old_module_names, i); + const auto old_module_names = + PyPPObject_GetAttr(sys, "builtin_module_names"); - if (item) - { - Py_INCREF(item); - PyTuple_SetItem(module_names, i, item); - } - } + if (!old_module_names || !PyPPTuple_Check(old_module_names)) return; - PyObject* moduleName = QSTRING_AS_PYSTRING(name); - PyTuple_SetItem(module_names, old_size, moduleName); + Py_ssize_t old_size = PyPPTuple_Size(old_module_names); + auto module_names = PyPPTuple_New(old_size + 1); - if (PyModule_AddObject(sys, "builtin_module_names", module_names) < 0) + for (Py_ssize_t i = 0; i < old_size; i++) + { + auto item = PyPPTuple_GetItem(old_module_names, i); + if (item) { - Py_DECREF(module_names); + PyPPTuple_SetItem(module_names, i, std::move(item)); } } - Py_XDECREF(old_module_names); - - Py_DECREF(sys); + PyPPTuple_SetItem(module_names, old_size, PyPPObject::fromQString(name)); + PyPPModule_AddObject(sys, "builtin_module_names", std::move(module_names)); } void GtpyContextManager::initCalculatorsModule() { GTPY_GIL_SCOPE - - PyObject* mod = Q_NULLPTR; - #ifdef PY3K - mod = initExtensionModule(GtpyGlobals::MODULE_GtCalculators, - &GtpyCalculatorsModule::GtpyCalculators_Module); + initExtensionModule(GtpyGlobals::MODULE_GtCalculators, &GtpyCalculatorsModule::GtpyCalculators_Module); #else - mod = initExtensionModule( - GtpyGlobals::MODULE_GtCalculators, - GtpyCalculatorsModule::GtpyCalculatorsModule_StaticMethods); + initExtensionModule(GtpyGlobals::MODULE_GtCalculators, + GtpyCalculatorsModule::GtpyCalculatorsModule_StaticMethods); #endif - - Py_XDECREF(mod); - GtpyCalculatorsModule::createCalcConstructors(); } @@ -1107,18 +1039,12 @@ GtpyContextManager::initLoggingModuleC() { GTPY_GIL_SCOPE - PyObject* mod = Q_NULLPTR; - #ifdef PY3K - mod = initExtensionModule(GtpyGlobals::MODULE_GtLogging_C, - &GtpyLoggingModule::GtpyLogging_Module); + initExtensionModule(GtpyGlobals::MODULE_GtLogging_C, &GtpyLoggingModule::GtpyLogging_Module); #else - mod = initExtensionModule( - GtpyGlobals::MODULE_GtLogging_C, - GtpyLoggingModule::GtpyLoggingModule_StaticMethods); + initExtensionModule(GtpyGlobals::MODULE_GtLogging_C, + GtpyLoggingModule::GtpyLoggingModule_StaticMethods)); #endif - - Py_XDECREF(mod); } void @@ -1126,47 +1052,36 @@ GtpyContextManager::initImportBehaviour() { GTPY_GIL_SCOPE - PyObject* builtins = PyImport_ImportModule("builtins"); + auto builtins = PyPPImport_ImportModule("builtins"); if (!builtins) { - builtins = PyImport_ImportModule("__builtin__"); + builtins = PyPPImport_ImportModule("__builtin__"); } - if (builtins) + if (!builtins || !PyPPModule_Check(builtins)) { - if (PyModule_Check(builtins)) - { - PyObject* dict = PyModule_GetDict(builtins); - - if (dict) - { - Py_INCREF(dict); - - PyObject* defImp = PyDict_GetItemString(dict, "__import__"); - - if (defImp) - { - Py_INCREF(defImp); + return; + } - PythonQtObjectPtr imp = GtpyMyImport_Type.tp_new( - &GtpyMyImport_Type, NULL, NULL); + auto dict = PyPPModule_GetDict(builtins); + if (!dict) return; - ((GtpyMyImport*)imp.object())->defaultImp = defImp; - PyDict_SetItemString(dict, "__import__", imp); - } + auto defImp = PyPPDict_GetItem(dict, "__import__"); + if (!defImp) return; - Py_DECREF(dict); - } - } + auto imp = PyPPObject::NewRef(GtpyMyImport_Type.tp_new( + &GtpyMyImport_Type, NULL, NULL)); - Py_DECREF(builtins); - } + // transfer ownership to imp + ((GtpyMyImport*)imp.get())->defaultImp = defImp.release(); + PyPPDict_SetItem(dict, "__import__", std::move(imp)); } void GtpyContextManager::initBatchContext(int contextId) { + GTPY_GIL_SCOPE PythonQtObjectPtr con = context(contextId); if (con == Q_NULLPTR) @@ -1354,26 +1269,22 @@ GtpyContextManager::initWrapperModule() GTPY_GIL_SCOPE - PyObject* mod = Q_NULLPTR; #ifdef PY3K - mod = initExtensionModule( - GtpyGlobals::MODULE_GtObjectWrapperModuleC, - &GtpyExtendedWrapperModule::GtpyExtendedWrapper_Module); + auto mod = initExtensionModule( + GtpyGlobals::MODULE_GtObjectWrapperModuleC, + &GtpyExtendedWrapperModule::GtpyExtendedWrapper_Module + ); #else - mod = initExtensionModule(GtpyGlobals::MODULE_GtObjectWrapperModuleC, - Q_NULLPTR); + auto mod = initExtensionModule(GtpyGlobals::MODULE_GtObjectWrapperModuleC, Q_NULLPTR); #endif - if (PyModule_AddObject( - mod, QSTRING_TO_CHAR_PTR(GtpyGlobals::GTOBJECT_WRAPPER), - (PyObject*) - &GtpyExtendedWrapperModule::GtpyExtendedWrapper_Type) < 0) - { - Py_DECREF(&GtpyExtendedWrapperModule::GtpyExtendedWrapper_Type); - } + auto wrapperType = PyPPObject::NewRef( + (PyObject*)&GtpyExtendedWrapperModule::GtpyExtendedWrapper_Type); - Py_XDECREF(mod); + PyPPModule_AddObject(mod, + QSTRING_TO_CHAR_PTR(GtpyGlobals::GTOBJECT_WRAPPER), + std::move(wrapperType)); } void @@ -1425,6 +1336,7 @@ GtpyContextManager::enableOutputToAppConsole(int contextId) void GtpyContextManager::importDefaultModules(int contextId) { + GTPY_GIL_SCOPE PythonQtObjectPtr con = context(contextId); if (con == Q_NULLPTR) @@ -1438,8 +1350,6 @@ GtpyContextManager::importDefaultModules(int contextId) "from " + GtpyGlobals::MODULE_GtObjectWrapperModuleC + " import " + GtpyGlobals::GTOBJECT_WRAPPER + "\n"; - GTPY_GIL_SCOPE - con.evalScript(pyCode); } @@ -1447,6 +1357,7 @@ void GtpyContextManager::importLoggingFuncs(int contextId, bool appConsole) { + GTPY_GIL_SCOPE PythonQtObjectPtr con = context(contextId); if (con == Q_NULLPTR) @@ -1471,7 +1382,6 @@ GtpyContextManager::importLoggingFuncs(int contextId, enableOutputToAppConsole(contextId); } - GTPY_GIL_SCOPE con.evalScript(pyCode); @@ -1486,6 +1396,7 @@ GtpyContextManager::importCalcModule(int contextId) m_calcAccessibleContexts << contextId; } + GTPY_GIL_SCOPE PythonQtObjectPtr con = context(contextId); if (con == Q_NULLPTR) @@ -1495,8 +1406,6 @@ GtpyContextManager::importCalcModule(int contextId) QString pyCode = "__import__." + GtpyGlobals::FUNC_importGtCalc + "()"; - GTPY_GIL_SCOPE - con.evalScript(pyCode); } @@ -1538,53 +1447,28 @@ GtpyContextManager::setMetaDataToThreadDict(GtpyGlobals::StdOutMetaData mData) { GTPY_GIL_SCOPE - PyObject* threadDict = PyThreadState_GetDict(); + auto threadDict = PyPPThreadState_GetDict(); if (!threadDict) { return; } - Py_INCREF(threadDict); - - PyObject* key = PyString_FromString(QSTRING_TO_CHAR_PTR( - mData.contextName)); - - PyDict_SetItemString(threadDict, GtpyGlobals::CONTEXT_KEY, key); - - Py_DECREF(key); - - PyObject* outputVal = Q_NULLPTR; - - if (mData.output) { - outputVal = PyLong_FromLong(1); + const auto key = PyPPObject::fromQString(mData.contextName); + PyPPDict_SetItem(threadDict, GtpyGlobals::CONTEXT_KEY, key); } - else - { - outputVal = PyLong_FromLong(0); - } - - PyDict_SetItemString(threadDict, GtpyGlobals::OUTPUT_KEY, outputVal); - Py_DECREF(outputVal); - - PyObject* errorVal = Q_NULLPTR; - - if (mData.error) { - errorVal = PyLong_FromLong(1); + const auto outputVal = PyPPObject::fromLong(mData.output ? 1 : 0); + PyPPDict_SetItem(threadDict, GtpyGlobals::OUTPUT_KEY, outputVal); } - else + { - errorVal = PyLong_FromLong(0); + const auto errorVal = PyPPObject::fromLong(mData.error ? 1 : 0); + PyPPDict_SetItem(threadDict, GtpyGlobals::ERROR_KEY, errorVal); } - PyDict_SetItemString(threadDict, GtpyGlobals::ERROR_KEY, errorVal); - - Py_DECREF(errorVal); - - Py_DECREF(threadDict); } void @@ -1601,31 +1485,22 @@ GtpyContextManager::addModulePath(const QString& path) { GTPY_GIL_SCOPE - PyObject* pyPath = PySys_GetObject("path"); - - if (pyPath) - { - Py_INCREF(pyPath); - - PyObject* pathObj = PythonQtConv::QStringToPyObject(path); - bool equal = false; + auto pyPath = PyPPSys_GetObject("path"); - for (int i = 0; !equal && i < Py_SIZE(pyPath); i++) - { - PyObject* item = PyList_GetItem(pyPath, i); + if (!pyPath) return; - Py_INCREF(item); - equal = PyObject_RichCompareBool(item, pathObj, Py_EQ); - Py_DECREF(item); - } + const auto pathObj = PyPPObject::fromQString(path); + bool equal = false; - if (!equal) - { - PyList_Append(pyPath, pathObj); - } + for (int i = 0; !equal && i < Py_SIZE(pyPath.get()); i++) + { + const auto item = PyPPList_GetItem(pyPath, i); + equal = PyPPObject_RichCompareBool(item, pathObj, Py_EQ); + } - Py_DECREF(pathObj); - Py_DECREF(pyPath); + if (!equal) + { + PyPPList_Append(pyPath, pathObj); } } @@ -1643,7 +1518,7 @@ GtpyContextManager::setMetaDataToThreadDict(int contextId, bool output, } QMultiMap -GtpyContextManager::introspectObject(PyObject* object) const +GtpyContextManager::introspectObject(PyObject* objectIn) const { GTPY_GIL_SCOPE @@ -1654,61 +1529,47 @@ GtpyContextManager::introspectObject(PyObject* object) const return results; } - if (object == Q_NULLPTR) + if (!objectIn) { return results; } - Py_INCREF(object); + auto object = PyPPObject::Borrow(objectIn); - PyObject* keys = NULL; + + PyPPObject keys; bool isDict = false; - if (PyDict_Check(object)) + if (PyPPDict_Check(object)) { - keys = PyDict_Keys(object); + keys = PyPPDict_Keys(object); isDict = true; } else { - keys = PyObject_Dir(object); + keys = PyPPObject_Dir(object); } if (keys) { - int count = PyList_Size(keys); - PyObject* value = Q_NULLPTR; - PyObject* key = Q_NULLPTR; - QString keystr; + int count = PyPPList_Size(keys); for (int i = 0; i < count; i++) { - key = PyList_GetItem(keys, i); + auto key = PyPPList_GetItem(keys, i); if (!key) { continue; } - Py_INCREF(key); - - if (isDict) - { - value = PyDict_GetItem(object, key); - Py_XINCREF(value); - } - else - { - value = PyObject_GetAttr(object, key); - } + PyPPObject value = isDict ? + PyPPDict_GetItem(object, key) : + PyPPObject_GetAttr(object, key); - if (!value) - { - continue; - } + if (!value) continue; - const char* keychar = PyString_AsString(key); - keystr = QString::fromUtf8(keychar); + const auto keystr = PyPPString_AsQString(key); static const QString underscoreStr(QStringLiteral("__")); @@ -1721,7 +1582,7 @@ GtpyContextManager::introspectObject(PyObject* object) const func.name = keystr + QStringLiteral("()"); PythonQtSlotInfo* info = - ((PythonQtSlotFunctionObject*)value)->m_ml; + ((PythonQtSlotFunctionObject*)value.get())->m_ml; if (info) { @@ -1746,7 +1607,7 @@ GtpyContextManager::introspectObject(PyObject* object) const else if (value->ob_type == &PyCFunction_Type || value->ob_type == &PyFunction_Type || value->ob_type == &PyMethod_Type || - PyCallable_Check(value)) + PyPPCallable_Check(value)) { func.name = keystr + QStringLiteral("()"); func.toolTip = func.name; @@ -1762,14 +1623,11 @@ GtpyContextManager::introspectObject(PyObject* object) const results.insert(keystr.toLower(), func); } - Py_DECREF(value); - Py_DECREF(key); } - Py_DECREF(keys); } - PythonQtObjectPtr p = object; + PythonQtObjectPtr p = object.get(); QString childrenFunc = m_decorator->getFunctionName( GET_CHILDREN_TAG); @@ -1985,8 +1843,6 @@ GtpyContextManager::introspectObject(PyObject* object) const } } - Py_DECREF(object); - return results; } @@ -2365,50 +2221,35 @@ GtpyContextManager::onErrorMessage(const QString& message) { GTPY_GIL_SCOPE - PyObject* threadDict = PyThreadState_GetDict(); + const auto threadDict = PyPPThreadState_GetDict(); if (!threadDict) { return; } - Py_INCREF(threadDict); - - PyObject* item = PyDict_GetItem(threadDict, PyString_FromString( - GtpyGlobals::CONTEXT_KEY)); + auto item = PyPPDict_GetItem(threadDict, GtpyGlobals::CONTEXT_KEY); int contextId = -1; if (item) { - Py_INCREF(item); - - const char* val = PyString_AsString(item); - - contextId = contextIdByName(QString(val)); - - Py_DECREF(item); + contextId = contextIdByName(PyPPString_AsQString(item)); } - item = PyDict_GetItem(threadDict, PyString_FromString( - GtpyGlobals::ERROR_KEY)); - - Py_XINCREF(item); + item = PyPPDict_GetItem(threadDict, GtpyGlobals::ERROR_KEY); bool error = false; - if (item && PyInt_Check(item)) + if (item && PyPPLong_Check(item)) { - error = (bool)PyInt_AsLong(item); + error = (bool)PyPPLong_AsLong(item); } if (error && contextId > -1) { emit errorMessage(message, contextId); } - - Py_XDECREF(item); - Py_DECREF(threadDict); } void diff --git a/src/module/utilities/gtpy_contextmanager.h b/src/module/utilities/gtpy_contextmanager.h index 6bd8060..fc1147f 100644 --- a/src/module/utilities/gtpy_contextmanager.h +++ b/src/module/utilities/gtpy_contextmanager.h @@ -23,6 +23,7 @@ #include "gtpy_gilscope.h" #include "gtpy_globals.h" +#include "gtpypp.h" class GtObject; class GtTask; @@ -382,7 +383,7 @@ class GT_PYTHON_EXPORT GtpyContextManager: public QObject * @param def The module definition. * @return A new reference of the extension module. */ - PyObject* initExtensionModule(const QString& moduleName, PyModuleDef* def); + PyPPObject initExtensionModule(const QString& moduleName, PyModuleDef* def); #else /** * @brief Initializes the extension module and assigns it the static @@ -392,7 +393,7 @@ class GT_PYTHON_EXPORT GtpyContextManager: public QObject * @param methods Definition of the static methods. * @return A new reference of the extension module. */ - PyObject* initExtensionModule(const QString& moduleName, + PyPPObject initExtensionModule(const QString& moduleName, PyMethodDef* methods); #endif @@ -798,31 +799,24 @@ class GtpyTypeConversion QMap& map = *((QMap*) inMap); - PyObject* result = PyDict_New(); + auto result = PyPPDict_New(); //QMap::const_iterator t; //t = map.constBegin(); QList keys = map.keys(); - PyObject* key = Q_NULLPTR; - PyObject* val = Q_NULLPTR; - //for ( ; t != map.constEnd(); t++) foreach (Key k, keys) { // converts key and value to QVariant and then to PyObject* - key = PythonQtConv::QVariantToPyObject(QVariant(k)); - val = PythonQtConv::QVariantToPyObject(QVariant(map.value(k))); + auto key = PyPPObject::fromQVariant(QVariant(k)); + auto val = PyPPObject::fromQVariant(QVariant(map.value(k))); // sets key and val to the result dict - PyDict_SetItem(result, key, val); - - // decrement the reference count for key and val - Py_DECREF(key); - Py_DECREF(val); + PyPPDict_SetItem(result, key, val); } - return result; + return result.release(); } /** @@ -833,56 +827,38 @@ class GtpyTypeConversion * @return Whether the conversion was successful or not. */ template - static bool pythonToMap(PyObject* obj, void* outMap) + static bool pythonToMap(PyObject* objIn, void* outMap) { GTPY_GIL_SCOPE - bool success = false; - - if (PyMapping_Check(obj)) - { - QString tempFunc = "items"; - QByteArray ba = tempFunc.toLocal8Bit(); - char* func = ba.data(); + auto obj = PyPPObject::Borrow(objIn); - PyObject* items = PyObject_CallMethod(obj, func, NULL); - if (items) - { - QMap& map = *((QMap*) outMap); - int count = PyList_Size(items); + if (!PyPPMapping_Check(obj)) return false; - PyObject* pyValue = Q_NULLPTR; - PyObject* pyKey = Q_NULLPTR; - PyObject* pyTuple = Q_NULLPTR; + QString tempFunc = "items"; + QByteArray ba = tempFunc.toLocal8Bit(); + char* func = ba.data(); - for (int i = 0; i < count; i++) - { - pyTuple = PyList_GetItem(items, i); - pyKey = PyTuple_GetItem(pyTuple, 0); - pyValue = PyTuple_GetItem(pyTuple, 1); + auto items = PyPPObject_CallMethod(obj, func, NULL); + if (!items) return false; - Py_XINCREF(pyTuple); - Py_XINCREF(pyKey); - Py_XINCREF(pyKey); + QMap& map = *((QMap*) outMap); + int count = PyPPList_Size(items); - QVariant key = PythonQtConv::PyObjToQVariant(pyKey); - QVariant val = PythonQtConv::PyObjToQVariant(pyValue); - - map.insert(key.value(), val.value()); - - Py_XDECREF(pyTuple); - Py_XDECREF(pyKey); - Py_XDECREF(pyKey); - } + for (int i = 0; i < count; i++) + { + auto pyTuple = PyPPList_GetItem(items, i); + auto pyKey = PyPPTuple_GetItem(pyTuple, 0); + auto pyValue = PyPPTuple_GetItem(pyTuple, 1); - Py_DECREF(items); + QVariant key = PyPPObject_AsQVariant(pyKey); + QVariant val = PyPPObject_AsQVariant(pyValue); - success = true; - } + map.insert(key.value(), val.value()); } - return success; + return true; } }; diff --git a/src/module/utilities/gtpy_convert.cpp b/src/module/utilities/gtpy_convert.cpp index f736771..cda09d2 100644 --- a/src/module/utilities/gtpy_convert.cpp +++ b/src/module/utilities/gtpy_convert.cpp @@ -20,12 +20,12 @@ #if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) -PyObject* +PyPPObject gtpy::convert::fromPropertyStructContainer(const GtPropertyStructContainer& con) { GTPY_GIL_SCOPE - PyObject* result = PyDict_New(); + auto result = PyPPDict_New(); /// iterate through the container entries for (const auto& entry : con) @@ -40,13 +40,10 @@ gtpy::convert::fromPropertyStructContainer(const GtPropertyStructContainer& con) if (ok) { /// convert value to PyObject* - auto* valObj = PythonQtConv::QVariantToPyObject(val); + auto valObj = PyPPObject::fromQVariant(val); /// sets name and val to the result dict - PyDict_SetItemString(result, name.toUtf8().data(), valObj); - - /// decrement the reference count for valObj - Py_DECREF(valObj); + PyPPDict_SetItem(result, name.toUtf8().data(), valObj); } } } diff --git a/src/module/utilities/gtpy_convert.h b/src/module/utilities/gtpy_convert.h index ce0e25b..56b4184 100644 --- a/src/module/utilities/gtpy_convert.h +++ b/src/module/utilities/gtpy_convert.h @@ -13,6 +13,7 @@ #include "gt_globals.h" #include +#include "gtpypp.h" #if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) #include "gt_propertystructcontainer.h" @@ -34,7 +35,7 @@ namespace convert { * @return Python dict with name and value pairs from the passed * GtPropertyStructContainer. */ -PyObject* +PyPPObject fromPropertyStructContainer(const GtPropertyStructContainer& con); #endif diff --git a/src/module/utilities/gtpy_decorator.cpp b/src/module/utilities/gtpy_decorator.cpp index 66d5992..07f7122 100644 --- a/src/module/utilities/gtpy_decorator.cpp +++ b/src/module/utilities/gtpy_decorator.cpp @@ -89,48 +89,43 @@ GtpyDecorator::pyObjectToGtObject(PythonQtObjectPtr obj) return gtObj; } -PyObject* +PyPPObject GtpyDecorator::wrapGtObject(GtObject* obj) { if (!obj) { - return Q_NULLPTR; + return {}; } - PyObject* pyQtWrapper = PythonQt::priv()->wrapQObject(obj); + auto pyQtWrapper = PyPPObject::fromQObject(obj); if (pyQtWrapper && pyQtWrapper->ob_type->tp_base != &PythonQtInstanceWrapper_Type) { - Py_XDECREF(pyQtWrapper); - return Q_NULLPTR; + return {}; } - PyObject* childArg = PyTuple_New(1); + auto childArg = PyPPTuple_New(1); - PyTuple_SetItem(childArg, 0, pyQtWrapper); + PyPPTuple_SetItem(childArg, 0, std::move(pyQtWrapper)); - PyObject* wrapped = GtpyExtendedWrapper_Type.tp_new( - &GtpyExtendedWrapper_Type, childArg, Q_NULLPTR); - - Py_DECREF(childArg); - - return wrapped; + return PyPPObject::NewRef(GtpyExtendedWrapper_Type.tp_new( + &GtpyExtendedWrapper_Type, childArg.get(), Q_NULLPTR)); } -PyObject* +PyPPObject GtpyDecorator::wrapGtObject(std::unique_ptr&& obj) { if (!obj) { - return nullptr; + return {}; } auto pyObj = wrapGtObject(obj.get()); // C++ is still owner of pyObj. Now make Python the owner // wrapGtObject actually returns a GtpyExtendedWrapper - GtpyExtendedWrapper* self = (GtpyExtendedWrapper*)(pyObj); + GtpyExtendedWrapper* self = (GtpyExtendedWrapper*)(pyObj.get()); // transfer ownership to python, since nothing own // this clone anymore @@ -282,7 +277,7 @@ GtpyDecorator::switchSession(GtCoreApplication* app, const QString& id) app->switchSession(id); } -PyObject* GtpyDecorator::openProject(GtCoreApplication* app, +PyObjectAPIReturn GtpyDecorator::openProject(GtCoreApplication* app, const QString& projectId) { if (app == Q_NULLPTR) @@ -342,10 +337,10 @@ PyObject* GtpyDecorator::openProject(GtCoreApplication* app, qDebug() << "project opened!"; - return wrapGtObject(project); + return wrapGtObject(project).release(); } -PyObject* +PyObjectAPIReturn GtpyDecorator::currentProject(GtCoreApplication* app) { if (app == Q_NULLPTR) @@ -360,7 +355,7 @@ GtpyDecorator::currentProject(GtCoreApplication* app) return Q_NULLPTR; } - return wrapGtObject(app->currentProject()); + return wrapGtObject(app->currentProject()).release(); } const QString @@ -508,7 +503,7 @@ GtpyDecorator::runProcess(GtProject* pro, const QString& processId, return true; } -PyObject* +PyObjectAPIReturn GtpyDecorator::findProcess(GtProject* pro, const QString& processId) { if (pro == Q_NULLPTR || processId.isEmpty()) @@ -516,7 +511,7 @@ GtpyDecorator::findProcess(GtProject* pro, const QString& processId) return Q_NULLPTR; } - return wrapGtObject(pro->findProcess(processId)); + return wrapGtObject(pro->findProcess(processId)).release(); } bool @@ -540,10 +535,10 @@ GtpyDecorator::run(GtCalculator* calc) } #if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) -PyObject* +PyObjectAPIReturn GtpyDecorator::inputArgs(GtpyScriptCalculator* calc) const { - return gtpy::convert::fromPropertyStructContainer(calc->inputArgs()); + return gtpy::convert::fromPropertyStructContainer(calc->inputArgs()).release(); } QVariant @@ -577,10 +572,10 @@ GtpyDecorator::setInputArg(GtpyScriptCalculator* calc, const QString& argName, } } -PyObject* +PyObjectAPIReturn GtpyDecorator::outputArgs(GtpyScriptCalculator* calc) const { - return gtpy::convert::fromPropertyStructContainer(calc->outputArgs()); + return gtpy::convert::fromPropertyStructContainer(calc->outputArgs()).release(); } QVariant @@ -723,7 +718,7 @@ GtpyDecorator::deleteAllCalculators(GtTask* task) int lastIndex = calcs.size() - 1; - for (lastIndex; lastIndex >= 0; lastIndex--) + for (; lastIndex >= 0; lastIndex--) { GtProcessComponent* calc = calcs.at(lastIndex); calcs.removeAt(lastIndex); @@ -734,10 +729,10 @@ GtpyDecorator::deleteAllCalculators(GtTask* task) } #if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) -PyObject* +PyObjectAPIReturn GtpyDecorator::inputArgs(GtpyTask* task) const { - return gtpy::convert::fromPropertyStructContainer(task->inputArgs()); + return gtpy::convert::fromPropertyStructContainer(task->inputArgs()).release(); } QVariant @@ -771,10 +766,10 @@ GtpyDecorator::setInputArg(GtpyTask* task, const QString& argName, } } -PyObject* +PyObjectAPIReturn GtpyDecorator::outputArgs(GtpyTask* task) const { - return gtpy::convert::fromPropertyStructContainer(task->outputArgs()); + return gtpy::convert::fromPropertyStructContainer(task->outputArgs()).release(); } QVariant @@ -837,16 +832,16 @@ GtpyDecorator::delete_GtpyProcessDataDistributor( delete obj; } -PyObject* +PyObjectAPIReturn GtpyDecorator::taskElement( GtpyProcessDataDistributor* obj, const QString& name) { GtTask* task = obj->taskElement(name); - return wrapGtObject(task); + return wrapGtObject(task).release(); } -PyObject* +PyObjectAPIReturn GtpyDecorator::findGtChild(GtObject* obj, const QString& childName) { if (obj == Q_NULLPTR || childName.isEmpty()) @@ -855,16 +850,16 @@ GtpyDecorator::findGtChild(GtObject* obj, const QString& childName) } GtObject* child = obj->findDirectChild(childName); - return wrapGtObject(child); + return wrapGtObject(child).release(); } -QList +QList GtpyDecorator::findGtChildren(GtObject* obj, const QString& childrenName, const QString& objectClassName) { if (obj == Q_NULLPTR) { - return QList(); + return QList(); } QList children; @@ -904,24 +899,24 @@ GtpyDecorator::findGtChildren(GtObject* obj, const QString& childrenName, } } - QList retval; + QList retval; foreach (GtObject* child, children) { - retval.append(wrapGtObject(child)); + retval.append(wrapGtObject(child).release()); } return retval; } -QList +QList GtpyDecorator::findGtChildrenByClass(GtObject* obj, const QString& objectClassName) { return findGtChildren(obj, QString(), objectClassName); } -PyObject* +PyObjectAPIReturn GtpyDecorator::findGtParent(GtObject* obj) { if (!obj) @@ -931,7 +926,7 @@ GtpyDecorator::findGtParent(GtObject* obj) return nullptr; } - return wrapGtObject(obj->findParent()); + return wrapGtObject(obj->findParent()).release(); } #if GT_VERSION >= 0x020000 QVariant @@ -1131,22 +1126,22 @@ GtpyDecorator::uuid(GtObject* obj) return obj->uuid(); } -PyObject* +PyObjectAPIReturn GtpyDecorator::objectByUUID(GtObject* obj, const QString& uuid) { Q_UNUSED(obj) - return wrapGtObject(obj->getObjectByUuid(uuid)); + return wrapGtObject(obj->getObjectByUuid(uuid)).release(); } -PyObject* +PyObjectAPIReturn GtpyDecorator::clone(GtObject *obj) { if (!obj) return nullptr; // the clone is a new object, we transfer ownership to python std::unique_ptr cloned_obj(obj->clone()); - return wrapGtObject(std::move(cloned_obj)); + return wrapGtObject(std::move(cloned_obj)).release(); } QString diff --git a/src/module/utilities/gtpy_decorator.h b/src/module/utilities/gtpy_decorator.h index b67f95e..e066ed6 100644 --- a/src/module/utilities/gtpy_decorator.h +++ b/src/module/utilities/gtpy_decorator.h @@ -17,7 +17,10 @@ #include -#include "gt_globals.h" +#include +#include "gtpypp.h" +#include "gtpy_globals.h" +#include "gt_pythonmodule_exports.h" class GtCoreApplication; class GtProject; @@ -60,7 +63,7 @@ class GtDataZone0D; * @brief The GtPythonDecorators class * makes C++ functions callable for python scripts. */ -class GtpyDecorator: public QObject +class GT_PYTHON_EXPORT GtpyDecorator: public QObject { Q_OBJECT @@ -85,7 +88,7 @@ class GtpyDecorator: public QObject */ static GtObject* pyObjectToGtObject(PythonQtObjectPtr obj); - static PyObject* wrapGtObject(GtObject* obj); + static PyPPObject wrapGtObject(GtObject* obj); /** * @brief Creates a Python object from obj and transfers ownership to @@ -94,7 +97,7 @@ class GtpyDecorator: public QObject * @param obj Object to be returned to python * @return */ - static PyObject* wrapGtObject(std::unique_ptr&& obj); + static PyPPObject wrapGtObject(std::unique_ptr&& obj); public slots: @@ -154,14 +157,14 @@ public slots: * @param projectId id of the project that should be opened * @return the opened project */ - PyObject* openProject(GtCoreApplication* app, const QString& projectId); + PyObjectAPIReturn openProject(GtCoreApplication* app, const QString& projectId); /** * @brief currentProject returns the current project * @param app pointer to GtCoreApplication * @return the current project */ - PyObject* currentProject(GtCoreApplication* app); + PyObjectAPIReturn currentProject(GtCoreApplication* app); ///-------> functions of GtProject <-------\\\ @@ -202,7 +205,7 @@ public slots: * @param processId id of process that should be returned * @return the process with the given id */ - PyObject* findProcess(GtProject* pro, const QString& processId); + PyObjectAPIReturn findProcess(GtProject* pro, const QString& processId); /** * @brief close close the project @@ -227,7 +230,7 @@ public slots: * @param calc Pointer to GtpyScriptCalculator * @return The input arguments of the given component as Python dict. */ - PyObject* inputArgs(GtpyScriptCalculator* calc) const; + PyObjectAPIReturn inputArgs(GtpyScriptCalculator* calc) const; /** * @brief Decorates inputArg() method of GtpyScriptCalculator. @@ -252,7 +255,7 @@ public slots: * @param calc Pointer to GtpyScriptCalculator * @return The output arguments of the given component as Python dict. */ - PyObject* outputArgs(GtpyScriptCalculator* calc) const; + PyObjectAPIReturn outputArgs(GtpyScriptCalculator* calc) const; /** * @brief Decorates outputArg() method of GtpyScriptCalculator. @@ -285,7 +288,7 @@ public slots: * @param task Pointer to GtpyTask * @return The input arguments of the given component as Python dict. */ - PyObject* inputArgs(GtpyTask* task) const; + PyObjectAPIReturn inputArgs(GtpyTask* task) const; /** * @brief Decorates inputArg() method of GtpyTask. @@ -310,7 +313,7 @@ public slots: * @param task Pointer to GtpyTask * @return The output arguments of the given component as Python dict. */ - PyObject* outputArgs(GtpyTask* task) const; + PyObjectAPIReturn outputArgs(GtpyTask* task) const; /** * @brief Decorates outputArg() method of GtpyTask. @@ -338,7 +341,7 @@ public slots: void delete_GtpyProcessDataDistributor(GtpyProcessDataDistributor* obj); - PyObject* taskElement(GtpyProcessDataDistributor* obj, const QString& name); + PyObjectAPIReturn taskElement(GtpyProcessDataDistributor* obj, const QString& name); ///-------> functions of GtObject <-------\\\ @@ -349,7 +352,7 @@ public slots: * @param childName name of child that should be found * @return See GtObject class documentation. */ - FIND_GT_CHILD PyObject* findGtChild(GtObject* obj, + FIND_GT_CHILD PyObjectAPIReturn findGtChild(GtObject* obj, const QString& childName); /** @@ -360,7 +363,7 @@ public slots: * @param objectClassName : class name filter * @return See GtObject class documentation. */ - FIND_GT_CHILDREN QList findGtChildren(GtObject* obj, + FIND_GT_CHILDREN QList findGtChildren(GtObject* obj, const QString& childrenName = QString(), const QString& objectClassName = QString()); @@ -371,7 +374,7 @@ public slots: * @param objectClassName : class name filter * @return See GtObject class documentation. */ - QList findGtChildrenByClass(GtObject* obj, + QList findGtChildrenByClass(GtObject* obj, const QString& objectClassName); /** @@ -379,7 +382,8 @@ public slots: * @param obj : child object * @return parent object (GtObject) */ - PyObject* findGtParent(GtObject* obj); + PyObjectAPIReturn findGtParent(GtObject* obj); + #if GT_VERSION >= 0x020000 /** * @brief getPropertyContainerVal @@ -459,7 +463,7 @@ public slots: * @param uuid : univerally unique identifier * @return object with the given uuid */ - PyObject* objectByUUID(GtObject* obj, const QString& uuid); + PyObjectAPIReturn objectByUUID(GtObject* obj, const QString& uuid); /** * @brief Clones the given object @@ -469,7 +473,7 @@ public slots: * @param obj The object to be cloned * @return A new object */ - PyObject* clone(GtObject* obj); + PyObjectAPIReturn clone(GtObject* obj); /** * @brief Decorator function to calcHash function of GtObject. diff --git a/src/module/utilities/gtpy_gilscope.h b/src/module/utilities/gtpy_gilscope.h index 1481c6a..91b2da7 100644 --- a/src/module/utilities/gtpy_gilscope.h +++ b/src/module/utilities/gtpy_gilscope.h @@ -11,6 +11,7 @@ #define GTPY_THREADSUPPORT_H #include "PythonQtPythonInclude.h" +#include "gt_pythonmodule_exports.h" #include @@ -19,7 +20,7 @@ /** * @brief The GtpyGilScope class */ -class GtpyGilScope : public QObject +class GT_PYTHON_EXPORT GtpyGilScope : public QObject { Q_OBJECT diff --git a/src/module/utilities/gtpy_globals.h b/src/module/utilities/gtpy_globals.h index 0308c8e..b99a4d7 100644 --- a/src/module/utilities/gtpy_globals.h +++ b/src/module/utilities/gtpy_globals.h @@ -17,6 +17,8 @@ #define MODULE_GTCALCULATORS "GtCalculators" +#define PyObjectAPIReturn PyObject* + namespace GtpyGlobals { ///Environment Variables diff --git a/src/module/utilities/gtpypp.h b/src/module/utilities/gtpypp.h new file mode 100644 index 0000000..09b89aa --- /dev/null +++ b/src/module/utilities/gtpypp.h @@ -0,0 +1,437 @@ +/* GTlab - Gas Turbine laboratory + * Source File: gtpypp.h + * copyright 2024 by DLR + * + * Author: Martin Siggel (martin.siggel@dlr.de) + */ + +#ifndef GTPYPP_H_ +#define GTPYPP_H_ + +#include +#include + +#include +#include + +#include "gtpy_extendedwrapper.h" + +/** + * Basic C++ Wrapper for the Python C-API + * + * It serves as an automatic reference counted RAII-style + * wrapper to reduce the number of manual Py_INCREF / Py_DECREF + */ +template +class PyPPObjectT +{ +public: + PyPPObjectT() : pythonObj(nullptr) {} + + static PyPPObjectT fromQString(const QString& s) + { + return PyPPObjectT::NewRef(PythonQtConv::QStringToPyObject(s)); + } + + static PyPPObjectT fromQObject(QObject* obj) + { + return PyPPObjectT::NewRef( + PythonQt::priv()->wrapQObject(obj) + ); + } + + static PyPPObjectT fromQVariant(const QVariant& var) + { + return PyPPObjectT::NewRef( + PythonQtConv::QVariantToPyObject(var) + ); + } + + static PyPPObjectT fromString(const char* s) + { + return PyPPObjectT::NewRef(PyUnicode_FromString(s)); + } + + static PyPPObjectT fromLong(long value) + { + return PyPPObjectT::NewRef(PyLong_FromLong(value)); + } + + static PyPPObjectT NewRef(PyObjectType* o) + { + return PyPPObjectT(o, PyPPObjectT::NEW); + } + + static PyPPObjectT Borrow(PyObjectType* o) + { + return PyPPObjectT(o, PyPPObjectT::BORROWED); + } + + PyPPObjectT(const PyPPObjectT& other) : pythonObj(other.pythonObj) + { + Py_XINCREF(pythonObj); + } + + PyPPObjectT& operator=(PyPPObjectT&& other) + { + Py_XDECREF(pythonObj); + pythonObj = other.pythonObj; + other.pythonObj = nullptr; + + return *this; + } + + PyPPObjectT& operator=(const PyPPObjectT& other) + { + PyPPObjectT tmp(other); + *this = std::move(tmp); + assert(tmp.pythonObj == nullptr); + return *this; + } + + PyPPObjectT(PyPPObjectT&& other) + { + pythonObj = other.pythonObj; + other.pythonObj = nullptr; + } + + + /** + * Transfers ownership to the caller. + * After release, this object is null. + * + * Used, when a python API function steals ownership + */ + PyObjectType* release() + { + auto retval = pythonObj; + + // setting to nullptr effectively avoids calling DECREF + pythonObj = nullptr; + return retval; + } + + PyObjectType* get() const + { + return pythonObj; + } + + PyObjectType* operator->() + { + return get(); + } + + ~PyPPObjectT() + { + Py_XDECREF(pythonObj); + } + + operator bool() const + { + return get() != nullptr; + } + +private: + enum RefType + { + BORROWED, + NEW + }; + + explicit PyPPObjectT(PyObjectType* obj, RefType type) : pythonObj(obj) + { + if (type == BORROWED) + { + Py_XINCREF(pythonObj); + } + } + + PyObjectType* pythonObj; +}; + +using PyPPObject = PyPPObjectT; + + +/// List functions + +inline PyPPObject PyPPList_New(Py_ssize_t len) +{ + return PyPPObject::NewRef(PyList_New(len)); +} + +inline Py_ssize_t PyPPList_Size(const PyPPObject& list) +{ + return PyList_Size(list.get()); +} + +inline PyPPObject PyPPList_GetItem(const PyPPObject& list, Py_ssize_t index) +{ + return PyPPObject::Borrow(PyList_GetItem(list.get(), index)); +} + +inline int PyPPList_Sort(PyPPObject& o) +{ + return PyList_Sort(o.get()); +} + +// does not steal! +inline int PyPPList_Append(PyPPObject& list, const PyPPObject& item) +{ + return PyList_Append(list.get(), item.get()); +} + +/// Dict functions + +inline PyPPObject PyPPDict_New() +{ + return PyPPObject::NewRef(PyDict_New()); +} + +inline PyPPObject PyPPDict_Copy(const PyPPObject& o) +{ + return PyPPObject::NewRef(PyDict_Copy(o.get())); +} + +inline int PyPPDict_Merge(PyPPObject& a, const PyPPObject& b, int override) +{ + return PyDict_Merge(a.get(), b.get(), override); +} + +inline PyPPObject PyPPDict_GetItem(const PyPPObject& dict, const PyPPObject& str) +{ + return PyPPObject::Borrow(PyDict_GetItem(dict.get(), str.get())); +} + +inline PyPPObject PyPPDict_GetItem(const PyPPObject& dict, const char* s) +{ + return PyPPDict_GetItem(dict, PyPPObject::fromString(s)); +} + + +inline int PyPPDict_SetItem(PyPPObject& dict, const char *key, const PyPPObject& val) +{ + return PyDict_SetItemString(dict.get(), key, val.get()); +} + +inline int PyPPDict_SetItem(PyPPObject& dict, const PyPPObject& key, const PyPPObject& val) +{ + return PyDict_SetItem(dict.get(), key.get(), val.get()); +} + +inline int PyPPDict_Check(const PyPPObject& p) +{ + return PyDict_Check(p.get()); +} + +inline PyPPObject PyPPDict_Keys(const PyPPObject& p) +{ + return PyPPObject::NewRef(PyDict_Keys(p.get())); +} + +inline int PyPPDict_DelItem(PyPPObject& p, const char *key) +{ + return PyDict_DelItemString(p.get(), key); +} + +/// Tuple functions + +inline bool PyPPTuple_Check(const PyPPObject& o) +{ + return PyTuple_Check(o.get()); +} + +inline Py_ssize_t PyPPTuple_Size(const PyPPObject& o) +{ + return PyTuple_Size(o.get()); +} + +inline PyPPObject PyPPTuple_New(Py_ssize_t size) +{ + return PyPPObject::NewRef(PyTuple_New(size)); +} + +inline PyPPObject PyPPTuple_GetItem(const PyPPObject& tuple, Py_ssize_t pos) +{ + return PyPPObject::Borrow(PyTuple_GetItem(tuple.get(), pos)); +} + +// set item steals the object, so we need to move in o +inline int PyPPTuple_SetItem(PyPPObject& p, Py_ssize_t pos, PyPPObject&& o) +{ + return PyTuple_SetItem(p.get(), pos, o.release()); +} + +/// Object Protocol API + +inline PyPPObject PyPPObject_GetAttr(const PyPPObject& o, const char* attrName) +{ + return PyPPObject::NewRef(PyObject_GetAttrString(o.get(), attrName)); +} + +inline PyPPObject PyPPObject_GetAttr(const PyPPObject& o, const PyPPObject& attrName) +{ + return PyPPObject::NewRef(PyObject_GetAttr(o.get(), attrName.get())); +} + +inline PyPPObject PyPPObject_Dir(const PyPPObject& o) +{ + return PyPPObject::NewRef(PyObject_Dir(o.get())); +} + +inline int PyPPObject_TypeCheck(const PyPPObject& o, PyTypeObject* type) +{ + return PyObject_TypeCheck(o.get(), type); +} + +inline PyPPObject PyPPObject_Repr(const PyPPObject& o) +{ + return PyPPObject::NewRef(PyObject_Repr(o.get())); +} + +inline PyPPObject PyPPObject_GenericGetAttr(const PyPPObject& o, const PyPPObject& name) +{ + return PyPPObject::NewRef(PyObject_GenericGetAttr(o.get(), name.get())); +} + +inline int PyPPObject_RichCompareBool(const PyPPObject& o1, const PyPPObject& o2, int opid) +{ + return PyObject_RichCompareBool(o1.get(), o2.get(), opid); +} + +/// Mapping Protocol + +inline int PyPPMapping_Check(const PyPPObject& o) +{ + return PyMapping_Check(o.get()); +} + +/// Operating System Utilities API +inline PyPPObject PyPPSys_GetObject(const char *name) +{ + return PyPPObject::Borrow(PySys_GetObject(name)); +} + +/// Integer API +inline int PyPPLong_Check(const PyPPObject& obj) +{ + return PyLong_Check(obj.get()); +} + +inline long PyPPLong_AsLong(const PyPPObject& obj) +{ + return PyLong_AsLong(obj.get()); +} + +/// Boolean API + +inline int PyPPBool_Check(const PyPPObject& o) +{ + return PyBool_Check(o.get()); +} + +/// Unicode API +inline int PyPPUnicode_Check(const PyPPObject& obj) +{ + return PyUnicode_Check(obj.get()); +} + +inline const char* PyPPUnicode_AsUTF8(const PyPPObject& obj) +{ + return PyUnicode_AsUTF8(obj.get()); +} + +/// Qt API + +inline QString PyPPString_AsQString(const PyPPObject& obj) +{ + return QString::fromUtf8(PyPPUnicode_AsUTF8(obj)); +} + +inline QVariant PyPPObject_AsQVariant(const PyPPObject& obj) +{ + if (obj && PyPPObject_TypeCheck(obj, &GtpyExtendedWrapperModule::GtpyExtendedWrapper_Type)) + { + // We need to get the QObject Python Wrapper from this type first + auto wrapper = (GtpyExtendedWrapperModule::GtpyExtendedWrapper*)obj.get(); + assert(wrapper); + return QVariant::fromValue(wrapper->getObject()); + } + else + { + return PythonQtConv::PyObjToQVariant(obj.get()); + } +} + + +/// Importing API +inline PyPPObject PyPPImport_ImportModule(const char *name) +{ + return PyPPObject::NewRef(PyImport_ImportModule(name)); +} + + +/// Low Level API + +inline PyPPObject PyPPThreadState_GetDict() +{ + return PyPPObject::Borrow(PyThreadState_GetDict()); +} + +inline int PyPPModule_AddObject(PyPPObject& module, const char *name, PyPPObject&& value) +{ + auto ret = PyModule_AddObject(module.get(), name, value.get()); + + if (ret == 0) + { + // The module is now owner + value.release(); + } + + return ret; +} + +inline PyPPObject PyPPModule_Create(PyModuleDef* def) +{ + return PyPPObject::NewRef(PyModule_Create(def)); +} + +inline bool PyPPModule_Check(const PyPPObject& module) +{ + return PyModule_Check(module.get()); +} + +inline PyPPObject PyPPModule_GetDict(const PyPPObject& module) +{ + return PyPPObject::Borrow(PyModule_GetDict(module.get())); +} + +/// Object calling API +inline int PyPPCallable_Check(const PyPPObject& o) +{ + return PyCallable_Check(o.get()); +} + + +inline PyPPObject PyPPObject_Call(const PyPPObject& callable, + const PyPPObject& args, const PyPPObject& kwargs = {}) +{ + PyObject* obj = PyObject_Call(callable.get(), args.get(), kwargs.get()); + return PyPPObject::NewRef(obj); +} + +template +inline PyPPObject PyPPObject_CallMethod(const PyPPObject& obj, const char *name, + const char *format, FormatArgs&& ...args) +{ + PyObject* res = PyObject_CallMethod(obj.get(), name, format, std::forward(args)...); + return PyPPObject::NewRef(res); +} + +/// Reflection API + +inline PyPPObject PyPPEval_GetGlobals() +{ + return PyPPObject::Borrow(PyEval_GetGlobals()); +} + +#endif // GTPYPP_H_ diff --git a/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp b/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp index 47ba8f0..3524791 100644 --- a/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp +++ b/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp @@ -23,140 +23,85 @@ #include "gtpy_gilscope.h" #include "gtpy_calculatorsmodule.h" +#include "gtpypp.h" using namespace GtpyCalculatorsModule; static GtTask* findValue__task() { - GtTask* parentTask = Q_NULLPTR; - - PyObject* globals = PyEval_GetGlobals(); - - if (globals) - { - Py_INCREF(globals); - if (PyDict_Check(globals)) - { - PyObject* taskVar = PyDict_GetItemString(globals, - GtpyGlobals::ATTR_task. - toStdString().data()); + auto globals = PyPPEval_GetGlobals(); + if (!globals || !PyPPDict_Check(globals)) return nullptr; - if (taskVar) - { - Py_INCREF(taskVar); + auto taskVar = PyPPDict_GetItem(globals, + GtpyGlobals::ATTR_task. + toStdString().data()); - if (taskVar->ob_type->tp_base == &PythonQtInstanceWrapper_Type) - { - PythonQtInstanceWrapper* wrapper = - (PythonQtInstanceWrapper*)taskVar; + if(!taskVar) return nullptr; - if (wrapper && wrapper->_obj) - { - parentTask = qobject_cast(wrapper->_obj); - } - } - else - { - GtObject* taskObj = GtpyDecorator::pyObjectToGtObject( - taskVar); - parentTask = qobject_cast(taskObj); - } + if (taskVar->ob_type->tp_base == &PythonQtInstanceWrapper_Type) + { + PythonQtInstanceWrapper* wrapper = + (PythonQtInstanceWrapper*)taskVar.get(); - Py_DECREF(taskVar); - } + if (wrapper && wrapper->_obj) + { + return qobject_cast(wrapper->_obj); } - - Py_DECREF(globals); + } + else + { + GtObject* taskObj = GtpyDecorator::pyObjectToGtObject( + taskVar.get()); + return qobject_cast(taskObj); } - return parentTask; + return nullptr; } static GtTask* findTaskFromHigherFrame() { - GtTask* parentTask = Q_NULLPTR; - PythonQtObjectPtr inspect; - inspect.setNewRef(PyImport_ImportModule("inspect")); + auto inspect = PyPPImport_ImportModule("inspect"); - PyObject* dict = PyModule_GetDict(inspect); + auto dict = PyPPModule_GetDict(inspect); + if (!dict) return nullptr; - if (dict) + + auto func = PyPPDict_GetItem(dict, "currentframe"); + if (!func || !PyPPCallable_Check(func)) return nullptr; + + + GtTask* parentTask = Q_NULLPTR; + + auto fram = PyPPObject_Call(func, PyPPTuple_New(0)); + for (;fram; fram = PyPPObject_GetAttr(fram, "f_back")) { - Py_INCREF(dict); + auto frameGlobals = PyPPObject_GetAttr(fram, "f_globals"); + if (!frameGlobals || !PyPPDict_Check(frameGlobals)) continue; - PyObject* func = PyDict_GetItemString(dict, "currentframe"); + auto taskVar = PyPPDict_GetItem(frameGlobals, GtpyGlobals::ATTR_task.toStdString().data()); + if (!taskVar) continue; - if (func) + if (taskVar->ob_type->tp_base == + &PythonQtInstanceWrapper_Type) { - Py_INCREF(func); + PythonQtInstanceWrapper* wrapper = + (PythonQtInstanceWrapper*)taskVar.get(); - if (PyCallable_Check(func)) + if (wrapper && wrapper->_obj) { - PyObject* fram = PyObject_Call(func, PyTuple_New(0), NULL); - PyObject* backFram = Q_NULLPTR; - - while (fram != Py_None) - { - PyObject* frameGlobals = PyObject_GetAttrString( - fram, "f_globals"); - - if (frameGlobals) - { - if (PyDict_Check(frameGlobals)) - { - PyObject* taskVar = - PyDict_GetItemString(frameGlobals, - GtpyGlobals::ATTR_task. - toStdString().data()); - - if (taskVar) - { - Py_INCREF(taskVar); - - if (taskVar->ob_type->tp_base == - &PythonQtInstanceWrapper_Type) - { - PythonQtInstanceWrapper* wrapper = - (PythonQtInstanceWrapper*)taskVar; - - if (wrapper && wrapper->_obj) - { - parentTask = qobject_cast( - wrapper->_obj); - } - } - else - { - GtObject* taskObj = - GtpyDecorator::pyObjectToGtObject( - taskVar); - parentTask = qobject_cast(taskObj); - } - - Py_DECREF(taskVar); - } - } - - Py_DECREF(frameGlobals); - } - - backFram = PyObject_GetAttrString(fram, - "f_back"); - - Py_DECREF(fram); - - fram = backFram; - } + parentTask = qobject_cast( + wrapper->_obj); } - - Py_DECREF(func); } - - Py_DECREF(dict); + else + { + GtObject* taskObj = GtpyDecorator::pyObjectToGtObject(taskVar.get()); + parentTask = qobject_cast(taskObj); + } } return parentTask; @@ -210,7 +155,7 @@ calcClassName(GtpyCreateCalculator* func) return className; } -static PyObject* +static PyObjectAPIReturn GtpyCreateCalculator_new(PyTypeObject* type, PyObject* args, PyObject* /*kwds*/) { @@ -224,7 +169,7 @@ GtpyCreateCalculator_new(PyTypeObject* type, PyObject* args, PyErr_SetString(PyExc_TypeError, error.toLatin1().data()); - return Q_NULLPTR; + return nullptr; } int argsCount = PyTuple_Size(args); @@ -236,7 +181,7 @@ GtpyCreateCalculator_new(PyTypeObject* type, PyObject* args, PyErr_SetString(PyExc_TypeError, error.toLatin1().data()); - return Q_NULLPTR; + return nullptr; } else if (argsCount > 1) { @@ -246,10 +191,10 @@ GtpyCreateCalculator_new(PyTypeObject* type, PyObject* args, PyErr_SetString(PyExc_TypeError, error.toStdString().c_str()); - return Q_NULLPTR; + return nullptr; } - PyObject* arg = PyTuple_GetItem(args, 0); + auto arg = PyPPTuple_GetItem(PyPPObject::Borrow(args), 0); if (!arg) { @@ -258,24 +203,20 @@ GtpyCreateCalculator_new(PyTypeObject* type, PyObject* args, PyErr_SetString(PyExc_TypeError, error.toLatin1().data()); - return Q_NULLPTR; + return nullptr; } - Py_INCREF(arg); - - if (!PyString_Check(arg)) + if (!PyPPUnicode_Check(arg)) { QString error = "Calculator class name has to be a string"; - PyErr_SetString(PyExc_TypeError, error.toLatin1().data()); - Py_DECREF(arg); - return Q_NULLPTR; + return nullptr; } - self->m_calcClassName = arg; + self->m_calcClassName = arg.release(); - return (PyObject*)self; + return (PyObjectAPIReturn)self; } static void @@ -290,8 +231,8 @@ GtpyCreateCalculator_dealloc(GtpyCreateCalculator* self) Py_TYPE(self)->tp_free((PyObject*)self); } -static PyObject* -GtpyCreateCalculator_Call(PyObject* func, PyObject* args, +static PyObjectAPIReturn +GtpyCreateCalculator_Call(PyObject* func, PyObject* args_py, PyObject* /*kwds*/) { GtpyCreateCalculator* f = (GtpyCreateCalculator*)func; @@ -308,11 +249,14 @@ GtpyCreateCalculator_Call(PyObject* func, PyObject* args, return Q_NULLPTR; } + auto args = PyPPObject::Borrow(args_py); + QString objName; + //@TODO : Potential bug, what if objName is stays empty?, i.e. if args is NULL? if (args) { - int argsCount = PyTuple_Size(args); + int argsCount = PyPPTuple_Size(args); if (argsCount > 1) { @@ -328,26 +272,22 @@ GtpyCreateCalculator_Call(PyObject* func, PyObject* args, if (argsCount == 1) { - PyObject* arg = PyTuple_GetItem(args, 0); + auto arg = PyPPTuple_GetItem(args, 0); if (arg) { - Py_INCREF(arg); - if (!PyString_Check(arg)) + if (!PyPPUnicode_Check(arg)) { QString error = calcClassName(f) + "(name) --> " "object name has to be a string"; PyErr_SetString(PyExc_TypeError, error.toLatin1().data()); - Py_DECREF(arg); return Q_NULLPTR; } - objName = PyString_AsString(arg); - - Py_DECREF(arg); + objName = PyPPString_AsQString(arg); } } } @@ -357,9 +297,7 @@ GtpyCreateCalculator_Call(PyObject* func, PyObject* args, GtCalculator* calc = fac.createCalculator(calcClassName(f), objName, parentTask); - PyObject* obj = GtpyDecorator::wrapGtObject(calc); - - return obj; + return GtpyDecorator::wrapGtObject(calc).release(); } PyTypeObject @@ -405,9 +343,9 @@ GtpyCalculatorsModule::GtpyCreateCalculator_Type = GtpyCreateCalculator_new, /* tp_new */ }; -PyObject* +PyObjectAPIReturn GtpyCalculatorsModule::findGtTask_C_function(PyObject* /*self*/, - PyObject* args) + PyObject* args_py) { GTPY_GIL_SCOPE @@ -423,7 +361,7 @@ GtpyCalculatorsModule::findGtTask_C_function(PyObject* /*self*/, return Q_NULLPTR; } - if (!args) + if (!args_py) { QString error = "findGtTask(name) missing 1 " "required positional argument: name of an " @@ -434,7 +372,9 @@ GtpyCalculatorsModule::findGtTask_C_function(PyObject* /*self*/, return Q_NULLPTR; } - int argsCount = PyTuple_Size(args); + + auto args = PyPPObject::Borrow(args_py); + int argsCount = PyPPTuple_Size(args); if (argsCount < 1) { @@ -457,7 +397,7 @@ GtpyCalculatorsModule::findGtTask_C_function(PyObject* /*self*/, return Q_NULLPTR; } - PyObject* arg = PyTuple_GetItem(args, 0); + auto arg = PyPPTuple_GetItem(args, 0); if (!arg) { @@ -466,25 +406,18 @@ GtpyCalculatorsModule::findGtTask_C_function(PyObject* /*self*/, "existing task"; PyErr_SetString(PyExc_TypeError, error.toLatin1().data()); - return Q_NULLPTR; } - Py_INCREF(arg); - - if (!PyString_Check(arg)) + if (!PyPPUnicode_Check(arg)) { QString error = "findGtTask(name) --> name has to be a string"; PyErr_SetString(PyExc_TypeError, error.toLatin1().data()); - - Py_DECREF(arg); return Q_NULLPTR; } - QString taskName = PyString_AsString(arg); - - Py_DECREF(arg); + QString taskName = PyPPString_AsQString(arg); GtpyProcessDataDistributor distributor(parentTask); @@ -499,14 +432,14 @@ GtpyCalculatorsModule::findGtTask_C_function(PyObject* /*self*/, return Q_NULLPTR; } - return GtpyDecorator::wrapGtObject(task); + return GtpyDecorator::wrapGtObject(task).release(); } void GtpyCalculatorsModule::createCalcConstructors() { - PythonQtObjectPtr mod = - PyImport_ImportModule( + auto mod = + PyPPImport_ImportModule( QSTRING_TO_CHAR_PTR(GtpyGlobals::MODULE_GtCalculators)); if (!mod) @@ -526,18 +459,14 @@ GtpyCalculatorsModule::createCalcConstructors() QString className = QString::fromUtf8( calcData->metaData().className()); - PyObject* argsTuple = PyTuple_New(1); - - PyTuple_SetItem(argsTuple, 0, PyString_FromString( - className.toStdString().data())); + auto argsTuple = PyPPTuple_New(1); - PythonQtObjectPtr calcConstructor = GtpyCreateCalculator_Type.tp_new( - &GtpyCreateCalculator_Type, - argsTuple, NULL); + PyPPTuple_SetItem(argsTuple, 0, PyPPObject::fromQString(className)); - Py_DECREF(argsTuple); + auto calcConstructor = PyPPObject::NewRef( + GtpyCreateCalculator_Type.tp_new(&GtpyCreateCalculator_Type, argsTuple.get(), NULL)); - PyModule_AddObject(mod, className.toStdString().data(), - calcConstructor); + PyPPModule_AddObject(mod, className.toStdString().data(), + std::move(calcConstructor)); } } diff --git a/src/module/utilities/pythonextensions/gtpy_createhelperfunction.cpp b/src/module/utilities/pythonextensions/gtpy_createhelperfunction.cpp index 598babf..02cfa7c 100644 --- a/src/module/utilities/pythonextensions/gtpy_createhelperfunction.cpp +++ b/src/module/utilities/pythonextensions/gtpy_createhelperfunction.cpp @@ -16,6 +16,7 @@ #include "gtpy_decorator.h" #include "gtpy_createhelperfunction.h" +#include "gtpypp.h" using namespace GtpyExtendedWrapperModule; @@ -37,15 +38,18 @@ meth_dealloc(GtpyCreateHelperFunctionObject* m) Py_TYPE(m)->tp_free((PyObject*)m); } -static PyObject* -GtpyCreateHelperFunction_Call(PyObject* func, PyObject* args, +static PyObjectAPIReturn +GtpyCreateHelperFunction_Call(PyObject* func, PyObject* args_py, PyObject* /*kw*/) { GtpyCreateHelperFunctionObject* f = (GtpyCreateHelperFunctionObject*)func; QString objectName; - Py_ssize_t argc = PyTuple_Size(args); + if (!args_py) return nullptr; + + auto args = PyPPObject::Borrow(args_py); + Py_ssize_t argc = PyPPTuple_Size(args); if (!f->m_helperName || !PyString_Check(f->m_helperName)) { @@ -60,26 +64,20 @@ GtpyCreateHelperFunction_Call(PyObject* func, PyObject* args, if (argc == 1) { - PyObject* firstArg = PyTuple_GetItem(args, 0); - - Py_INCREF(firstArg); + auto firstArg = PyPPTuple_GetItem(args, 0); - if (!PyString_Check(firstArg)) + if (!PyPPUnicode_Check(firstArg)) { QString error = "create" + helperName + "(objName) accepts only a argument of type string"; PyErr_SetString(PyExc_TypeError, error.toStdString().c_str()); - - Py_DECREF(firstArg); return Q_NULLPTR; } else { - objectName = PyString_AsString(firstArg); + objectName = PyPPString_AsQString(firstArg); } - - Py_DECREF(firstArg); } else if (argc > 1 || argc < 1) { @@ -96,46 +94,31 @@ GtpyCreateHelperFunction_Call(PyObject* func, PyObject* args, objectName = helperName; } - if (f->m_self->ob_type == &GtpyExtendedWrapper_Type) + auto gtObj = GtpyDecorator::pyObjectToGtObject(f->m_self); + if (gtObj) { - GtpyExtendedWrapper* self = (GtpyExtendedWrapper*)f->m_self; - - if (self && self->_obj) - { - Py_INCREF(self); - - GtObject* gtObj = qobject_cast(self->_obj->_obj); + GtObject* helper = gtCalculatorHelperFactory-> + newCalculatorHelper(helperName, + objectName, gtObj); - if (gtObj) - { - GtObject* helper = gtCalculatorHelperFactory-> - newCalculatorHelper(helperName, - objectName, gtObj); - Py_DECREF(self); - - PyObject* test = GtpyDecorator::wrapGtObject(helper); - - return test; - } - - Py_DECREF(self); - } + return GtpyDecorator::wrapGtObject(helper).release(); } + QString error = "Invalid GtpyExtendedWrapper instance"; PyErr_SetString(PyExc_ValueError, error.toLatin1().data()); return Q_NULLPTR; } -PyObject* -GtpyCreateHelperFunction_New(PyTypeObject* type, PyObject* args, +PyObjectAPIReturn +GtpyCreateHelperFunction_New(PyTypeObject* type, PyObject* argsPy, PyObject* /*kwds*/) { - GtpyCreateHelperFunctionObject* self; - self = (GtpyCreateHelperFunctionObject*)type->tp_alloc(type, 0); + auto self = PyPPObjectT::NewRef( + (GtpyCreateHelperFunctionObject*)type->tp_alloc(type, 0)); - if (!args) + if (!argsPy) { QString error = "Missing required positional arguments: " "GtpyCreateHelperFunction_New(self, helperName)"; @@ -145,7 +128,8 @@ GtpyCreateHelperFunction_New(PyTypeObject* type, PyObject* args, return Q_NULLPTR; } - int argsCount = PyTuple_Size(args); + auto args = PyPPObject::Borrow(argsPy); + int argsCount = PyPPTuple_Size(args); if (argsCount < 2) { @@ -157,7 +141,7 @@ GtpyCreateHelperFunction_New(PyTypeObject* type, PyObject* args, return Q_NULLPTR; } - PyObject* arg = PyTuple_GetItem(args, 0); + auto arg = PyPPTuple_GetItem(args, 0); if (!arg) { @@ -169,22 +153,20 @@ GtpyCreateHelperFunction_New(PyTypeObject* type, PyObject* args, return Q_NULLPTR; } - Py_INCREF(arg); - if (!PyString_Check(arg)) + if (!PyPPUnicode_Check(arg)) { QString error = "GtpyCreateHelperFunction_New(helperName, self) --> " "Helper class name has to be a string"; PyErr_SetString(PyExc_TypeError, error.toLatin1().data()); - Py_DECREF(arg); return Q_NULLPTR; } - self->m_helperName = arg; + self->m_helperName = arg.release(); - PyObject* secArg = PyTuple_GetItem(args, 1); + auto secArg = PyPPTuple_GetItem(args, 1); if (!secArg) { @@ -196,8 +178,6 @@ GtpyCreateHelperFunction_New(PyTypeObject* type, PyObject* args, return Q_NULLPTR; } - Py_INCREF(secArg); - if (secArg->ob_type != &GtpyExtendedWrapper_Type) { QString error = "GtpyCreateHelperFunction_New(helperName, self) --> " @@ -206,13 +186,12 @@ GtpyCreateHelperFunction_New(PyTypeObject* type, PyObject* args, PyErr_SetString(PyExc_TypeError, error.toLatin1().data()); - Py_DECREF(secArg); return Q_NULLPTR; } - self->m_self = secArg; + self->m_self = secArg.release(); - return (PyObject*)self; + return (PyObjectAPIReturn)self.release(); } PyTypeObject diff --git a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp index 5a78ea9..1cd6cdd 100644 --- a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp +++ b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp @@ -19,6 +19,7 @@ #include "gtpy_decorator.h" #include "gtpy_extendedwrapper.h" +#include "gtpypp.h" using namespace GtpyExtendedWrapperModule; @@ -40,38 +41,28 @@ pointerAdress(QObject* obj) static ternaryfunc pythonqt_slot_call = nullptr; -PyObject* -PythonQtSlotFunction_MyCall(PyObject* func, PyObject* args, PyObject* kw) +PyObjectAPIReturn +PythonQtSlotFunction_MyCall(PyObject* func, PyObject* argsPy, PyObject* kw) { - if (PyTuple_Check(args)) + auto args = PyPPObject::Borrow(argsPy); + if (PyPPTuple_Check(args)) { - int size = PyTuple_Size(args); + int size = PyPPTuple_Size(args); for (int i = 0; i < size; i++) { - PyObject* arg = PyTuple_GetItem(args, i); + auto arg = PyPPTuple_GetItem(args, i); - if (arg) - { - Py_INCREF(arg); - - if (PyObject_TypeCheck(arg, &GtpyExtendedWrapper_Type)) - { - GtpyExtendedWrapper* wrapper = (GtpyExtendedWrapper*)arg; - - PyObject* wrappedObj = (PyObject*)wrapper->_obj; + if (!arg || !PyPPObject_TypeCheck(arg, &GtpyExtendedWrapper_Type)) continue; - Py_INCREF(wrappedObj); + GtpyExtendedWrapper* wrapper = (GtpyExtendedWrapper*)arg.get(); + auto wrappedObj = PyPPObject::Borrow((PyObject*)wrapper->_obj); + PyPPTuple_SetItem(args, i, std::move(wrappedObj)); - PyTuple_SetItem(args, i, wrappedObj); - } - - Py_DECREF(arg); - } } } - return pythonqt_slot_call(func, args, kw); + return pythonqt_slot_call(func, args.get(), kw); } void @@ -93,15 +84,15 @@ GtpyExtendedWrapper_dealloc(GtpyExtendedWrapper* self) Py_TYPE(self)->tp_free((PyObject*)self); } -static PyObject* -GtpyExtendedWrapper_new(PyTypeObject* type, PyObject* args, +static PyObjectAPIReturn +GtpyExtendedWrapper_new(PyTypeObject* type, PyObject* argsIn, PyObject* /*kwds*/) { GtpyExtendedWrapper* self; self = (GtpyExtendedWrapper*)type->tp_alloc(type, 0); - if (!args) + if (!argsIn) { QString error = "__init__(self, GtObject) missing 1 " "required positional argument: " @@ -113,7 +104,8 @@ GtpyExtendedWrapper_new(PyTypeObject* type, PyObject* args, return nullptr; } - int argsCount = PyTuple_Size(args); + auto args = PyPPObject::Borrow(argsIn); + int argsCount = PyPPTuple_Size(args); if (argsCount < 1) { @@ -139,29 +131,25 @@ GtpyExtendedWrapper_new(PyTypeObject* type, PyObject* args, return nullptr; } - PyObject* obj = PyTuple_GetItem(args, 0); + auto obj = PyPPTuple_GetItem(args, 0); if (obj && (obj->ob_type->tp_base == &PythonQtInstanceWrapper_Type || obj->ob_type == &PythonQtInstanceWrapper_Type)) { - PythonQtInstanceWrapper* pyQtwrapper = - static_cast((void*)obj); + // transfer owner to pyQtwrapper + auto pyQtwrapper = PyPPObjectT::NewRef( + static_cast((void*)obj.release())); - if (pyQtwrapper) - { - QPointer wrappedObj = pyQtwrapper->_obj; - if (static_cast(wrappedObj.data())) - { - self->_obj = pyQtwrapper; - Py_INCREF(self->_obj); - } + assert(pyQtwrapper); + + if (pyQtwrapper->_obj) + { + self->_obj = pyQtwrapper.release(); } } - PyObject* retval = (PyObject*)self; - - return retval; + return (PyObjectAPIReturn)self; } int @@ -171,7 +159,7 @@ GtpyExtendedWrapper_init(GtpyExtendedWrapper* /*self*/, PyObject* /*args*/, return 0; } -static PyObject* +static PyObjectAPIReturn GtpyExtendedWrapper_richcompare(GtpyExtendedWrapper* self, PyObject* other, int code) { @@ -179,40 +167,36 @@ GtpyExtendedWrapper_richcompare(GtpyExtendedWrapper* self, other, code); } -static PyObject* +static PyObjectAPIReturn object___dir__(PyObject* self/*, PyObject* Py_UNUSED(ignored)*/) { GtpyExtendedWrapper* wrapper = (GtpyExtendedWrapper*)self; - PyObject* result = nullptr; - PyObject* dict = nullptr; - PyObject* wrappedKeys = nullptr; + PyPPObject result; - dict = PyObject_GetAttrString(self, "__dict__"); + auto dict = PyPPObject_GetAttr(PyPPObject::Borrow(self), "__dict__"); - if (dict && PyDict_Check(dict)) + if (dict && PyPPDict_Check(dict)) { - result = PyDict_Keys(dict); + result = PyPPDict_Keys(dict); } if (!result) { - result = PyList_New(0); + result = PyPPList_New(0); } - wrappedKeys = PyObject_Dir((PyObject*)wrapper->_obj); + auto wrappedKeys = PyPPObject_Dir(PyPPObject::Borrow((PyObject*)wrapper->_obj)); if (wrappedKeys) { - int count = PyList_Size(wrappedKeys); - PyObject* key = nullptr; + int count = PyPPList_Size(wrappedKeys); + for (int i = 0; i < count; i++) { - key = PyList_GetItem(wrappedKeys, i); - Py_XINCREF(key); - PyList_Append(result, key); - Py_XDECREF(key); + auto key = PyPPList_GetItem(wrappedKeys, i); + PyPPList_Append(result, key); } } @@ -224,15 +208,12 @@ object___dir__(PyObject* self/*, PyObject* Py_UNUSED(ignored)*/) { QString temp = "create" + helperName; - PyList_Append(result, PyString_FromString(temp.toStdString().data())); + PyPPList_Append(result, PyPPObject::fromQString(temp)); } - PyList_Sort(result); - - Py_XDECREF(dict); - Py_XDECREF(wrappedKeys); + PyPPList_Sort(result); - return result; + return result.release(); } static PyMethodDef @@ -373,33 +354,33 @@ GtpyExtendedWrapper_getattro(PyObject* obj, PyObject* name) // Get attribute object of GtpyExtendedWrapper PyErr_Clear(); - PyObject* attr = PyObject_GenericGetAttr(obj, name); + auto attr = PyPPObject_GenericGetAttr(PyPPObject::Borrow(obj), PyPPObject::Borrow(name)); PyErr_Clear(); // If __dict__ is called fill dict with GtProperties if (strName == "__dict__") { - PyObject* dict = nullptr; + PyPPObject dict; // Create a dict object - if (!attr || !PyDict_Check(attr)) + if (!attr || !PyPPDict_Check(attr)) { - dict = PyDict_New(); + dict = PyPPDict_New(); } else { - dict = PyDict_Copy(attr); + dict = PyPPDict_Copy(attr); } // Get the __dict__ of the wrapped object and merge it with the // created dict - PyObject* pyQtWrapperDict = PyObject_GetAttr( - (PyObject*)wrapper->_obj, name); + auto pyQtWrapperDict = PyPPObject_GetAttr( + PyPPObject::Borrow((PyObject*)wrapper->_obj), PyPPObject::Borrow(name)); PyErr_Clear(); if (pyQtWrapperDict) { - PyDict_Merge(dict, pyQtWrapperDict, false); + PyPPDict_Merge(dict, pyQtWrapperDict, false); } // Add the GtProperty instances to the dict @@ -410,24 +391,20 @@ GtpyExtendedWrapper_getattro(PyObject* obj, PyObject* name) { QString propId{pyValidGtPropertyId(prop->ident())}; - if (PyObject* o = PyObject_GetAttrString( - obj, propId.toLatin1().data())) + if (auto o = PyPPObject_GetAttr(PyPPObject::Borrow(obj), propId.toLatin1().data())) { - PyDict_SetItemString(dict, propId.toLatin1().data(), o); - Py_DECREF(o); + PyPPDict_SetItem(dict, propId.toLatin1().data(), o); } } } - Py_XDECREF(pyQtWrapperDict); - Py_XDECREF(attr); - return dict; + return dict.release(); } // Return the attribute of GtpyExtendedWrapper if it is valid if (attr) { - return attr; + return attr.release(); } // If the attribute is a child object, it will be wrapped and returned @@ -436,20 +413,15 @@ GtpyExtendedWrapper_getattro(PyObject* obj, PyObject* name) { if (child->objectName() == strName) { - PyObject* pyQtWrapper = PythonQt::priv()->wrapQObject(child); + auto pyQtWrapper = PyPPObject::NewRef(PythonQt::priv()->wrapQObject(child)); if (pyQtWrapper) { - PyObject* childArg = PyTuple_New(1); - PyTuple_SetItem(childArg, 0, pyQtWrapper); + auto childArg = PyPPTuple_New(1); + PyPPTuple_SetItem(childArg, 0, std::move(pyQtWrapper)); // Create a new GtpyExtendedWrapper object - PyObject* childObj = PyObject_CallObject( - (PyObject*) &GtpyExtendedWrapper_Type, childArg); - - Py_DECREF(childArg); - - return childObj; + return PyObject_CallObject((PyObject*) &GtpyExtendedWrapper_Type, childArg.get()); } } } @@ -476,9 +448,7 @@ GtpyExtendedWrapper_getattro(PyObject* obj, PyObject* name) { if (propId == strName) { - PyObject* propVal = PythonQtConv::QVariantToPyObject( - prop->valueToVariant()); - return propVal; + return PyPPObject::fromQVariant(prop->valueToVariant()).release(); } if (strName.startsWith("set")) @@ -512,23 +482,15 @@ GtpyExtendedWrapper_getattro(PyObject* obj, PyObject* name) if (strName == createHelperName) { - PyObject* childArg = PyTuple_New(2); - - PyTuple_SetItem(childArg, 0, PyString_FromString( - helperName.toStdString().data())); + auto childArg = PyPPTuple_New(2); - Py_INCREF(obj); - PyTuple_SetItem(childArg, 1, obj); + PyPPTuple_SetItem(childArg, 0, PyPPObject::fromQString(helperName)); + PyPPTuple_SetItem(childArg, 1, PyPPObject::Borrow(obj)); -// PyObject* createHelper = GtpyCreateHelperFunction_Type.tp_new( +// return GtpyCreateHelperFunction_Type.tp_new( // &GtpyCreateHelperFunction_Type, childArg, // nullptr); - PyObject* createHelper = PyObject_CallObject( - (PyObject*) &GtpyCreateHelperFunction_Type, childArg); - - Py_DECREF(childArg); - - return createHelper; + return PyObject_CallObject((PyObject*) &GtpyCreateHelperFunction_Type, childArg.get()); } } @@ -539,7 +501,7 @@ GtpyExtendedWrapper_getattro(PyObject* obj, PyObject* name) return nullptr; } -static PyObject* +static PyObjectAPIReturn GtpyExtendedWrapper_repr(PyObject* self) { GtpyExtendedWrapper* wrapper = (GtpyExtendedWrapper*)self; @@ -552,7 +514,7 @@ GtpyExtendedWrapper_hash(GtpyExtendedWrapper* self) return PythonQtInstanceWrapper_Type.tp_hash((PyObject*)self->_obj); } -static PyObject* +static PyObjectAPIReturn GtpyExtendedWrapper_str(PyObject* self) { GtpyExtendedWrapper* wrapper = (GtpyExtendedWrapper*)self; @@ -672,3 +634,9 @@ GtpyExtendedWrapperModule::GtpyExtendedWrapper_Type = GtpyExtendedWrapper_new, /* tp_new */ }; + +QObject* GtpyExtendedWrapper::getObject() const +{ + if (!_obj) return nullptr; + return _obj->_obj; +} diff --git a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h index d7b2352..e7a01ca 100644 --- a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h +++ b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h @@ -17,16 +17,20 @@ #include "gtpy_globals.h" +#include + namespace GtpyExtendedWrapperModule { extern PyTypeObject GtpyExtendedWrapper_Type; -typedef struct +/// Python wrapper the the GTObject +struct GtpyExtendedWrapper { PyObject_HEAD PythonQtInstanceWrapper* _obj; -} GtpyExtendedWrapper; + QObject* getObject() const; +}; #ifdef PY3K static PyModuleDef diff --git a/src/module/utilities/pythonextensions/gtpy_importfunction.cpp b/src/module/utilities/pythonextensions/gtpy_importfunction.cpp index 0136934..5342c8d 100644 --- a/src/module/utilities/pythonextensions/gtpy_importfunction.cpp +++ b/src/module/utilities/pythonextensions/gtpy_importfunction.cpp @@ -11,6 +11,7 @@ #include "gtpy_calculatorsmodule.h" #include "gtpy_importfunction.h" +#include "gtpypp.h" static void GtpyMyImport_dealloc(GtpyMyImport* self) @@ -25,7 +26,7 @@ GtpyMyImport_dealloc(GtpyMyImport* self) } -static PyObject* +static PyObjectAPIReturn GtpyMyImport_new(PyTypeObject* type, PyObject* /*args*/, PyObject* /*kwds*/) { @@ -37,33 +38,18 @@ GtpyMyImport_new(PyTypeObject* type, PyObject* /*args*/, } static bool -checkModuleName(PyObject* args, const QString& moduleName) +checkModuleName(PyObject* argsPy, const QString& moduleName) { - bool retval = false; + auto args = PyPPObject::Borrow(argsPy); + if (!args || !PyPPTuple_Check(args)) return false; - if (args && PyTuple_Check(args)) - { - Py_INCREF(args); - - PyObject* name = PyTuple_GetItem(args, 0); - - if (name && PyString_Check(name)) - { - Py_INCREF(name); - QString nameStr = PyString_AsString(name); + auto name = PyPPTuple_GetItem(args, 0); + if (!name || !PyPPUnicode_Check(name)) return false; - if (nameStr == moduleName) - { - retval = true; - } - - Py_DECREF(name); - } - - Py_DECREF(args); - } + QString nameStr = PyPPString_AsQString(name); + if (nameStr != moduleName) return false; - return retval; + return true; } static bool @@ -87,7 +73,7 @@ isImportAllowed(PyObject* args) return true; } -static PyObject* +static PyObjectAPIReturn GtpyMyImport_Call(PyObject* func, PyObject* args, PyObject* kwds) { @@ -110,18 +96,15 @@ GtpyMyImport_Call(PyObject* func, PyObject* args, return Q_NULLPTR; } - PyObject* mod = PyObject_Call(f->defaultImp, args, kwds); - - if (mod == Q_NULLPTR) - { - return Q_NULLPTR; - } + auto mod = PyPPObject_Call(PyPPObject::Borrow(f->defaultImp.object()), + PyPPObject::Borrow(args), + PyPPObject::Borrow(kwds)); - return mod; + return mod.release(); } } -static PyObject* +static PyObjectAPIReturn meth_importGtCalculators(PyObject* self) { GtpyMyImport* f = (GtpyMyImport*)self; @@ -138,36 +121,26 @@ meth_importGtCalculators(PyObject* self) } else { - PyObject* argsTuple = PyTuple_New(1); + auto argsTuple = PyPPTuple_New(1); - PyTuple_SetItem(argsTuple, 0, QSTRING_AS_PYSTRING( - GtpyGlobals::MODULE_GtCalculators)); + PyPPTuple_SetItem(argsTuple, 0, PyPPObject::fromQString(GtpyGlobals::MODULE_GtCalculators)); - PyObject* mod = PyObject_Call(f->defaultImp, argsTuple, Q_NULLPTR); + auto mod = PyPPObject_Call(PyPPObject::Borrow(f->defaultImp), argsTuple); - if (mod == Q_NULLPTR) + if (!mod) { return Q_NULLPTR; } - PyObject* globals = PyEval_GetGlobals(); + auto globals = PyPPEval_GetGlobals(); - if (globals) + if (globals && PyPPDict_Check(globals)) { - Py_INCREF(globals); - - if (PyDict_Check(globals)) - { - PyDict_Merge(globals, PyModule_GetDict(mod), 0); - - PyDict_SetItem(globals, QSTRING_AS_PYSTRING( - GtpyGlobals::MODULE_GtCalculators), mod); - } - - Py_DECREF(globals); + PyPPDict_Merge(globals, PyPPModule_GetDict(mod), 0); + PyPPDict_SetItem(globals, PyPPObject::fromQString(GtpyGlobals::MODULE_GtCalculators), mod); } - return mod; + return mod.release(); } } diff --git a/src/module/utilities/pythonextensions/gtpy_loggingmodule.cpp b/src/module/utilities/pythonextensions/gtpy_loggingmodule.cpp index 60a1db5..d8d07b9 100644 --- a/src/module/utilities/pythonextensions/gtpy_loggingmodule.cpp +++ b/src/module/utilities/pythonextensions/gtpy_loggingmodule.cpp @@ -8,6 +8,7 @@ */ #include "gtpy_loggingmodule.h" +#include "gtpypp.h" using namespace GtpyLoggingModule; @@ -23,14 +24,14 @@ GtpyPyLogger_dealloc(GtpyPyLogger* self) Py_TYPE(self)->tp_free((PyObject*)self); } -static PyObject* -GtpyPyLogger_new(PyTypeObject* type, PyObject* args, +static PyObjectAPIReturn +GtpyPyLogger_new(PyTypeObject* type, PyObject* argsPy, PyObject* /*kwds*/) { GtpyPyLogger* self; self = (GtpyPyLogger*)type->tp_alloc(type, 0); - if (!args) + if (!argsPy) { QString error = "__init__(self, OutputType) missing 1 " "required positional argument: int"; @@ -40,7 +41,9 @@ GtpyPyLogger_new(PyTypeObject* type, PyObject* args, return Q_NULLPTR; } - int argsCount = PyTuple_Size(args); + + const auto args = PyPPObject::Borrow(argsPy); + const auto argsCount = PyPPTuple_Size(args); if (argsCount < 1) { @@ -63,29 +66,27 @@ GtpyPyLogger_new(PyTypeObject* type, PyObject* args, return Q_NULLPTR; } - PyObject* outputType = PyTuple_GetItem(args, 0); + auto outputType = PyPPTuple_GetItem(args, 0); if (outputType) { - Py_INCREF(outputType); - - if (!PyInt_Check(outputType)) + if (!PyPPLong_Check(outputType)) { - Py_DECREF(outputType); - QString error = "__init__(self, OutputType) given OutputType is no " "int value!"; PyErr_SetString(PyExc_TypeError, error.toStdString().c_str()); + + // @TODO potential bug. shouldnt this return nullptr? } - self->m_outputType = outputType; + self->m_outputType = outputType.release(); } - return (PyObject*)self; + return (PyObjectAPIReturn)self; } -PyObject* +PyObjectAPIReturn newLoggerInstance(OutputType outputType) { // if (PyType_Ready(&GtpyPyLogger_Type) < 0) @@ -93,42 +94,40 @@ newLoggerInstance(OutputType outputType) // gtError() << "could not initialize GtpyPyLogger_Type"; // } - PyObject* argsTuple = PyTuple_New(1); - PyTuple_SetItem(argsTuple, 0, PyInt_FromLong(outputType)); + auto argsTuple = PyPPTuple_New(1); + PyPPTuple_SetItem(argsTuple, 0, PyPPObject::fromLong(outputType)); - PyObject* logger = GtpyPyLogger_Type.tp_new(&GtpyPyLogger_Type, argsTuple, - NULL); + auto logger = PyPPObject::NewRef( + GtpyPyLogger_Type.tp_new(&GtpyPyLogger_Type, argsTuple.get(), NULL)); - Py_DECREF(argsTuple); - - return logger; + return logger.release(); } -PyObject* +PyObjectAPIReturn GtpyLoggingModule::gtDebug_C_function() { return newLoggerInstance(DEBUG); } -PyObject* +PyObjectAPIReturn GtpyLoggingModule::gtInfo_C_function() { return newLoggerInstance(INFO); } -PyObject* +PyObjectAPIReturn GtpyLoggingModule::gtError_C_function() { return newLoggerInstance(ERROR); } -PyObject* +PyObjectAPIReturn GtpyLoggingModule::gtFatal_C_function() { return newLoggerInstance(FATAL); } -PyObject* +PyObjectAPIReturn GtpyLoggingModule::gtWarning_C_function() { return newLoggerInstance(WARNING); @@ -137,53 +136,20 @@ GtpyLoggingModule::gtWarning_C_function() static void printOutput(QString message) { - PyObject* globals = PyEval_GetGlobals(); + auto globals = PyPPEval_GetGlobals(); + if (!globals || !PyPPDict_Check(globals)) return; - if (globals) - { - Py_INCREF(globals); + auto builtinsDict = PyPPDict_GetItem(globals, "__builtins__"); + if (!builtinsDict || !PyPPDict_Check(builtinsDict)) return; - if (PyDict_Check(globals)) - { - PyObject* builtinsDict = PyDict_GetItemString(globals, - "__builtins__"); + auto print = PyPPDict_GetItem(builtinsDict, "print"); + if (!print || !PyPPCallable_Check(print)) return; - if (builtinsDict) - { - Py_INCREF(builtinsDict); - - if (PyDict_Check(builtinsDict)) - { - PyObject* print = PyDict_GetItemString(builtinsDict, - "print"); - - if (print) - { - Py_INCREF(print); - - if (PyCallable_Check(print)) - { - PyObject* argsTuple = PyTuple_New(1); - PyTuple_SetItem(argsTuple, 0, - QSTRING_AS_PYSTRING(message)); - - PyObject_Call(print, argsTuple, NULL); - - Py_DECREF(argsTuple); - } - - Py_DECREF(print); - } - } - - Py_DECREF(builtinsDict); - } - } - - Py_DECREF(globals); - } + auto argsTuple = PyPPTuple_New(1); + PyPPTuple_SetItem(argsTuple, 0, PyPPObject::fromQString(message)); + PyPPObject_Call(print, argsTuple); // PyObject* builtins = PyImport_ImportModule("builtins"); @@ -230,7 +196,7 @@ printOutput(QString message) // } } -static PyObject* +static PyObjectAPIReturn GtpyPyLogger_lshift(PyObject* self, PyObject* arg) { if (self == Q_NULLPTR || arg == Q_NULLPTR) @@ -240,50 +206,32 @@ GtpyPyLogger_lshift(PyObject* self, PyObject* arg) GtpyPyLogger* logger = (GtpyPyLogger*)self; - PyObject* output = Q_NULLPTR; - if (!PyString_Check(arg)) - { - output = PyObject_Repr(arg); - } - else + auto output = PyPPObject::Borrow(arg); + + if (!PyPPUnicode_Check(output)) { - output = arg; - Py_INCREF(output); + output = PyPPObject_Repr(output); } - QString message(PyString_AsString(output)); + QString message(PyPPString_AsQString(output)); int outputType = PyInt_AsLong(logger->m_outputType); bool outputToAppConsol = false; - PyObject* globals = PyEval_GetGlobals(); + auto globals = PyPPEval_GetGlobals(); - if (globals) + if (globals && PyPPDict_Check(globals)) { - Py_INCREF(globals); + auto appOutputObj = PyPPDict_GetItem(globals, + QSTRING_TO_CHAR_PTR( + GtpyGlobals::ATTR_outputToApp)); - if (PyDict_Check(globals)) + if (appOutputObj && PyPPBool_Check(appOutputObj)) { - PyObject* appOutputObj = PyDict_GetItemString(globals, - QSTRING_TO_CHAR_PTR( - GtpyGlobals::ATTR_outputToApp)); - - if (appOutputObj) - { - Py_INCREF(appOutputObj); - - if (PyBool_Check(appOutputObj)) - { - outputToAppConsol = (bool)PyLong_AsLong(appOutputObj); - } - - Py_DECREF(appOutputObj); - } + outputToAppConsol = (bool)PyPPLong_AsLong(appOutputObj); } - - Py_DECREF(globals); } switch (outputType) @@ -349,9 +297,6 @@ GtpyPyLogger_lshift(PyObject* self, PyObject* arg) break; } - Py_DECREF(output); - output = Q_NULLPTR; - Py_RETURN_NONE; } diff --git a/src/module/utilities/pythonextensions/gtpy_loggingmodule.h b/src/module/utilities/pythonextensions/gtpy_loggingmodule.h index d6557c3..a6bfa81 100644 --- a/src/module/utilities/pythonextensions/gtpy_loggingmodule.h +++ b/src/module/utilities/pythonextensions/gtpy_loggingmodule.h @@ -39,19 +39,19 @@ typedef struct PyObject* m_outputType; } GtpyPyLogger; -extern PyObject* +extern PyObjectAPIReturn gtDebug_C_function(); -extern PyObject* +extern PyObjectAPIReturn gtInfo_C_function(); -extern PyObject* +extern PyObjectAPIReturn gtError_C_function(); -extern PyObject* +extern PyObjectAPIReturn gtFatal_C_function(); -extern PyObject* +extern PyObjectAPIReturn gtWarning_C_function(); static PyMethodDef diff --git a/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp b/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp index 709a652..64aa90b 100644 --- a/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp +++ b/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp @@ -208,9 +208,7 @@ GtpyPropertySetter_New(QString const& propId, PyObject* self, PyObject* module) } } - PyObject* id = PyString_FromString(propId.toStdString().data()); - Py_XINCREF(id); - op->m_propId = id; + op->m_propId = PyPPObject::fromQString(propId).release(); Py_XINCREF(self); op->m_self = self; diff --git a/src/module/utilities/pythonextensions/gtpy_propertysetter.h b/src/module/utilities/pythonextensions/gtpy_propertysetter.h index c314963..b3f47d5 100644 --- a/src/module/utilities/pythonextensions/gtpy_propertysetter.h +++ b/src/module/utilities/pythonextensions/gtpy_propertysetter.h @@ -14,6 +14,13 @@ #include "PythonQtPythonInclude.h" +/** + * @brief This helper type used for to make function calls lile + * `myObject->setMyProperty(value)` work. + * + * The extended wrapper creates a temporary instance of this type, + * which basically wrap the call setXXX. + */ extern PyTypeObject GtpyPropertySetter_Type; PyObject* diff --git a/src/module/utilities/pythonextensions/gtpy_stdout.cpp b/src/module/utilities/pythonextensions/gtpy_stdout.cpp index 4e480ae..5e2e099 100644 --- a/src/module/utilities/pythonextensions/gtpy_stdout.cpp +++ b/src/module/utilities/pythonextensions/gtpy_stdout.cpp @@ -11,8 +11,9 @@ #include "gtpy_globals.h" #include "gtpy_stdout.h" +#include "gtpypp.h" -static PyObject* +static PyObjectAPIReturn GtpyStdOutRedirect_new(PyTypeObject* type, PyObject* /*args*/, PyObject* /*kwds*/) { @@ -26,55 +27,43 @@ GtpyStdOutRedirect_new(PyTypeObject* type, PyObject* /*args*/, return (PyObject*)self; } -static PyObject* +static PyObjectAPIReturn GtpyStdOutRedirect_write(PyObject* self, PyObject* args) { GTPY_GIL_SCOPE - PyObject* threadDict = PyThreadState_GetDict(); + auto threadDict = PyPPThreadState_GetDict(); if (!threadDict) { return Py_BuildValue(""); } - Py_INCREF(threadDict); - PyObject* valItem = PyDict_GetItem(threadDict, PyString_FromString( - GtpyGlobals::CONTEXT_KEY)); + auto valItem = PyPPDict_GetItem(threadDict, GtpyGlobals::CONTEXT_KEY); QString contextName; - if (valItem && PyString_Check(valItem)) + if (valItem && PyPPUnicode_Check(valItem)) { - Py_INCREF(valItem); - const char* val = PyString_AsString(valItem); - contextName = QString(val); - Py_DECREF(valItem); + contextName = PyPPString_AsQString(valItem); } - PyObject* outputItem = PyDict_GetItem(threadDict, PyString_FromString( - GtpyGlobals::OUTPUT_KEY)); + auto outputItem = PyPPDict_GetItem(threadDict, GtpyGlobals::OUTPUT_KEY); bool output = false; - if (outputItem && PyLong_Check(outputItem)) + if (outputItem && PyPPLong_Check(outputItem)) { - Py_INCREF(outputItem); - output = (bool)PyLong_AsLong(outputItem); - Py_DECREF(outputItem); + output = (bool)PyPPLong_AsLong(outputItem); } - PyObject* errorItem = PyDict_GetItem(threadDict, PyString_FromString( - GtpyGlobals::ERROR_KEY)); + auto errorItem = PyPPDict_GetItem(threadDict, GtpyGlobals::ERROR_KEY); bool error = false; - if (errorItem && PyLong_Check(errorItem)) + if (errorItem && PyPPLong_Check(errorItem)) { - Py_INCREF(errorItem); - error = (bool)PyLong_AsLong(errorItem); - - Py_DECREF(errorItem); + error = (bool)PyPPLong_AsLong(errorItem); } GtpyStdOutRedirect* s = (GtpyStdOutRedirect*)self; @@ -85,16 +74,14 @@ GtpyStdOutRedirect_write(PyObject* self, PyObject* args) if (PyTuple_GET_SIZE(args) >= 1) { - PyObject* obj = PyTuple_GET_ITEM(args, 0); - - Py_XINCREF(obj); + auto obj = PyPPTuple_GetItem(PyPPObject::Borrow(args), 0); - if (PyUnicode_Check(obj)) + if (PyPPUnicode_Check(obj)) { #ifdef PY3K - message = QString::fromUtf8(PyUnicode_AsUTF8(obj)); + message = PyPPString_AsQString(obj); #else - PyObject* tmp = PyUnicode_AsUTF8String(obj); + PyObject* tmp = PyUnicode_AsUTF8String(obj.get()); if (tmp) { @@ -103,8 +90,6 @@ GtpyStdOutRedirect_write(PyObject* self, PyObject* args) } else { - Py_XDECREF(obj); - Py_DECREF(threadDict); return NULL; } @@ -116,15 +101,12 @@ GtpyStdOutRedirect_write(PyObject* self, PyObject* args) if (!PyArg_ParseTuple(args, "s", &string)) { - Py_XDECREF(obj); - Py_DECREF(threadDict); return NULL; } message = QString::fromLatin1(string); } - Py_XDECREF(obj); } if (s->softspace > 0) @@ -136,18 +118,17 @@ GtpyStdOutRedirect_write(PyObject* self, PyObject* args) (*s->callback)(contextName, output, error, message); } - Py_DECREF(threadDict); return Py_BuildValue(""); } -static PyObject* +static PyObjectAPIReturn GtpyStdOutRedirect_flush(PyObject* /*self*/, PyObject* /*args*/) { return Py_BuildValue(""); } -static PyObject* +static PyObjectAPIReturn GtpyStdOutRedirect_isatty(PyObject* /*self*/, PyObject* /*args*/) { Py_INCREF(Py_False); diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index 2b7035e..379ab48 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -14,8 +14,13 @@ endif() add_executable(GTlabPythonUnitTest main.cpp + test_helper.h + test_variantconvert.cpp ) -target_link_libraries(GTlabPythonUnitTest PRIVATE GTlab::Python gtest Qt5::Core) +target_compile_definitions(GTlabPythonUnitTest + PRIVATE GT_MODULE_ID="Python Unit Tests" +) +target_link_libraries(GTlabPythonUnitTest PRIVATE GTlab::Core GTlab::Python gtest Qt5::Core) diff --git a/tests/unittests/test_helper.h b/tests/unittests/test_helper.h new file mode 100644 index 0000000..59ea589 --- /dev/null +++ b/tests/unittests/test_helper.h @@ -0,0 +1,41 @@ +#ifndef TEST_HELPER_H +#define TEST_HELPER_H + +#include +#include + +class MyObject : public GtObject +{ + Q_OBJECT +public: + MyObject() + { + setObjectName("MyObjectName"); + } +}; + +struct TestPythonContext +{ + TestPythonContext() : context_id (GtpyContextManager::instance()->createNewContext(GtpyContextManager::ScriptEditorContext)) + { + } + + ~TestPythonContext() + { + GtpyContextManager::instance()->deleteContext(context_id); + } + + int id() const + { + return context_id; + } + + PyPPObject obj() const + { + return PyPPObject::Borrow(GtpyContextManager::instance()->contextPointer(context_id)); + } + + int context_id; +}; + +#endif // TEST_HELPER_H diff --git a/tests/unittests/test_variantconvert.cpp b/tests/unittests/test_variantconvert.cpp new file mode 100644 index 0000000..0f10b53 --- /dev/null +++ b/tests/unittests/test_variantconvert.cpp @@ -0,0 +1,81 @@ +#include + +#include "test_helper.h" + +#include +#include +#include + +TEST(VariantConvert, intAsVariant) +{ + TestPythonContext context; + auto ctxObj = context.obj(); + + GTPY_GIL_SCOPE + + PyPPModule_AddObject(ctxObj, "integer", PyPPObject::fromLong(123)); + auto var = GtpyContextManager::instance()->getVariable(context.id(), "integer"); + EXPECT_EQ(123, var.toInt()); +} + +TEST(VariantConvert, getGtObjectAsVariant) +{ + auto ctxMgr = GtpyContextManager::instance(); + + TestPythonContext context; + auto ctxObj = context.obj(); + + GTPY_GIL_SCOPE + + // Add gtobject to python as name "object" + MyObject o; + PyPPModule_AddObject(ctxObj, "object", GtpyDecorator::wrapGtObject(&o)); + + // get back the object from python + auto objPtr = ctxMgr->getVariable(context.id(), "object").value(); + ASSERT_TRUE(objPtr != nullptr); + + EXPECT_EQ("MyObjectName", objPtr->objectName()); +} + +TEST(VariantConvert, addGtObject) +{ + auto ctxMgr = GtpyContextManager::instance(); + + TestPythonContext context; + auto ctxObj = context.obj(); + + GTPY_GIL_SCOPE + + // Add gtobject to python as name "obj2" + MyObject o; + o.setObjectName("Object2"); + ctxMgr->addGtObject(context.id(), "obj2", &o, false); + + // get back the object from python + auto objPtr = ctxMgr->getVariable(context.id(), "obj2").value(); + ASSERT_TRUE(objPtr != nullptr); + + EXPECT_EQ("Object2", objPtr->objectName()); +} + +TEST(VariantConvert, addVariableObject) +{ + auto ctxMgr = GtpyContextManager::instance(); + + TestPythonContext context; + auto ctxObj = context.obj(); + + GTPY_GIL_SCOPE + + // Add gtobject to python as name "obj3" + MyObject o; + o.setObjectName("Object3"); + ctxMgr->addVariable(context.id(), "obj3", QVariant::fromValue(&o)); + + // get back the object from python + auto objPtr = ctxMgr->getVariable(context.id(), "obj3").value(); + ASSERT_TRUE(objPtr != nullptr); + + EXPECT_EQ("Object3", objPtr->objectName()); +} From 27753ee31c1b100512c9624eab374b81f106ae53 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 10 Apr 2024 14:53:06 +0200 Subject: [PATCH 020/130] An idea how to force python ownership The problem with findGtTask is, that CPP is still the owner of task copies, leading to ever growing task objects. The idea now is to steal the ownership from CPP. This is realized, by extending the extended wrapper object with a forcePythonOwnership variable. If this is true, the pointed-to object will be deleted even if the CPP object has a parent. Closes #261 --- src/module/utilities/gtpy_decorator.cpp | 34 +++++++++++-------- src/module/utilities/gtpy_decorator.h | 19 ++++++++++- .../gtpy_calculatorsmodule.cpp | 3 +- .../pythonextensions/gtpy_extendedwrapper.cpp | 10 ++++-- .../pythonextensions/gtpy_extendedwrapper.h | 5 +++ 5 files changed, 52 insertions(+), 19 deletions(-) diff --git a/src/module/utilities/gtpy_decorator.cpp b/src/module/utilities/gtpy_decorator.cpp index 07f7122..f356118 100644 --- a/src/module/utilities/gtpy_decorator.cpp +++ b/src/module/utilities/gtpy_decorator.cpp @@ -90,7 +90,7 @@ GtpyDecorator::pyObjectToGtObject(PythonQtObjectPtr obj) } PyPPObject -GtpyDecorator::wrapGtObject(GtObject* obj) +GtpyDecorator::wrapGtObject(GtObject* obj, Ownership owner) { if (!obj) { @@ -109,8 +109,22 @@ GtpyDecorator::wrapGtObject(GtObject* obj) PyPPTuple_SetItem(childArg, 0, std::move(pyQtWrapper)); - return PyPPObject::NewRef(GtpyExtendedWrapper_Type.tp_new( + auto retval = PyPPObject::NewRef(GtpyExtendedWrapper_Type.tp_new( &GtpyExtendedWrapper_Type, childArg.get(), Q_NULLPTR)); + + GtpyExtendedWrapper* self = (GtpyExtendedWrapper*)(retval.get()); + + if (owner == Python || owner == ForcePython) + { + if (self->_obj) self->_obj->passOwnershipToPython(); + } + if (owner == ForcePython) + { + self->forcePythonOwnership = true; + } + + return retval; + } PyPPObject @@ -121,19 +135,9 @@ GtpyDecorator::wrapGtObject(std::unique_ptr&& obj) return {}; } - auto pyObj = wrapGtObject(obj.get()); - - // C++ is still owner of pyObj. Now make Python the owner - // wrapGtObject actually returns a GtpyExtendedWrapper - GtpyExtendedWrapper* self = (GtpyExtendedWrapper*)(pyObj.get()); - - // transfer ownership to python, since nothing own - // this clone anymore - if (self->_obj) - { - self->_obj->passOwnershipToPython(); - obj.release(); - } + auto pyObj = wrapGtObject(obj.get(), Python); + // Python is now the owner, remove it from CPP + if (pyObj) obj.release(); return pyObj; } diff --git a/src/module/utilities/gtpy_decorator.h b/src/module/utilities/gtpy_decorator.h index e066ed6..7ea39ed 100644 --- a/src/module/utilities/gtpy_decorator.h +++ b/src/module/utilities/gtpy_decorator.h @@ -88,7 +88,24 @@ class GT_PYTHON_EXPORT GtpyDecorator: public QObject */ static GtObject* pyObjectToGtObject(PythonQtObjectPtr obj); - static PyPPObject wrapGtObject(GtObject* obj); + enum Ownership + { + CPP, // The object's lifetime is managed by C++ + Python, // The object's lifetime is managed by Python + ForcePython // The object should be managed by Python, even though the object is part of a C++ tree + }; + + /** + * @brief Creates a python objecz from a GtObject + * + * Note, this function assumes, that the ownership remains at the C++ side, + * except the ownership argument is changed + * + * @param obj bject to be returned to python + * @param forcePythonOwnership + * @return + */ + static PyPPObject wrapGtObject(GtObject* obj, Ownership owner = CPP); /** * @brief Creates a Python object from obj and transfers ownership to diff --git a/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp b/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp index 3524791..6bc9ddc 100644 --- a/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp +++ b/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp @@ -21,6 +21,7 @@ #include "gtpy_calculatorfactory.h" #include "gtpy_decorator.h" #include "gtpy_gilscope.h" +#include "gtpy_extendedwrapper.h" #include "gtpy_calculatorsmodule.h" #include "gtpypp.h" @@ -432,7 +433,7 @@ GtpyCalculatorsModule::findGtTask_C_function(PyObject* /*self*/, return Q_NULLPTR; } - return GtpyDecorator::wrapGtObject(task).release(); + return GtpyDecorator::wrapGtObject(task, GtpyDecorator::ForcePython).release(); } void diff --git a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp index 1cd6cdd..d403628 100644 --- a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp +++ b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp @@ -77,6 +77,11 @@ GtpyExtendedWrapper_dealloc(GtpyExtendedWrapper* self) { if (self->_obj) { + if (self->forcePythonOwnership && self->_obj->_obj) + { + self->_obj->_obj->deleteLater(); + } + Py_DECREF(self->_obj); self->_obj = nullptr; } @@ -88,9 +93,7 @@ static PyObjectAPIReturn GtpyExtendedWrapper_new(PyTypeObject* type, PyObject* argsIn, PyObject* /*kwds*/) { - GtpyExtendedWrapper* self; - self = (GtpyExtendedWrapper*)type->tp_alloc(type, 0); if (!argsIn) { @@ -104,6 +107,9 @@ GtpyExtendedWrapper_new(PyTypeObject* type, PyObject* argsIn, return nullptr; } + GtpyExtendedWrapper* self = (GtpyExtendedWrapper*)type->tp_alloc(type, 0); + self->forcePythonOwnership = false; + auto args = PyPPObject::Borrow(argsIn); int argsCount = PyPPTuple_Size(args); diff --git a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h index e7a01ca..80cbf66 100644 --- a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h +++ b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h @@ -29,6 +29,11 @@ struct GtpyExtendedWrapper PyObject_HEAD PythonQtInstanceWrapper* _obj; + /// there are (rare) sitations, were you want to force the + /// deletion of a object via python ownership, even when + /// the object is part of a c++ tree + bool forcePythonOwnership = {false}; + QObject* getObject() const; }; From a6bf58812eade4925fb37128fa86818b23de5bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Schneider=2C=20Bj=C3=B6rn?= Date: Mon, 29 Apr 2024 07:10:53 +0000 Subject: [PATCH 021/130] Resolve "Footprint via python tasks" --- CHANGELOG.md | 5 +++ .../extensions/gtpy_pythonfunctions.cpp | 43 +++++++++++++++++++ src/module/extensions/gtpy_pythonfunctions.h | 11 +++++ src/module/utilities/gtpy_constants.h | 1 + src/module/utilities/gtpy_contextmanager.cpp | 21 +++++++++ src/module/utilities/gtpy_contextmanager.h | 16 +++++++ 6 files changed, 97 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 113256d..e33ed40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + - New global function `footprint` to query the application footprint - #269 + ## [1.5.0] - 2023-12-20 ### Fixed - Deadlock when calling Python Calculator via Python Console - #251 diff --git a/src/module/extensions/gtpy_pythonfunctions.cpp b/src/module/extensions/gtpy_pythonfunctions.cpp index e26dcde..d8f5d43 100644 --- a/src/module/extensions/gtpy_pythonfunctions.cpp +++ b/src/module/extensions/gtpy_pythonfunctions.cpp @@ -13,6 +13,7 @@ #include "gt_project.h" #include "gt_application.h" +#include "gt_versionnumber.h" #if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) #include "gt_sharedfunction.h" @@ -36,6 +37,48 @@ gtpy::extension::func::projectPath(PyObject* /*self*/) return PythonQtConv::QStringToPyObject(pro->path()); } +/** + * @brief return footprint of GTlab + * @param only_active : true -> shows all active modules within the project + * false ->shows all available modules within GTlab + * @return map of module names and versions + */ +PyObjectAPIReturn +gtpy::extension::func::footprint(PyObject* self, PyObject* args, PyObject* kwargs) +{ + + // Define the arguments and their default values + static const char* kwlist[] = {"only_active", nullptr}; + + // Parse the arguments + int onlyActive = 1; // Default value + + // Parse the arguments + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|p:footprint", + const_cast(kwlist), &onlyActive)) { + return NULL; + } + + auto versionMap = PyPPDict_New(); + PyPPDict_SetItem(versionMap, "Core", PyPPObject::fromQString( + GtVersionNumber(GT_VERSION_MAJOR, + GT_VERSION_MINOR, + GT_VERSION_PATCH).toString())); + + const auto modules = onlyActive > 0 ? + gtApp->moduleDatamodelInterfaceIds() : + gtApp->moduleIds(); + + for (const auto& mod : modules) + { + PyPPDict_SetItem(versionMap, + PyPPObject::fromQString(mod), + PyPPObject::fromQString(gtApp->moduleVersion(mod).toString())); + } + + return versionMap.release(); +} + #if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) PyObjectAPIReturn diff --git a/src/module/extensions/gtpy_pythonfunctions.h b/src/module/extensions/gtpy_pythonfunctions.h index f7a538a..bfa3237 100644 --- a/src/module/extensions/gtpy_pythonfunctions.h +++ b/src/module/extensions/gtpy_pythonfunctions.h @@ -27,6 +27,8 @@ namespace func { PyObjectAPIReturn projectPath(PyObject* self); +PyObjectAPIReturn footprint(PyObject* self, PyObject* args, PyObject* kwargs); + static PyMethodDef PROJECT_PATH_F_DEF[] = { @@ -36,6 +38,15 @@ static PyMethodDef PROJECT_PATH_F_DEF[] = METH_NOARGS, "projectPath() returns the current project path." }, + { + gtpy::constants::FOOTPRINT_F_NAME, + (PyCFunction)footprint, + METH_VARARGS | METH_KEYWORDS, + "footprint(only_active=True)\n\n" + "Returns the current application footprint map.\n" + "Optional keyword arguments:\n" + "only_active: If 'True', on the currently active modules are included" + }, { nullptr, nullptr, 0, nullptr } }; diff --git a/src/module/utilities/gtpy_constants.h b/src/module/utilities/gtpy_constants.h index 4459dfd..2dffae9 100644 --- a/src/module/utilities/gtpy_constants.h +++ b/src/module/utilities/gtpy_constants.h @@ -19,6 +19,7 @@ constexpr const char* CALL_SHARED_FUNC_F_NAME = "call_shared_function"; constexpr const char* SHARED_FUNC_F_NAME = "shared_function"; constexpr const char* SHARED_FUNC_IDS_F_NAME = "shared_function_ids"; constexpr const char* PROJECT_PATH_F_NAME = "projectPath"; +constexpr const char* FOOTPRINT_F_NAME = "footprint"; /// Collection constexpr const char* COLLECTION_ID = "Python Script Collection"; diff --git a/src/module/utilities/gtpy_contextmanager.cpp b/src/module/utilities/gtpy_contextmanager.cpp index 28d684c..3f5cf56 100644 --- a/src/module/utilities/gtpy_contextmanager.cpp +++ b/src/module/utilities/gtpy_contextmanager.cpp @@ -2107,6 +2107,14 @@ GtpyContextManager::registerTypeConverters() const GtpyTypeConversion::convertFromQMapStringInt); PythonQtConv::registerPythonToMetaTypeConverter(objectPtrMapId, GtpyTypeConversion::convertToQMapStringInt); + + objectPtrMapId = qRegisterMetaType>( + "QMap"); + + PythonQtConv::registerMetaTypeToPythonConverter( + objectPtrMapId, GtpyTypeConversion::convertFromQMapStringQString); + PythonQtConv::registerPythonToMetaTypeConverter( + objectPtrMapId, GtpyTypeConversion::convertToQMapStringQString); } QString @@ -2328,3 +2336,16 @@ GtpyTypeConversion::convertToQMapStringInt(PyObject* obj, void* outMap, { return pythonToMap(obj, outMap); } + +PyObject * +GtpyTypeConversion::convertFromQMapStringQString(const void *inObject, int) +{ + return mapToPython(inObject); +} + +bool +GtpyTypeConversion::convertToQMapStringQString(PyObject *obj, void *outMap, + int, bool) +{ + return pythonToMap(obj, outMap); +} diff --git a/src/module/utilities/gtpy_contextmanager.h b/src/module/utilities/gtpy_contextmanager.h index fc1147f..f3f4276 100644 --- a/src/module/utilities/gtpy_contextmanager.h +++ b/src/module/utilities/gtpy_contextmanager.h @@ -785,6 +785,22 @@ class GtpyTypeConversion static bool convertToQMapStringInt(PyObject* obj, void* outMap, int /*metaTypeId*/, bool /*strict*/); + /** + * @brief Converts QMap instances to a Python object. + * @param inObject QMap instance. + * @return Given QMap instance as Python object. + */ + static PyObject* convertFromQMapStringQString(const void* inObject, + int /*metaTypeId*/); + /** + * @brief Converts Python object to QMap. + * @param obj Python object. + * @param outMap QMap output. + * @return Whether the conversion was successful or not. + */ + static bool convertToQMapStringQString(PyObject* obj, void* outMap, + int /*metaTypeId*/, bool /*strict*/); + private: /** * @brief Template function for converting QMap instances into Python From 26fafa44c1d105ee9bc2c30f6822d856001babf6 Mon Sep 17 00:00:00 2001 From: "Schmeink, Jens" Date: Tue, 30 Apr 2024 07:27:39 +0000 Subject: [PATCH 022/130] Resolve "Check if the pipeline-sub-module is still needed" --- .gitmodules | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index d634709..0000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "tests/pipeline-scripts"] - path = tests/pipeline-scripts - url = ../gitlab-pipeline-scripts.git - branch = main From cac4eafe8c94f2eb7fecab21fc9c530f207d3a97 Mon Sep 17 00:00:00 2001 From: "Schmeink, Jens" Date: Tue, 30 Apr 2024 13:16:36 +0000 Subject: [PATCH 023/130] Resolve "Remove relict of submodule" --- tests/pipeline-scripts | 1 - 1 file changed, 1 deletion(-) delete mode 160000 tests/pipeline-scripts diff --git a/tests/pipeline-scripts b/tests/pipeline-scripts deleted file mode 160000 index d1cc5f0..0000000 --- a/tests/pipeline-scripts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d1cc5f03b4a8261bf206231ce2b89a64ca402d77 From 07f352703f2e19604431c25810cc286116a70f74 Mon Sep 17 00:00:00 2001 From: "Schmeink, Jens" Date: Fri, 3 May 2024 13:14:26 +0000 Subject: [PATCH 024/130] Resolve "[CI] Change source of templates" --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 854aba3..2fcfc00 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ variables: include: - - project: 'at-twk/gitlab-templates' + - project: 'gtlab/public/development-tools/gitlab-templates' file: '/ci-templates/.ci-templates-cmake-1.0.yml' stages: From ecae6dbdcd710d4d8c7d7bd2ffdb0316c0ecb089 Mon Sep 17 00:00:00 2001 From: "Siggel, Martin" Date: Fri, 3 May 2024 13:44:45 +0000 Subject: [PATCH 025/130] Resolve "Slow performance of python console output" --- CHANGELOG.md | 11 ++++++++- src/module/widgets/gtpy_console.cpp | 36 ++++++++++++++++++++++++++--- src/module/widgets/gtpy_console.h | 17 ++++++++++++++ 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e33ed40..0dd5843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] - +### Changed + - Improved the performance of the python console output - #270 + ### Added - New global function `footprint` to query the application footprint - #269 + - Clone function for GtObjects - #258 + - Added some decorator functions for easier access of children and property containers of gtobjects - #254, #255 + +### Fixed + - Fix of some memory leaks - #261, #264 + - Fix of calls of shared functions with gtobjects as arguments - #256 + - Fixed deadlock for calls of python calculators in the python console - #251 ## [1.5.0] - 2023-12-20 ### Fixed diff --git a/src/module/widgets/gtpy_console.cpp b/src/module/widgets/gtpy_console.cpp index 16950aa..df5614e 100644 --- a/src/module/widgets/gtpy_console.cpp +++ b/src/module/widgets/gtpy_console.cpp @@ -33,7 +33,7 @@ const QRegularExpression GtpyConsole::RE_ERROR_LINE GtpyConsole::GtpyConsole(int contextId, QWidget* parent) : - QTextEdit(parent), m_python(Q_NULLPTR), m_defaultPrompt("> ") + QTextEdit(parent), m_python(nullptr), m_defaultPrompt("> "), cache(*this) { setFrameStyle(QFrame::NoFrame); @@ -657,6 +657,7 @@ GtpyConsole::hideKeyboardInterruptException() output.replace(matchError.captured(), interruptString); + cache.flush(); this->clear(); this->insertPlainText(output); } @@ -712,12 +713,14 @@ GtpyConsole::appendCommandPrompt(int contextId, bool storeOnly) m_commandPrompt.append(m_defaultPrompt); + cache.flush(); append(m_commandPrompt); m_commandPrompt = temp; } else { + cache.flush(); append(m_commandPrompt); } @@ -747,6 +750,7 @@ GtpyConsole::onCodeExecuted(int contextId) if (messageInserted) { + cache.flush(); append(QString()); } @@ -766,6 +770,7 @@ GtpyConsole::insertCompletion() m_cpl->insertCompletion(tc); + cache.flush(); setTextCursor(tc); m_cpl->getPopup()->hide(); @@ -777,10 +782,35 @@ GtpyConsole::consoleMessage(const QString& message) QTextCursor cursor = textCursor(); cursor.movePosition(QTextCursor::End); setTextCursor(cursor); - append(QString()); - insertPlainText(message); + cache.append("\n" + message); hideKeyboardInterruptException(); setCurrentCharFormat(m_defaultTextCharacterFormat); } + +GtpyConsole::ConsoleCache::ConsoleCache(QTextEdit & edit) + : edit(edit) +{ + QObject::connect(&timer, &QTimer::timeout, &edit, [this] + { + flush(); + }); +} + +void +GtpyConsole::ConsoleCache::append(const QString& text) +{ + cacheStr += text; + timer.start(30); +} + +void +GtpyConsole::ConsoleCache::flush() +{ + if (cacheStr.isEmpty()) return; + + timer.stop(); + edit.insertPlainText(cacheStr); + cacheStr.clear(); +} diff --git a/src/module/widgets/gtpy_console.h b/src/module/widgets/gtpy_console.h index 3fa7b5c..af4b61f 100644 --- a/src/module/widgets/gtpy_console.h +++ b/src/module/widgets/gtpy_console.h @@ -11,6 +11,7 @@ #define GTPY_CONSOLE_H #include +#include #include "gtpy_contextmanager.h" @@ -120,6 +121,22 @@ public slots: /// Cursor Position int m_cursorPosition; + class ConsoleCache + { + public: + explicit ConsoleCache(QTextEdit&); + + void append(const QString& text); + void flush(); + + private: + QTextEdit& edit; + QString cacheStr; + QTimer timer; + }; + + ConsoleCache cache; + /** * @brief Executes current input. * @param storeOnly True if multiline input. From d822c5f5523bf0cf9ad74bab6f9c33d73ee491ac Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Fri, 3 May 2024 16:06:26 +0200 Subject: [PATCH 026/130] =?UTF-8?q?Bump=20version:=201.5.0=20=E2=86=92=201?= =?UTF-8?q?.6.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGELOG.md | 2 +- src/module/gt_python.cpp | 2 +- src/module/gt_python.json | 2 +- src/setup_module/gt_python_setup.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 6505e77..f656f8a 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.4.2 +current_version = 1.6.0 tag_name = {new_major}-{new_minor}-{new_patch} commit = True tag = True diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dd5843..6160db7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [1.6.0] - 2024-05-03 ### Changed - Improved the performance of the python console output - #270 diff --git a/src/module/gt_python.cpp b/src/module/gt_python.cpp index d25a96e..815f527 100644 --- a/src/module/gt_python.cpp +++ b/src/module/gt_python.cpp @@ -61,7 +61,7 @@ GtVersionNumber GtPythonModule::version() { - return GtVersionNumber(1, 5, 0); + return GtVersionNumber(1, 6, 0); } #else int diff --git a/src/module/gt_python.json b/src/module/gt_python.json index f404bc1..770d503 100644 --- a/src/module/gt_python.json +++ b/src/module/gt_python.json @@ -1,6 +1,6 @@ { "dependencies" : [ - { "name" : "Python Setup", "version" : "1.4.2" } + { "name" : "Python Setup", "version" : "1.6.0" } ], "allowSuppressionBy": ["Python Setup"] } diff --git a/src/setup_module/gt_python_setup.cpp b/src/setup_module/gt_python_setup.cpp index 1f8a8f9..86c4d3b 100644 --- a/src/setup_module/gt_python_setup.cpp +++ b/src/setup_module/gt_python_setup.cpp @@ -43,7 +43,7 @@ getSetting(const QString& settingId) GtVersionNumber GtPythonSetupModule::version() { - return GtVersionNumber(1, 5, 0); + return GtVersionNumber(1, 6, 0); } QString From edf09946d1b520a3190d7ad15ce9d73870f57b7c Mon Sep 17 00:00:00 2001 From: "Schmeink, Jens" Date: Fri, 17 May 2024 08:35:55 +0000 Subject: [PATCH 027/130] Update CMakeLists.txt --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cce00d5..a8c18f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,8 +24,10 @@ if(NOT TARGET GTlab::Core) find_package(GTlab REQUIRED) endif() -if (NOT TARGET GTlab::Numerics) - find_package(GTlabNumerics REQUIRED) +if (GTlab_VERSION_MAJOR LESS 2) + if (NOT TARGET GTlab::Numerics) + find_package(GTlabNumerics REQUIRED) + endif() endif() find_package(PythonQt REQUIRED) From fc71fc546ee465bab30e4616c90e9a2ece548c9b Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 29 May 2024 11:29:47 +0200 Subject: [PATCH 028/130] First version of pythonqt build --- CMakeLists.txt | 5 +- thirdparty/CMakeLists.txt | 6 + thirdparty/pythonqt/CMakeLists.txt | 406 +++++++++++++++++++++++++++++ 3 files changed, 416 insertions(+), 1 deletion(-) create mode 100644 thirdparty/CMakeLists.txt create mode 100644 thirdparty/pythonqt/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index cce00d5..361cab8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,8 +28,11 @@ if (NOT TARGET GTlab::Numerics) find_package(GTlabNumerics REQUIRED) endif() -find_package(PythonQt REQUIRED) +add_subdirectory(thirdparty) +if (NOT TARGET PythonQt::PythonQt) + find_package(PythonQt REQUIRED) +endif() option(BUILD_WITH_COVERAGE "Build with code coverage (linux only)" OFF) option(BUILD_UNITTESTS "Build Unittests" OFF) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt new file mode 100644 index 0000000..64ba237 --- /dev/null +++ b/thirdparty/CMakeLists.txt @@ -0,0 +1,6 @@ +option(BUILD_BUNDLED_PYTHONQT "Build bundled pythonqt as part of this build (recommended)" ON) + +if (BUILD_BUNDLED_PYTHONQT) + set(PythonQt_INSTALL_RUNTIME_DIR ${CMAKE_INSTALL_BINDIR}) + add_subdirectory(pythonqt) +endif() diff --git a/thirdparty/pythonqt/CMakeLists.txt b/thirdparty/pythonqt/CMakeLists.txt new file mode 100644 index 0000000..1ecc4c9 --- /dev/null +++ b/thirdparty/pythonqt/CMakeLists.txt @@ -0,0 +1,406 @@ +# Cmake script to build python qt from git using cmake +# Modernized version of https://github.com/commontk/PythonQt + +cmake_minimum_required(VERSION 3.15) + +project(PythonQt) + +#---------------------------------------------------------------------------- +# Qt version + +# Set PythonQt_QT_VERSION +set(PythonQt_QT_VERSION 5) + +set(PythonQT_VERSION 3.4.2) + +# Requirements +set(minimum_required_qt5_version "5.3.0") +set(minimum_required_qt_version ${minimum_required_qt${PythonQt_QT_VERSION}_version}) + +find_package(Qt5 ${minimum_required_qt_version} QUIET) +set(QT_VERSION_MAJOR ${Qt5_VERSION_MAJOR}) +set(QT_VERSION_MINOR ${Qt5_VERSION_MINOR}) + + + +include(FetchContent) +FetchContent_Declare( + pythonqt + GIT_REPOSITORY https://github.com/MeVisLab/pythonqt.git + GIT_TAG v${PythonQT_VERSION} +) + +if(NOT pythonqt_POPULATED) + message(STATUS "Downloading pythonqt library") + FetchContent_Populate(pythonqt) +endif() + +set(PYTHON_QT_SRC_DIR ${pythonqt_SOURCE_DIR}) + +#---------------------------------------------------------------------------- +# Qt components +set(qtlibs + Core + Widgets + Network + OpenGL + Sql + Svg + Multimedia + UiTools + Xml + XmlPatterns + ) +# Webkit has been removed in Qt >= 5.6 +if("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" VERSION_LESS "5.7") + list(APPEND qtlibs + WebKitWidgets + ) +endif() +if("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" VERSION_GREATER "5.5") + list(APPEND qtlibs + Qml + Quick + ) +endif() + +#----------------------------------------------------------------------------- +# Python libraries + +find_package(Python3 REQUIRED COMPONENTS Development) + +#----------------------------------------------------------------------------- +# Build options + +if(NOT DEFINED PythonQt_INSTALL_RUNTIME_DIR) + set(PythonQt_INSTALL_RUNTIME_DIR bin) +endif() + +if(NOT DEFINED PythonQt_INSTALL_LIBRARY_DIR) + set(PythonQt_INSTALL_LIBRARY_DIR lib${LIB_SUFFIX}) +endif() + +if(NOT DEFINED PythonQt_INSTALL_ARCHIVE_DIR) + set(PythonQt_INSTALL_ARCHIVE_DIR lib${LIB_SUFFIX}) +endif() + +if(NOT DEFINED PythonQt_INSTALL_INCLUDE_DIR) + set(PythonQt_INSTALL_INCLUDE_DIR include/PythonQt) +endif() + +if(NOT DEFINED PythonQt_INSTALL_CONFIG_DIR) + set(PythonQt_INSTALL_CONFIG_DIR ${PythonQt_INSTALL_LIBRARY_DIR}/cmake/PythonQt) +endif() + + + +if(NOT DEFINED PythonQt_DEBUG_POSTFIX) + set(CMAKE_DEBUG_POSTFIX "_d") +else() + set(CMAKE_DEBUG_POSTFIX ${PythonQt_DEBUG_POSTFIX}) +endif() + +#----------------------------------------------------------------------------- +# Set qtlib_to_wraplib_* variables + +set(qtlib_to_wraplib_Widgets gui) +set(qtlib_to_wraplib_WebKitWidgets webkit) + +set(qt5_wrapped_lib_depends_gui Multimedia PrintSupport) +set(qt5_wrapped_lib_depends_multimedia MultimediaWidgets) +set(qt5_wrapped_lib_depends_quick QuickWidgets) + +foreach(qtlib ${qtlibs}) + string(TOLOWER ${qtlib} qtlib_lowercase) + if(DEFINED qtlib_to_wraplib_${qtlib}) + set(qtlib_lowercase ${qtlib_to_wraplib_${qtlib}}) + endif() + set(qtlib_to_wraplib_${qtlib} ${qtlib_lowercase}) +endforeach() + +#----------------------------------------------------------------------------- +# Define PythonQt_Wrap_Qt* options +option(PythonQt_Wrap_QtAll "Make all Qt components available in python" OFF) +foreach(qtlib ${qtlibs}) + OPTION(PythonQt_Wrap_Qt${qtlib_to_wraplib_${qtlib}} "Make all of Qt${qtlib} available in python" OFF) +endforeach() + +#----------------------------------------------------------------------------- +# Force option if it applies +if(PythonQt_Wrap_QtAll) + foreach(qtlib ${qtlibs}) + # XXX xmlpatterns wrapper does *NOT* build at all :( + if(${qtlib} STREQUAL "XmlPatterns") + continue() + endif() + set(qt_wrapped_lib ${qtlib_to_wraplib_${qtlib}}) + if(NOT ${PythonQt_Wrap_Qt${qt_wrapped_lib}}) + set(PythonQt_Wrap_Qt${qt_wrapped_lib} ON CACHE BOOL "Make all of Qt${qt_wrapped_lib} available in python" FORCE) + message(STATUS "Enabling [PythonQt_Wrap_Qt${qt_wrapped_lib}] because of [PythonQt_Wrap_QtAll] evaluates to True") + endif() + endforeach() +endif() + +option(PythonQt_DEBUG "Enable/Disable PythonQt debug output" OFF) + + +#----------------------------------------------------------------------------- +# Setup Qt + +# Required components +set(qt_required_components Core Widgets) +foreach(qtlib ${qtlibs}) + set(qt_wrapped_lib ${qtlib_to_wraplib_${qtlib}}) + if(${PythonQt_Wrap_Qt${qt_wrapped_lib}}) + list(APPEND qt_required_components ${qtlib} ${qt${PythonQt_QT_VERSION}_wrapped_lib_depends_${qt_wrapped_lib}}) + endif() +endforeach() +if(BUILD_TESTING) + list(APPEND qt_required_components Test) +endif() +list(REMOVE_DUPLICATES qt_required_components) + +message(STATUS "${PROJECT_NAME}: Required Qt components [${qt_required_components}]") +find_package(Qt5 ${minimum_required_qt_version} COMPONENTS ${qt_required_components} REQUIRED) + +macro(pythonqt_wrap_cpp) + qt5_wrap_cpp(${ARGV}) +endmacro() + +if(UNIX) + find_package(OpenGL) + if(OPENGL_FOUND) + list(APPEND QT_LIBRARIES ${OPENGL_LIBRARIES}) + endif() +endif() + +#----------------------------------------------------------------------------- +# The variable "generated_cpp_suffix" allows to conditionnally compile the generated wrappers +# associated with the Qt version being used. + +set(generated_cpp_suffix_52 _50) +set(generated_cpp_suffix_51 _50) + +set(generated_cpp_suffix "_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}") +if(DEFINED generated_cpp_suffix_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}) + set(generated_cpp_suffix "${generated_cpp_suffix_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}}") +elseif("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" VERSION_GREATER "5.10") + set(generated_cpp_suffix "_511") +elseif("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" VERSION_GREATER "5.5") + set(generated_cpp_suffix "_56") +elseif("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" VERSION_GREATER "5.3") + set(generated_cpp_suffix "_54") +endif() + +#----------------------------------------------------------------------------- +# Sources + +set(sources + src/PythonQtBoolResult.cpp + src/PythonQtClassInfo.cpp + src/PythonQtClassWrapper.cpp + src/PythonQtConversion.cpp + src/PythonQt.cpp + src/PythonQtImporter.cpp + src/PythonQtInstanceWrapper.cpp + src/PythonQtMethodInfo.cpp + src/PythonQtMisc.cpp + src/PythonQtObjectPtr.cpp + src/PythonQtProperty.cpp + src/PythonQtQFileImporter.cpp + src/PythonQtSignalReceiver.cpp + src/PythonQtSlot.cpp + src/PythonQtSlotDecorator.cpp + src/PythonQtSignal.cpp + src/PythonQtStdDecorators.cpp + src/PythonQtStdIn.cpp + src/PythonQtStdOut.cpp + src/PythonQtThreadSupport.cpp + src/gui/PythonQtScriptingConsole.cpp + + #generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.cpp + + generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp + generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin_init.cpp + generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.cpp + generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin_init.cpp +) + +#----------------------------------------------------------------------------- +# List headers. This is list is used for the install command. + +set(headers + src/PythonQtBoolResult.h + src/PythonQtClassInfo.h + src/PythonQtClassWrapper.h + src/PythonQtConversion.h + src/PythonQtCppWrapperFactory.h + src/PythonQtDoc.h + src/PythonQt.h + src/PythonQtImporter.h + src/PythonQtImportFileInterface.h + src/PythonQtInstanceWrapper.h + src/PythonQtMethodInfo.h + src/PythonQtMisc.h + src/PythonQtObjectPtr.h + src/PythonQtProperty.h + src/PythonQtQFileImporter.h + src/PythonQtSignalReceiver.h + src/PythonQtSlot.h + src/PythonQtSlotDecorator.h + src/PythonQtSignal.h + src/PythonQtStdDecorators.h + src/PythonQtStdIn.h + src/PythonQtStdOut.h + src/PythonQtSystem.h + src/PythonQtThreadSupport.h + src/PythonQtUtils.h + src/PythonQtVariants.h + src/PythonQtPythonInclude.h + # generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.h +) + +#----------------------------------------------------------------------------- +# Headers that should run through moc + +set(moc_sources + src/PythonQt.h + src/PythonQtSignalReceiver.h + src/PythonQtStdDecorators.h + src/gui/PythonQtScriptingConsole.h + + generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.h + generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.h +) + +list(TRANSFORM sources PREPEND "${PYTHON_QT_SRC_DIR}/") +list(TRANSFORM headers PREPEND "${PYTHON_QT_SRC_DIR}/") +list(TRANSFORM moc_sources PREPEND "${PYTHON_QT_SRC_DIR}/") + + + + + +#----------------------------------------------------------------------------- +# Add extra sources +set(PYTHONQT_DEFINES "") +foreach(qtlib ${qtlibs}) + + set(qt_wrapped_lib ${qtlib_to_wraplib_${qtlib}}) + + if (${PythonQt_Wrap_Qt${qt_wrapped_lib}}) + LIST(APPEND PYTHONQT_DEFINES -DPYTHONQT_WRAP_Qt${qt_wrapped_lib}) + + set(file_prefix generated_cpp${generated_cpp_suffix}/com_trolltech_qt_${qt_wrapped_lib}/com_trolltech_qt_${qt_wrapped_lib}) + + foreach(index RANGE 0 12) + + # Source files + if(EXISTS ${PYTHON_QT_SRC_DIR}/${file_prefix}${index}.cpp) + list(APPEND sources ${PYTHON_QT_SRC_DIR}/${file_prefix}${index}.cpp) + endif() + + # Headers that should run through moc + if(EXISTS ${PYTHON_QT_SRC_DIR}/${file_prefix}${index}.h) + list(APPEND moc_sources ${PYTHON_QT_SRC_DIR}/${file_prefix}${index}.h) + endif() + + endforeach() + + list(APPEND sources ${PYTHON_QT_SRC_DIR}/${file_prefix}_init.cpp) + + endif() +endforeach() + +#----------------------------------------------------------------------------- +# Do wrapping +pythonqt_wrap_cpp(gen_moc_sources ${moc_sources}) + +#----------------------------------------------------------------------------- +# Build the library + + +add_library(PythonQt SHARED + ${sources} + ${gen_moc_sources} +) + +add_library(PythonQt::PythonQt ALIAS PythonQt) + +target_include_directories(PythonQt PUBLIC + $ + $ +) + +target_compile_definitions(PythonQt PRIVATE + # -DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK + # -DPYTHONQT_SUPPORT_NAME_PROPERTY + ${PYTHONQT_DEFINES} +) + +if(PythonQt_DEBUG) + target_compile_definitions(PythonQt PRIVATE -DPYTHONQT_DEBUG) +endif() + +set_target_properties(PythonQt PROPERTIES DEFINE_SYMBOL PYTHONQT_EXPORTS) + +# make library name compatible to the qmake one +set_target_properties(PythonQt PROPERTIES + OUTPUT_NAME "PythonQt-Qt${PythonQt_QT_VERSION}-Python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") + +target_compile_options(PythonQt PRIVATE + $<$:/bigobj> + ) + +foreach(qtlib ${qt_required_components}) + target_link_libraries(PythonQt PUBLIC Qt${PythonQt_QT_VERSION}::${qtlib}) +endforeach() + +target_link_libraries(PythonQt PUBLIC + Python3::Python + PRIVATE + # Required for use of "QtCore/private/qmetaobjectbuilder_p.h" in "PythonQt.cpp" + Qt${QT_VERSION_MAJOR}::CorePrivate +) + +#----------------------------------------------------------------------------- +# Install library (on windows, put the dll in 'bin' and the archive in 'lib') + +install(TARGETS PythonQt + EXPORT PythonQt-targets + RUNTIME DESTINATION ${PythonQt_INSTALL_RUNTIME_DIR} + LIBRARY DESTINATION ${PythonQt_INSTALL_LIBRARY_DIR} + ARCHIVE DESTINATION ${PythonQt_INSTALL_ARCHIVE_DIR}) +install(FILES ${headers} DESTINATION ${PythonQt_INSTALL_INCLUDE_DIR}) + + +install(EXPORT PythonQt-targets + DESTINATION ${PythonQt_INSTALL_CONFIG_DIR} +) + +#----------------------------------------------------------------------------- +# Testing + +option(PythonQt_BUILD_TESTING "Build the testing tree." OFF) +include(CTest) + +if(PythonQt_BUILD_TESTING) + set(test_sources + ${PYTHON_QT_SRC_DIR}/tests/PythonQtTestMain.cpp + ${PYTHON_QT_SRC_DIR}/tests/PythonQtTests.cpp + ${PYTHON_QT_SRC_DIR}/tests/PythonQtTests.h + ) + + pythonqt_wrap_cpp(test_sources + ${PYTHON_QT_SRC_DIR}/tests/PythonQtTests.h + ) + + add_executable(PythonQtTest ${test_sources}) + target_link_libraries(PythonQtTest PRIVATE PythonQt) + + add_test( + NAME tests_PythonQtTestMain + COMMAND ${Slicer_LAUNCH_COMMAND} $ + ) +endif() + From dd0bbb21d0cfb77fef1538793a729c72f97b7525 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 29 May 2024 11:39:57 +0200 Subject: [PATCH 029/130] Use automoc --- thirdparty/pythonqt/CMakeLists.txt | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/thirdparty/pythonqt/CMakeLists.txt b/thirdparty/pythonqt/CMakeLists.txt index 1ecc4c9..fcaf9cb 100644 --- a/thirdparty/pythonqt/CMakeLists.txt +++ b/thirdparty/pythonqt/CMakeLists.txt @@ -10,9 +10,10 @@ project(PythonQt) # Set PythonQt_QT_VERSION set(PythonQt_QT_VERSION 5) - set(PythonQT_VERSION 3.4.2) +set(CMAKE_AUTOMOC ON) + # Requirements set(minimum_required_qt5_version "5.3.0") set(minimum_required_qt_version ${minimum_required_qt${PythonQt_QT_VERSION}_version}) @@ -163,10 +164,6 @@ list(REMOVE_DUPLICATES qt_required_components) message(STATUS "${PROJECT_NAME}: Required Qt components [${qt_required_components}]") find_package(Qt5 ${minimum_required_qt_version} COMPONENTS ${qt_required_components} REQUIRED) -macro(pythonqt_wrap_cpp) - qt5_wrap_cpp(${ARGV}) -endmacro() - if(UNIX) find_package(OpenGL) if(OPENGL_FOUND) @@ -312,17 +309,13 @@ foreach(qtlib ${qtlibs}) endif() endforeach() -#----------------------------------------------------------------------------- -# Do wrapping -pythonqt_wrap_cpp(gen_moc_sources ${moc_sources}) - #----------------------------------------------------------------------------- # Build the library add_library(PythonQt SHARED ${sources} - ${gen_moc_sources} + ${moc_sources} ) add_library(PythonQt::PythonQt ALIAS PythonQt) @@ -391,10 +384,6 @@ if(PythonQt_BUILD_TESTING) ${PYTHON_QT_SRC_DIR}/tests/PythonQtTests.h ) - pythonqt_wrap_cpp(test_sources - ${PYTHON_QT_SRC_DIR}/tests/PythonQtTests.h - ) - add_executable(PythonQtTest ${test_sources}) target_link_libraries(PythonQtTest PRIVATE PythonQt) From 28f9731c38026a26b95abaee42232110327b9779 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 29 May 2024 12:01:46 +0200 Subject: [PATCH 030/130] Added export set and pythonqt config --- thirdparty/pythonqt/CMakeLists.txt | 20 +++++++++++++++++++- thirdparty/pythonqt/PythonQtConfig.in | 13 +++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 thirdparty/pythonqt/PythonQtConfig.in diff --git a/thirdparty/pythonqt/CMakeLists.txt b/thirdparty/pythonqt/CMakeLists.txt index fcaf9cb..3ac37c8 100644 --- a/thirdparty/pythonqt/CMakeLists.txt +++ b/thirdparty/pythonqt/CMakeLists.txt @@ -345,8 +345,9 @@ target_compile_options(PythonQt PRIVATE $<$:/bigobj> ) +target_link_libraries(PythonQt PUBLIC Qt${PythonQt_QT_VERSION}::Core) foreach(qtlib ${qt_required_components}) - target_link_libraries(PythonQt PUBLIC Qt${PythonQt_QT_VERSION}::${qtlib}) + target_link_libraries(PythonQt PRIVATE Qt${PythonQt_QT_VERSION}::${qtlib}) endforeach() target_link_libraries(PythonQt PUBLIC @@ -367,6 +368,23 @@ install(TARGETS PythonQt install(FILES ${headers} DESTINATION ${PythonQt_INSTALL_INCLUDE_DIR}) +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/PythonQtConfig.cmake" + INPUT "${PROJECT_SOURCE_DIR}/PythonQtConfig.in" +) + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/PythonQtConfigVersion.cmake" + VERSION ${PythonQT_VERSION} + COMPATIBILITY AnyNewerVersion +) + +install (FILES + "${CMAKE_CURRENT_BINARY_DIR}/PythonQtConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/PythonQtConfigVersion.cmake" + DESTINATION ${PythonQt_INSTALL_CONFIG_DIR}) + install(EXPORT PythonQt-targets DESTINATION ${PythonQt_INSTALL_CONFIG_DIR} ) diff --git a/thirdparty/pythonqt/PythonQtConfig.in b/thirdparty/pythonqt/PythonQtConfig.in new file mode 100644 index 0000000..cbfc278 --- /dev/null +++ b/thirdparty/pythonqt/PythonQtConfig.in @@ -0,0 +1,13 @@ +include(CMakeFindDependencyMacro) + +# - Config file for the GTlabPython package +include("${CMAKE_CURRENT_LIST_DIR}/PythonQt-targets.cmake") + +# create alias +if (NOT TARGET PythonQt::PythonQt) + add_library(PythonQt::PythonQt INTERFACE IMPORTED) + + set_target_properties(PythonQt::PythonQt PROPERTIES + INTERFACE_LINK_LIBRARIES "PythonQt" + ) +endif() From 2f4d090bb651eece9b4ed058e6a202eec6909ef8 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 29 May 2024 14:43:38 +0200 Subject: [PATCH 031/130] Improved Finding PythonQt includes --- cmake/FindPythonQt.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindPythonQt.cmake b/cmake/FindPythonQt.cmake index ab7f195..abf6eae 100644 --- a/cmake/FindPythonQt.cmake +++ b/cmake/FindPythonQt.cmake @@ -2,7 +2,7 @@ include(CMakeFindDependencyMacro ) find_dependency(Python3 COMPONENTS Development) # Look for the header file. -find_path(PythonQt_INCLUDE_DIR NAMES PythonQt.h PATH_SUFFIXES include) +find_path(PythonQt_INCLUDE_DIR NAMES PythonQt.h PATH_SUFFIXES include include/PythonQt) set (PYTHONQT_LIBNAME_SUFFIX ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}) set (PYTHONQT_LIBNAME_SUFFIX_ALT ${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}) From 6cc92d8880f4b635dc9c52876787011b8c195398 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Tue, 4 Jun 2024 11:45:35 +0200 Subject: [PATCH 032/130] Fixed crash in findGtTask in debug build Closes #278 --- src/module/utilities/gtpy_processdatadistributor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/module/utilities/gtpy_processdatadistributor.cpp b/src/module/utilities/gtpy_processdatadistributor.cpp index 5253bf9..03058a4 100644 --- a/src/module/utilities/gtpy_processdatadistributor.cpp +++ b/src/module/utilities/gtpy_processdatadistributor.cpp @@ -62,7 +62,11 @@ GtpyProcessDataDistributor::taskElement(const QString& name) task->moveToThread(m_pythonTask->thread()); - task->setParent(m_pythonTask); + // We need to run setParent from the main thread, where the python task is living + // Otherwise qt will cause problems + QMetaObject::invokeMethod(m_pythonTask, [this, task](){ + task->setParent(m_pythonTask); + }, Qt::BlockingQueuedConnection); return task; } From 7c21983c92d9fcc7fd600bdc000da3ce54963fe4 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 5 Jun 2024 09:13:26 +0200 Subject: [PATCH 033/130] Updated changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6160db7..f3989aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + - Fixed crash of findGtTask in debug mode - #281 + ## [1.6.0] - 2024-05-03 ### Changed - Improved the performance of the python console output - #270 From c0a51e7a70598fa4e1e20f7d4f0d1e5c2725c6b4 Mon Sep 17 00:00:00 2001 From: "Schmeink, Jens" Date: Wed, 5 Jun 2024 09:18:15 +0000 Subject: [PATCH 034/130] Resolve "Decorator to set object link properties has problems with heritage" --- CHANGELOG.md | 1 + src/module/utilities/gtpy_decorator.cpp | 43 +++++++++++++++++-------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3989aa..9eb45a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed + - Fixed setting ObjectLinkProperties of derived objects - #279 - Fixed crash of findGtTask in debug mode - #281 ## [1.6.0] - 2024-05-03 diff --git a/src/module/utilities/gtpy_decorator.cpp b/src/module/utilities/gtpy_decorator.cpp index f356118..c9f376c 100644 --- a/src/module/utilities/gtpy_decorator.cpp +++ b/src/module/utilities/gtpy_decorator.cpp @@ -1047,12 +1047,9 @@ GtpyDecorator::setPropertyValue(GtObject* obj, const QString& id, return; } - GtObjectLinkProperty* objLinkProp = - qobject_cast(prop); - - if (objLinkProp) + if (auto* objLinkProp = qobject_cast(prop)) { - GtObject* dataObj = qvariant_cast(val); + auto* dataObj = qvariant_cast(val); if (!dataObj) { @@ -1064,17 +1061,28 @@ GtpyDecorator::setPropertyValue(GtObject* obj, const QString& id, if (dataObj) { - QStringList allowedClasses = objLinkProp->allowedClasses(); - QString objClassName = QString::fromUtf8( dataObj->metaObject()->className()); +#if GT_VERSION < GT_VERSION_CHECK(2, 0, 0) + QStringList allowedClasses = objLinkProp->allowedClasses(); if (allowedClasses.contains(objClassName)) { val = dataObj->uuid(); } +#else + if (objLinkProp->isAllowed(objClassName)) + { + val = dataObj->uuid(); + } +#endif + else { +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) + QStringList allowedClasses = objLinkProp->allowedClasses(); +#endif + QString output = QStringLiteral("ERROR: ") + objClassName + QObject::tr(" is not an allowed class " @@ -1245,10 +1253,7 @@ GtpyDecorator::setPropertyValue(GtAbstractProperty* prop, return; } - GtObjectLinkProperty* objLinkProp = - qobject_cast(subProp); - - if (objLinkProp) + if (auto* objLinkProp = qobject_cast(subProp)) { GtObject* dataObj = qvariant_cast(val); @@ -1262,17 +1267,29 @@ GtpyDecorator::setPropertyValue(GtAbstractProperty* prop, if (dataObj) { - QStringList allowedClasses = objLinkProp->allowedClasses(); - QString objClassName = QString::fromUtf8( dataObj->metaObject()->className()); + +#if GT_VERSION < GT_VERSION_CHECK(2, 0, 0) + QStringList allowedClasses = objLinkProp->allowedClasses(); if (allowedClasses.contains(objClassName)) { val = dataObj->uuid(); } +#else + if (objLinkProp->isAllowed(objClassName)) + { + val = dataObj->uuid(); + } +#endif + else { +#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0) + QStringList allowedClasses = objLinkProp->allowedClasses(); +#endif + QString output = QStringLiteral("ERROR: ") + objClassName + QObject::tr(" is not an allowed class " From 8227e4fde0e5c445d9e30ac1fe35240c2ed86dd7 Mon Sep 17 00:00:00 2001 From: "Siggel, Martin" Date: Thu, 6 Jun 2024 07:11:13 +0000 Subject: [PATCH 035/130] Resolve "Fix CPPcheck problems" --- .../items/gtpy_collapsiblebrowseritem.cpp | 17 ++++++++------ .../browser/items/gtpy_rootbrowseritem.cpp | 21 ++++++++---------- .../items/gtpy_collapsiblelocalitem.cpp | 15 +++++++------ .../utilities/gtpy_calculatorfactory.cpp | 1 + src/module/utilities/gtpy_contextmanager.cpp | 2 +- src/module/utilities/gtpy_decorator.cpp | 17 +++++--------- src/module/utilities/gtpypp.h | 9 +++++++- .../pythonextensions/gtpy_extendedwrapper.cpp | 3 +-- src/module/widgets/gtpy_completer.cpp | 2 +- src/module/widgets/gtpy_completer.h | 2 +- src/module/widgets/gtpy_console.cpp | 2 -- .../python_task/gtpy_taskwizardpage.cpp | 22 +++++-------------- 12 files changed, 52 insertions(+), 61 deletions(-) diff --git a/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.cpp b/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.cpp index 3d504af..69a1b07 100644 --- a/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.cpp +++ b/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.cpp @@ -9,6 +9,8 @@ #include "gtpy_collapsiblebrowseritem.h" +#include + GtpyCollapsibleBrowserItem::GtpyCollapsibleBrowserItem(QString const& ident) : GtpyAbstractBrowserItem(), m_ident(ident) { @@ -105,15 +107,16 @@ GtpyCollapsibleBrowserItem::selectedItems() GtpyCollapsibleBrowserItem* GtpyCollapsibleBrowserItem::collapsibleChild(const QString& ident) { - foreach (GtpyAbstractBrowserItem* item, m_childItems) + auto iter = std::find_if(std::begin(m_childItems), + std::end(m_childItems), + [&ident](const auto* item) { - if (item->ident() == ident && item->isCollapsible()) - { - return dynamic_cast(item); - } - } + return item->ident() == ident && item->isCollapsible(); + }); + + if (iter == m_childItems.end()) return nullptr; - return Q_NULLPTR; + return dynamic_cast(*iter); } void diff --git a/src/module/collection/browser/items/gtpy_rootbrowseritem.cpp b/src/module/collection/browser/items/gtpy_rootbrowseritem.cpp index e55945d..99ada72 100644 --- a/src/module/collection/browser/items/gtpy_rootbrowseritem.cpp +++ b/src/module/collection/browser/items/gtpy_rootbrowseritem.cpp @@ -55,21 +55,18 @@ GtpyRootBrowserItem::createChild(int typeId, const QString& ident) GtpyCollapsibleBrowserItem* GtpyRootBrowserItem::child(int typeId) { - GtpyCollapsibleBrowserItem* item = Q_NULLPTR; + if (!m_itemTypes.contains(typeId)) return nullptr; - if (m_itemTypes.contains(typeId)) + auto iter = std::find_if(std::begin(m_childItems), + std::end(m_childItems), + [typeId](const auto* child) { - foreach (GtpyAbstractBrowserItem* child, m_childItems) - { - if (child->typeId() == typeId) - { - item = dynamic_cast(child); - break; - } - } - } + return child->typeId() == typeId; + }); - return item; + if (iter == m_childItems.end()) return nullptr; + + return dynamic_cast(*iter); } void diff --git a/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.cpp b/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.cpp index 00e9d4d..aa730e9 100644 --- a/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.cpp +++ b/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.cpp @@ -60,13 +60,14 @@ GtpyCollapsibleLocalItem::appendChild(GtpyAbstractLocalItem* item) GtpyCollapsibleLocalItem* GtpyCollapsibleLocalItem::collapsibleChild(const QString& ident) { - foreach (GtpyAbstractLocalItem* item, m_childItems) + auto iter = std::find_if(std::begin(m_childItems), + std::end(m_childItems), + [&ident](const auto* item) { - if (item->ident() == ident && item->isCollapsible()) - { - return dynamic_cast(item); - } - } + return item->ident() == ident && item->isCollapsible(); + }); + + if (iter == m_childItems.end()) return nullptr; - return Q_NULLPTR; + return dynamic_cast(*iter); } diff --git a/src/module/utilities/gtpy_calculatorfactory.cpp b/src/module/utilities/gtpy_calculatorfactory.cpp index ef0e164..6423209 100644 --- a/src/module/utilities/gtpy_calculatorfactory.cpp +++ b/src/module/utilities/gtpy_calculatorfactory.cpp @@ -96,6 +96,7 @@ GtpyCalculatorFactory::createCalculator(const QString& className, parent->appendChild(calc); } + // cppcheck-suppress unknownMacro Py_END_ALLOW_THREADS return calc; diff --git a/src/module/utilities/gtpy_contextmanager.cpp b/src/module/utilities/gtpy_contextmanager.cpp index 3f5cf56..6373b41 100644 --- a/src/module/utilities/gtpy_contextmanager.cpp +++ b/src/module/utilities/gtpy_contextmanager.cpp @@ -1043,7 +1043,7 @@ GtpyContextManager::initLoggingModuleC() initExtensionModule(GtpyGlobals::MODULE_GtLogging_C, &GtpyLoggingModule::GtpyLogging_Module); #else initExtensionModule(GtpyGlobals::MODULE_GtLogging_C, - GtpyLoggingModule::GtpyLoggingModule_StaticMethods)); + GtpyLoggingModule::GtpyLoggingModule_StaticMethods); #endif } diff --git a/src/module/utilities/gtpy_decorator.cpp b/src/module/utilities/gtpy_decorator.cpp index c9f376c..fabb434 100644 --- a/src/module/utilities/gtpy_decorator.cpp +++ b/src/module/utilities/gtpy_decorator.cpp @@ -804,22 +804,17 @@ GtpyDecorator::hasWarnings(GtProcessComponent* comp) } if (comp->currentState() == GtProcessComponent::WARN_FINISHED || - comp->currentState() == GtProcessComponent::FAILED) + comp->currentState() == GtProcessComponent::FAILED) { return true; } - foreach (GtProcessComponent* child, - comp->findChildren()) - { - if (child->currentState() == GtProcessComponent::WARN_FINISHED || - child->currentState() == GtProcessComponent::FAILED) - { - return true; - } - } + auto childs = comp->findChildren(); - return false; + return std::any_of(std::begin(childs), std::end(childs), [](auto* child){ + return child->currentState() == GtProcessComponent::WARN_FINISHED || + child->currentState() == GtProcessComponent::FAILED; + }); } diff --git a/src/module/utilities/gtpypp.h b/src/module/utilities/gtpypp.h index 09b89aa..057c673 100644 --- a/src/module/utilities/gtpypp.h +++ b/src/module/utilities/gtpypp.h @@ -169,12 +169,14 @@ inline PyPPObject PyPPList_GetItem(const PyPPObject& list, Py_ssize_t index) return PyPPObject::Borrow(PyList_GetItem(list.get(), index)); } +// cppcheck-suppress constParameter inline int PyPPList_Sort(PyPPObject& o) { return PyList_Sort(o.get()); } // does not steal! +// cppcheck-suppress constParameter inline int PyPPList_Append(PyPPObject& list, const PyPPObject& item) { return PyList_Append(list.get(), item.get()); @@ -192,6 +194,7 @@ inline PyPPObject PyPPDict_Copy(const PyPPObject& o) return PyPPObject::NewRef(PyDict_Copy(o.get())); } +// cppcheck-suppress constParameter inline int PyPPDict_Merge(PyPPObject& a, const PyPPObject& b, int override) { return PyDict_Merge(a.get(), b.get(), override); @@ -207,12 +210,13 @@ inline PyPPObject PyPPDict_GetItem(const PyPPObject& dict, const char* s) return PyPPDict_GetItem(dict, PyPPObject::fromString(s)); } - +// cppcheck-suppress constParameter inline int PyPPDict_SetItem(PyPPObject& dict, const char *key, const PyPPObject& val) { return PyDict_SetItemString(dict.get(), key, val.get()); } +// cppcheck-suppress constParameter inline int PyPPDict_SetItem(PyPPObject& dict, const PyPPObject& key, const PyPPObject& val) { return PyDict_SetItem(dict.get(), key.get(), val.get()); @@ -228,6 +232,7 @@ inline PyPPObject PyPPDict_Keys(const PyPPObject& p) return PyPPObject::NewRef(PyDict_Keys(p.get())); } +// cppcheck-suppress constParameter inline int PyPPDict_DelItem(PyPPObject& p, const char *key) { return PyDict_DelItemString(p.get(), key); @@ -256,6 +261,7 @@ inline PyPPObject PyPPTuple_GetItem(const PyPPObject& tuple, Py_ssize_t pos) } // set item steals the object, so we need to move in o +// cppcheck-suppress constParameter inline int PyPPTuple_SetItem(PyPPObject& p, Py_ssize_t pos, PyPPObject&& o) { return PyTuple_SetItem(p.get(), pos, o.release()); @@ -377,6 +383,7 @@ inline PyPPObject PyPPThreadState_GetDict() return PyPPObject::Borrow(PyThreadState_GetDict()); } +// cppcheck-suppress constParameter inline int PyPPModule_AddObject(PyPPObject& module, const char *name, PyPPObject&& value) { auto ret = PyModule_AddObject(module.get(), name, value.get()); diff --git a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp index d403628..a4b7b5c 100644 --- a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp +++ b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp @@ -287,8 +287,7 @@ GtpyExtendedWrapper_setattro(PyObject* obj, PyObject* name, PyObject* value) { if (PyObject_TypeCheck(value, &GtpyExtendedWrapper_Type)) { - GtpyExtendedWrapper* wrapper = (GtpyExtendedWrapper*)value; - value = (PyObject*)wrapper->_obj; + value = (PyObject*)reinterpret_cast(value)->_obj; } GtpyDecorator decorator; diff --git a/src/module/widgets/gtpy_completer.cpp b/src/module/widgets/gtpy_completer.cpp index 276e52c..dbe86a6 100644 --- a/src/module/widgets/gtpy_completer.cpp +++ b/src/module/widgets/gtpy_completer.cpp @@ -355,7 +355,7 @@ GtpyCompleter::setCompletionPrefix(const QString& prefix) } int -GtpyCompleter::compareStrings(QString s1, QString s2) +GtpyCompleter::compareStrings(const QString& s1, const QString& s2) { int i; diff --git a/src/module/widgets/gtpy_completer.h b/src/module/widgets/gtpy_completer.h index 97f0063..06baa2e 100644 --- a/src/module/widgets/gtpy_completer.h +++ b/src/module/widgets/gtpy_completer.h @@ -117,7 +117,7 @@ class GtpyCompleter: public QCompleter * @param s2 String 2 * @return Size of the equal part */ - int compareStrings(QString s1, QString s2); + int compareStrings(const QString& s1, const QString& s2); /// Id of Context int m_contextId; diff --git a/src/module/widgets/gtpy_console.cpp b/src/module/widgets/gtpy_console.cpp index df5614e..af9fc2a 100644 --- a/src/module/widgets/gtpy_console.cpp +++ b/src/module/widgets/gtpy_console.cpp @@ -385,8 +385,6 @@ GtpyConsole::keyPressEvent(QKeyEvent* e) { m_cpl->getPopup()->hide(); } - - eventHandled = true; } } diff --git a/src/module/wizards/python_task/gtpy_taskwizardpage.cpp b/src/module/wizards/python_task/gtpy_taskwizardpage.cpp index 0ead51b..b933d32 100644 --- a/src/module/wizards/python_task/gtpy_taskwizardpage.cpp +++ b/src/module/wizards/python_task/gtpy_taskwizardpage.cpp @@ -370,11 +370,7 @@ GtpyTaskWizardPage::configCalculator(GtCalculator* calc) if (calcNameNew != calcNameBefor) { - QString headline; - QString className = calc->metaObject()->className(); - headline = calc->objectName(); - onProcessComponentRenamed(className, calcNameBefor, calcNameNew); } @@ -622,20 +618,14 @@ GtpyTaskWizardPage::deleteProcessElements(const QList& indexList) QList pComList = m_task->findChildren(obj->objectName()); - foreach (GtProcessComponent* comp, pComList) - { - if (comp == obj) - { - delete comp; - comp = nullptr; + auto objIter = std::find(std::begin(pComList), std::end(pComList), obj); + if (objIter == std::end(pComList)) continue; - if (m_calcModel && m_treeView) - { - m_treeView->expandAll(); - } + delete *objIter; - break; - } + if (m_calcModel && m_treeView) + { + m_treeView->expandAll(); } } } From c0c74698a371895edd37a272909982a8715fcba8 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 29 May 2024 15:04:27 +0200 Subject: [PATCH 036/130] Removed outdated files --- .reuse/dep5 | 19 + LICENSES/Apache-2.0.txt | 202 +++++++++ LICENSES/CC-BY-SA-4.0.txt | 428 ++++++++++++++++++ LICENSES/CC0-1.0.txt | 121 +++++ src/setup_module/CMakeLists.txt | 1 - .../gtps_pythonpreferencepage.cpp | 2 + src/setup_module/gtps_pythonpreferencepage.ui | 9 +- src/setup_module/resources.qrc | 6 - .../resources/python-icon-tinted_128.png | Bin 5285 -> 0 bytes src/setup_module/resources/python_icon_bw.png | Bin 3478 -> 0 bytes tests/unittests/runUnittestsQt512.bat | 11 - tests/unittests/runUnittestsQt515.bat | 8 - tests/unittests/unittests.pro | 82 ---- 13 files changed, 774 insertions(+), 115 deletions(-) create mode 100644 .reuse/dep5 create mode 100644 LICENSES/Apache-2.0.txt create mode 100644 LICENSES/CC-BY-SA-4.0.txt create mode 100644 LICENSES/CC0-1.0.txt delete mode 100644 src/setup_module/resources.qrc delete mode 100644 src/setup_module/resources/python-icon-tinted_128.png delete mode 100644 src/setup_module/resources/python_icon_bw.png delete mode 100644 tests/unittests/runUnittestsQt512.bat delete mode 100644 tests/unittests/runUnittestsQt515.bat delete mode 100644 tests/unittests/unittests.pro diff --git a/.reuse/dep5 b/.reuse/dep5 new file mode 100644 index 0000000..1bb5be7 --- /dev/null +++ b/.reuse/dep5 @@ -0,0 +1,19 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: GTlabPython +Upstream-Contact: <> +Source: + +Files: .github/* +Copyright: 2023 German Aerospace Center (DLR) +License: Apache-2.0 + + +Files: images/*.png +Copyright: 2023 German Aerospace Center (DLR) +License: CC-BY-SA-4.0 + + +# sample test project files +Files: tests/**/*.gt* +Copyright: 2023 German Aerospace Center (DLR) +License: CC0-1.0 diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSES/Apache-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSES/CC-BY-SA-4.0.txt b/LICENSES/CC-BY-SA-4.0.txt new file mode 100644 index 0000000..2d58298 --- /dev/null +++ b/LICENSES/CC-BY-SA-4.0.txt @@ -0,0 +1,428 @@ +Attribution-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-ShareAlike 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-ShareAlike 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. + diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt new file mode 100644 index 0000000..1625c17 --- /dev/null +++ b/LICENSES/CC0-1.0.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. \ No newline at end of file diff --git a/src/setup_module/CMakeLists.txt b/src/setup_module/CMakeLists.txt index 8616295..1195cd8 100644 --- a/src/setup_module/CMakeLists.txt +++ b/src/setup_module/CMakeLists.txt @@ -31,7 +31,6 @@ set(SOURCES gtps_pythoninterpreter.cpp gtps_pythonpreferencepage.cpp gtps_systemsettings.cpp - resources.qrc gtps_pythonpreferencepage.ui ) diff --git a/src/setup_module/gtps_pythonpreferencepage.cpp b/src/setup_module/gtps_pythonpreferencepage.cpp index fa95a8d..f210cff 100644 --- a/src/setup_module/gtps_pythonpreferencepage.cpp +++ b/src/setup_module/gtps_pythonpreferencepage.cpp @@ -22,6 +22,8 @@ GtPythonPreferencePage::GtPythonPreferencePage() : ui->setupUi(this); + ui->iconLabel->setPixmap(gt::gui::icon::python().pixmap(32,32)); + connect(ui->btnSelectPyExe, &QPushButton::clicked, this, &GtPythonPreferencePage::onBtnSelectPyExePressed); diff --git a/src/setup_module/gtps_pythonpreferencepage.ui b/src/setup_module/gtps_pythonpreferencepage.ui index 4e4ab8b..38e093d 100644 --- a/src/setup_module/gtps_pythonpreferencepage.ui +++ b/src/setup_module/gtps_pythonpreferencepage.ui @@ -30,7 +30,7 @@ - + 0 @@ -46,9 +46,6 @@ - - :/resources/python_icon_bw.png - true @@ -155,8 +152,6 @@ - - - + diff --git a/src/setup_module/resources.qrc b/src/setup_module/resources.qrc deleted file mode 100644 index 50ad707..0000000 --- a/src/setup_module/resources.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - resources/python-icon-tinted_128.png - resources/python_icon_bw.png - - diff --git a/src/setup_module/resources/python-icon-tinted_128.png b/src/setup_module/resources/python-icon-tinted_128.png deleted file mode 100644 index c7784b5e1343cdc6b9df1b165616e04a842d3d88..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5285 zcmV;W6k6+vP)EX>4Tx04R}tkv&MmP!xqvQ$^9LgB?U1GE{M}C@SJ8RV;#q(pG5I!Q`cX(4-+r zad8w}3l9D)RvlcNb#-tR1i>E=M<*vm7b)?+q|hS92bcG8-aCi;?gNBciK%AW1fXh` zk%&gbbY@lTcttmQsm3uXF;kBv7gO+DU-$6w{VvS2yzl+FdX%im0G~)a$8^IY-XNaY zv~DP$4;f@IUxHTQfH`=_UmtK>Lere+&a1yFk5a+uz5wT|WW*&%l+|^p|VE>?i5f zrWQH^`nG|K>!v2}0hc?#z>_W+k|X)4gj^1IKcjET0R6W>*P1)G#yL(OfE3MY`35*R z1V-|dz3%bu&epm8d#5qKAHsuj$E3MWApigX24YJ`L;wH)0002_L%V+f000SaNLh0L z01ejw01ejxLMWSf00007bV*G`2j&Y92Q4e2*@2q?01}}|L_t(|+U=ctkQ~)@#=mo? zXWy&0V`+sfq>=z5vWgg_4)2}7BZ5wZis5U>d-HdVncJE}@35|TKsiYYrWNx5u5 zu|vv%7>tO7jKjkgh{Cu)2?!w&yV8P$7QMBS_AxuteZTxM@1E|Sp55-5+0oppt=j3H zp6HQfIkvU2*hr}EW&LJ^V1I-{>0ZahUOt2MNPXu6s93(Id zG6rxEWE{Y0kS9R)k@_%z{UCdoi1+NfeaX>kx@W0YF&6%J_otM|Qj$w7Vu=VkNi+k1 z1^^HwKma7tTay21o!XGvLIPm+jj8?29GHDS$bOKoL9m^c_58lum%LsVDAl^Q^vu-2 zO`7~NiHoyh|ZeAWG#&70rfZb-ErmCvr3@F&-8r7A|3?MmMeg>K(>8F#mNz2 zEaCuwPJga`*gSFM?gJavC2C%vt}Q)(seyk0Axya`FL5$D*j*d*J3JG2N*2dvafRZf zkK0DeT>HVFeYU@51?t+;bDajZWIKJ7;*1pvN*5>nzL%x3W%a(>E{%uTPpT5)EZMqu zf(Cx#)alM~2VoIg&Q-DSLNng8KpX&A&e-6CVfR%<1d3Vw5`d0urx!p$jKGfotkL9^ znz#+Xi-C(ndO?9rK%0okQ>~x#(6(hY=i)Bj((@vT&pL^ti4QIEnmudJd(UB@dWR+- z0-!>`X-9Fg`*ndSC*vP?Fdn<~!+SojYr=v$H+L%#m%CVwWeBc!5(fbGtUYfdi0@`Q z(@tz*i9;7ZO91GS#^$9pt+WCd~Z+ab1GyabtheE??(mn3DS(a(8 zs~LebILD3HNW56=_?{aV4gh#9KO&TBIV?8T@h?vDpKEFf5?bAe4Zta1pFo~;gaUUS zbB|S{7AIF^nO!pik!W$lX${Qr^%=mt(Gr^%PUnkB6vjGd@krf#?vGxWQWFA+NYp*Y z#+y1fcY9vbykESt0A#0caRA>q&8*8R91Fo=%*4FUoKO=2nVMb+(9RKy-*h{6{!@Dz z0R9A^I1wAd#c4;ESd#-)Cvh@kKjMM;zkKgI^Pkw=l4m)Oy)}Ve!?h8E%ycKgTO6m-Bks%XY9*aC2b#Gz(G-k;mvcxp@n&3k;O(caRs#sa@6kmV$2=H9o(WOUFu zeCCSNBF@AnHewU;2L>s>>D<*tYY;@SUoN zIA0<0h6XMHv*Hx10JUYOvm0`*V)Vrx0oN0hiqj#GTkc2cY_~-KJmM-)*Os1dlh~+} zZ^W2tr)@V(4;SHh+m*;pdl6ee2~v9sPZy2}mEj`JjQ}2SE4v*><+;J&G{X@m&$+k^ z)(Zq$w7GjefQJe@-6s@OTX}8)ps=Fi*e_SRWKz=_ns6(Sb2P-}iPQEG`B{Y1enB9AU;cI@ z=f(Be`v?%HN&h$x ze0ZJ!SCe8GBs z#?DP>-lu`vnKPvjq}ABF$smy+&{)BGf&|F#GZFtzI`CFg>p49#VIZMbDZwo!c^!bL zBNY0ynqn@^K58%sj1Xwdk2z&4&)pBLZ|c2k#qS)xtu2P&N)5~s;GE%$O*ahkW0RL2IH5%6O*PWd}SfFl5=7tD)9?{bh$LqzAYd2W4haVdcG^4AcX@8cgc7%y?g zIyEp_5Fp@WA0P-t@Zgw;%?qdP=`w1mLFJa=R7`js!_fWR^&SNDxn(xnA8H85HbD2#F0szih2?lR$Y43NJ` zU&NkMvFR4^6o7_maA}nU0ViRyF^GCsSrVY+zxUp`tS^hRxF5i@ItaLn0|2VI!RQ4r z7&) z@A{Rm=UC5eNIsKU2Z78N!dXz2>hRx%T%P-q?NhD~%cbSkKj&J2_TkcUt)`eu%gmRJ z!fL!+TJD!cGgDbAuZ3EktMx7$94r_wATXLdTB#u5bzTJkVi>Oi(4m#*D)mwN#0iaa zg0>p%U^T@+pj2^K#HGQ>rH#UB?B`Vg(7o=0qaa`R#OX1W=kiSEgo2r83kc*2<0Xz$ zj7uMrozu|z*|5rUX=T@G5um*e0>!MA`4$8KqSO<~!EZQEyVXI!9R%FO(YcR6_T1FD z8`Rszh|__JQ;JKY%Q1GB=C70Tt;XGTxm!)zsg+_ic5(77D0O%L>Y4x@Yq3Wi1bn$P z`)tpd2Ss9O0gPOfdF9dmoMG{ zkp}`V&#i-it2kcGaWN(H#NodZQO^Wco@-fk5b){Jd|0e?r6VZ*(X~^e63m9d*||<0Ir?$(6(8CTnFGP z03Fbr0bpW*Wu=ljWGePpg{zJSSy|)JNkariGNSmwlq;A&lczu^)IEO=V4~H3EY1 z-^wl!QNCh9GuUO5&n^ophR>y1jS~n6aM!Cx23I+W>E=qaFykKMoa*HomAZTR^wy&_ zAP|EF0k2}gE)rdSK)^3PyMaK0+yG$w3uLB#6(A@OD0hv3Q=Tzz-lldSAs7&F%?Jc! zHO0m@H5r4d;i&<5JX#Kp;>|n4n#nE;AS!l@uo+5D3(zjWQz;T2qy@AXeYh zz#xF{5nK-7JOHZ&@-TpeuF#Oms1|Xm00a(11gk$Yqis*l=57ElJl}WbQH1!ASyfq( zRh?46Bb$7Hx31GX&0Q^i%#2`b-L5r-ai~xxtpO^2r5{eR>S~$6> zza}i`Q?1cn&1}x9Dry9fTy@e%yTH-C5wE2zZ2Su}t;sL}Jn01jM0slj1X%Z*j|V)9 z`k(#i%v=D=o#QGVuc>iRM6i+BMIQZGjZY95Wo6B@gyw^NLkY(@zW+IRra=iFf%9XV zryG?#RZ{{jp4PI1fL!xpFF z0s+8fpJ;hc1D6tbGGq`4#Bd1wOH)K$vAU!EP+2lBsG|1Lp@CHb`5}M{t8i-Ijfmh| zt2)|WE@z)qUFq119}hGr;FgHUH!bp_FhHQR+#z1l#Dkran>K|t7#&vvrCZ-nLiU^* zSqb2e39JP$wOk;e1ihMgg22zOnc2RxlKn6)iZ3^Pcq%%vA+l5xS0Py!eknmCK&v?k z;AH~81@PNSi!$y6vbWcd4K?@2txkb-S>z%mn4^=6jL(Mm`g4Z?d<OaQ1Ksl{*bGJIaW4lc4S|$r7Hp$FZL!Rp! zPyjHaIVw{cB62up%A^J*$44xg5RC``^v5j$fL22ly`R3}1SUo!oYau~!Qj&gi&GmT z+;=8{DUA^x8!c)(5H+_wiiC#hk6Y4eC}}g4v=}0%6Iz-hN(M|VO%ahnQ_GZw|?xHi|0IY4Q5wno%V>En1tQbjsrN z&NcIOO$ij4G)<=8^Sz8H8dNiyqms~6lNywy1<{0Riz;c3h**Sbiik9-BQ6h1R5)nviR3UCrS`38|i_#cL zcG{4s(GU?@8cdM1G?_^K9}#F%CxuC9azvAch>i$!->}I~HW@mqppV2XJ!onwfj$-2 rY1gL}L~BqV-?5#Cez-vg=>q>B4)^3(t_cHO00000NkvXXu0mjf45qd& diff --git a/src/setup_module/resources/python_icon_bw.png b/src/setup_module/resources/python_icon_bw.png deleted file mode 100644 index 260fcfa1a2af44f7429ac01816bf05b5404d67a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3478 zcmV;H4QcX;P)^)!y_dIqF4kZ1oFgWLqay$U;nt9&2F;n-o)K| z?(W{t%x~u2?A<-zJ?ESI*mKVBC=nsiP)bb$3W09}Gl3aE4lvOdX}-wxz2zow%NH#` zGtdZJ2EGI?0H2D;SC)MVi%{`y0HxFz;C|qHz;}Vgz=RkT*9x2lJ_bGl{w*S%F)GUv z;?e+0sT|;O;QPRXK)NO=-M~M9qrgECY0{))#KesOlu{|cqrg+ZBfx0AiiY3;-UnU< z-WL(CW<92`y#bU`F5suYFMv6k<(Q=o*aQ4UM0$0L35Tr>pp@DGyhQvo{9x*UUy8^( zx`o^hTN=Q3jo%0SP`8#S@fNVdj`s+*Gk{WR8E_DoqFYOpxe7ccBA@6M5=e?}0f8u` zHUbqSUgHBy1uB(N>vanW#5QLDrBpG-<5Ze%EivX6uueqEbPEBSoB@lOllh-eSsJwU?6v(G*&9*;*t z(c0Q7t5>fM`+gh75#9AJBKi#gEQ?fGPdxEN$c7K3v$IncE?lU)QHL8#wb#FP0mkFr zZ7V4wBSWrTyB5&^A|hpFWx5-5xUpAv{oCOl;K6V&u358&+}vDKAGC7iN~TVo8Wm9% zu}Zf9I~ZVExEJTopKtnulv2!_H}4w@vJmYzf_5;#*l;iUE)%91?(v!l``xX;4h9HI zZEdaTV?~5>=g!4YP2ypD1C*7OaqZeQQ^%HX;?c29YPft(C#&2$JmX#}4YH!SVG=TQL0Hu^^0kdb% zrlh2VqM{-uOqf7@eLbb6rR?3imzI{6SjvnUBBFGbA6EuQM06X#_BVkJvBfb!lH(X4 z$#D#jA+h`se8g5bXx-`rLuu{ zfQ)FWau{H+0it*Y=qDXGsFa#?y92_V0rr!avvh649e3OjwBO#|9*bh~FrL~%64C&^ z>wcmnXRs~f#*OoD_xASE*%`BhV?Vy#{lE|d_;T{>j+GLJ0Rj!s-rnB-xE(9@_}Vsz zP-lQGz}#3WaWJ^^&O80vH*VaBb#ZfmpA7zEkO7p@GxGCTD{(LwKYqM_`|Gd2wxY;i z`O@wA8GHsa@w=Kv1}{$a2Ip0YxPgF&DHE?&H7Rk1${-0>U0 zmzwPnt5i4y8{pEVOI8)TKJa&ez%#((*f0HRLNjybO#ilp21o@q_U{B5V1rc(93Uqr zhrGNz|9)Lvot4E8q^k2hdyWCRut67Tvc$S|>-^oo9UUDqYSbtz%kKm-0=t9nM_J6crx;+T?n+6PNKa3fnwlDa<5yHv=+?9i zjJ0ia3rULDw{Kt2fB%XVD|Bmm35?}TbPGxNC@CokYWxES4rtc|ya7;Y10e|;E|*JQ zeDTGg#{cZI&t&Y_vD&p^ta(VS4TL0Q6crW8nKNgC8vpwB>vqa#cm|BcjC2c0n8?k| zm2KO$$%zvuWH1*lT#$l-0__?D;);ub1(Y3zK}JRfQ>ILzprC-+vu9ISSjh6_%b7bj z^nj{EhYqo0#||1A8Z1^CmP{8$|8U$fdh}@W^75EGc{17A*<@#DGiJ;fGBY#D%E}rt z?P}b(aS@Y2WM*cPmKHn-%H?vAm6b($dODeznM|BGkx7##F=osdQ#xyFYuUAH7p0}8 z!~25PkfwlMV3ckpkyx-`0ma3|EL*mWxpU`IP*6Z>sy)5i-rmmP!-sk0l~*`^{J3s8 z;po$zBPbmC`T0Ea%rk7+vc8!s;a7}tgNKEy4vdQ-4Wvgda&92 zzwzV8vuDp9o_zAjA*b@e^!4@8)YL>%Qxk5to6gQoIyyRnCR&P!sd4viw|mI^JdekN z+wG>iyPK}AF524KXliPrxw)C9rY5dmzdo`rX%BAM&H(Gzujl2LUuMdbq0*uBNW8j=H)!8XFt&dgEfHb~|zlZ1fnob?erkesU3!#>Pf@;e{7u)~s3D^(A0j z0jRNo5ZStQtMv8t`5WHj@yPDoyCowdL%X&Fj%t8^>K0O1SSVdxUH-;zZEcnN?z>NS zOP%W`7)@djw_4&J$QXV5i&^XAREDQ%N>NmiVBS&;sMl#0a z{$b%wRu`U?l_lNX-F^dX*swu&Wh7fPO2E{x|6(y~*RJ*VymfVTQC3!FwS;7+8V06@ zeQb5e@et4j}@99daeX?5`q@Gk%@)5Fu!(t?(OwZZV{ zWQ$H9-G2`tBAxg~h+4sd1q=LXQbmN*r%zi|w1dHiBGL`P8A6U)Rr;JcbNt&EFJ81N zMVi9^@Ahv58sKjjV*_H2rtDY_20g%${vE#oM5G1yyA=wiO`GQ5wlF!8gTYY|Y3|<{ zoG0*AD-=whKHa~4`SN8eigXy@Pk}pw4e%buVo)(9Fgun-88RIV>VOXd{}5yVF`fy3 z7i$%PIdWTCT4G(C!vMeawXvU2*~0&fF<&rd1ZK&0o&YT49B^RpABPw~MEZbV$4W&? zN(xz7S^j;;0G6>!M20L%6mrE75qSrAGZrecva(1?87S6*Joygrx`@0V>VSRU4%n0SAde+y?9##_?{Kl12?0oX7GHzo*qkndrDTifFJmN;|WRF zbpu7@6tEfJ43cONqt!AUhSH7E_@9J3DB{YYzWaf7KvbUB90OQF6Y!{rMEqsf)Y`!! zQU=^j6grGzyjo_mBfw!`k%*Y;-8DTuTtw=D4N9q{7^_dM1ZDtZ!@hBFfzBBq+PHyB z7_)p1h{%cIyje+X*Q$#wKq;*Pbbo&!eA<#2W9ky%khnMoNOEkQBE|}qE?ug%{Hm%d zt>q{EJ%DaR#JLA>(1&AyB*!s8lH(X4$#D#j_`Utdp6O%40@ z?F*Xp5*LVw)=f_Y@bg+W~;$~Q|?~)bGZUJVgudk<~qQca%4Gj&Hmq+|+`ctFnz6%BJ!3KBtW@F*Ph0@vC z8TJXl>-EZ}O`9TpmKRu}z5aCz@R{JK?uH#stX{oZT3cH~Hhxb}k8Inv&CKT<(p~Q& zqJKaLfKnp@+!J%cHfmmCDLW_U_%w`Sa%^y}cQ@TSTHh z^=`P>!TFRb{Ir45Q%>ib$&_9U~?# z4G@S@Dg(F|C<49*EGBk8C^ZA8F&0~>1pXtwtlRNQ+#4ViN~x(BPZG0$Z(-yy$OR_) zA_ExBKyCv!;KBF}qQw{2fXl#_!2f_xMWn&HZ($Ap2UhRnY81VbdH?_b07*qoM6N<$ Ef*<>UZ~y=R diff --git a/tests/unittests/runUnittestsQt512.bat b/tests/unittests/runUnittestsQt512.bat deleted file mode 100644 index a5210d5..0000000 --- a/tests/unittests/runUnittestsQt512.bat +++ /dev/null @@ -1,11 +0,0 @@ -REM THIS IS A SCRIPT TO PREPARE AND RUN UNITTESTS - -SET PATH=%PATH%;build;lib;lib\%TARGETDIRNAME%;C:\Qt\5.12.6\msvc2017_64\bin;%DEVTOOLS%\binDebug;%DEVTOOLS%\binDebug\modules;%DEVTOOLS%\bin;%DEVTOOLS%\bin\modules - -SET PROGRAMPATH="C:\Program Files\OpenCppCoverage" - -REM in der folgenden Zeile ist ggf. der Name der Executable zu ändern -%PROGRAMPATH%\OpenCppCoverage.exe --sources src --export_type=html --export_type=cobertura --modules lib\%TARGETDIRNAME%\* --excluded_modules build\%UNITTESTSNAME%.exe --excluded_sources %DEVTOOLS%\* -- build\%UNITTESTSNAME%.exe --gtest_output=xml:unittests.xml - - - diff --git a/tests/unittests/runUnittestsQt515.bat b/tests/unittests/runUnittestsQt515.bat deleted file mode 100644 index 044ddd8..0000000 --- a/tests/unittests/runUnittestsQt515.bat +++ /dev/null @@ -1,8 +0,0 @@ -REM THIS IS A SCRIPT TO PREPARE AND RUN UNITTESTS - -SET PATH=%PATH%;build;lib;lib\%TARGETDIRNAME%;C:\Qt\Qt5.15\5.15.2\msvc2019_64\bin;%DEVTOOLS%\binDebug;%DEVTOOLS%\binDebug\modules;%DEVTOOLS%\bin;%DEVTOOLS%\bin\modules - -SET PROGRAMPATH="C:\Program Files\OpenCppCoverage" - -REM in der folgenden Zeile ist ggf. der Name der Executable zu ändern -%PROGRAMPATH%\OpenCppCoverage.exe --sources src --export_type=html --export_type=cobertura --modules lib\%TARGETDIRNAME%\* --excluded_modules build\%UNITTESTSNAME%.exe --excluded_sources %DEVTOOLS%\* -- build\%UNITTESTSNAME%.exe --gtest_output=xml:unittests.xml diff --git a/tests/unittests/unittests.pro b/tests/unittests/unittests.pro deleted file mode 100644 index e5e7687..0000000 --- a/tests/unittests/unittests.pro +++ /dev/null @@ -1,82 +0,0 @@ -# ______________ __ -# / ____/_ __/ /___ / /_ -# / / __ / / / / __ `/ __ \ -# / /_/ / / / / / /_/ / /_/ / -# \____/ /_/ /_/\__,_/_.___/ - -###################################################################### -#### DO NOT CHANGE! -###################################################################### - -include( $${PWD}/../../settings.pri ) - -BUILD_DEST = ../../build -MOC_BUILD_DEST = $${BUILD_DEST} - -TEMPLATE = app - -QT += xml core sql widgets - -TARGET = GTlabUnitTest - -CONFIG(debug, debug|release){ - DESTDIR = $${MOC_BUILD_DEST}/debug-unittests - OBJECTS_DIR = $${MOC_BUILD_DEST}/debug-unittests/obj - MOC_DIR = $${MOC_BUILD_DEST}/debug-unittests/moc - RCC_DIR = $${MOC_BUILD_DEST}/debug-unittests/rcc - UI_DIR = $${MOC_BUILD_DEST}/debug-unittests/ui -} else { - DESTDIR = $${MOC_BUILD_DEST}/release-unittests - OBJECTS_DIR = $${MOC_BUILD_DEST}/release-unittests/obj - MOC_DIR = $${MOC_BUILD_DEST}/release-unittests/moc - RCC_DIR = $${MOC_BUILD_DEST}/release-unittests/rcc - UI_DIR = $${MOC_BUILD_DEST}/release-unittests/ui -} - -CONFIG += silent -CONFIG += c++14 -CONFIG += console - -#### INCLUDES -INCLUDEPATH += $${PWD}/../../src - -#### HEADERS -HEADERS += $$files(*.h) \ - -#### SOURCES -SOURCES += $$files(*.cpp) - -#################################################### - -DESTDIR = $${BUILD_DEST} - -#################################################### - -LIBS += -L../../$${LIB_BUILD_DEST} - -equals(QT_MAJOR_VERSION, 5):!lessThan(QT_MINOR_VERSION, 12) { - message(Qt Version 5.12 or newer) - - CONFIG(debug, debug|release){ - win32 { - LIBS += -lgtestd - } - unix { - LIBS += -lgtest - } - } else { - LIBS += -lgtest - } - -} else { - message(Qt Version older than 5.12) - - LIBS += -lgtest -} - -#################################################### - -# add search paths to shared libraries -unix: QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN:\$$ORIGIN/modules\'' - -###################################################################### From 8c2c6863f0bcd8405effedbb500a0588f0e5213c Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 29 May 2024 15:05:03 +0200 Subject: [PATCH 037/130] Added clangformat --- .clang-format | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..d521688 --- /dev/null +++ b/.clang-format @@ -0,0 +1,24 @@ +BasedOnStyle: Microsoft +IndentWidth: 4 +AlwaysBreakAfterReturnType: TopLevelDefinitions +AlwaysBreakTemplateDeclarations: Yes +PPIndentWidth: 0 +NamespaceIndentation: All +AccessModifierOffset: -4 + +# comments +ReflowComments: False + +ColumnLimit: 80 +PointerAlignment: Left +MaxEmptyLinesToKeep: 2 + + +# classes +BreakConstructorInitializers: AfterColon +# works only on clang 14 +# PackConstructorInitializers: Never + +# todo: discuss +SortIncludes: Never +IncludeBlocks: Preserve \ No newline at end of file From f374f8f86b8c151f7103258433085c890e5d22ef Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 29 May 2024 15:29:31 +0200 Subject: [PATCH 038/130] Replaced copyright texts --- src/batch/batch-script.cpp | 9 +++++---- src/module/collection/browser/gtpy_collectionbrowser.cpp | 9 +++++---- src/module/collection/browser/gtpy_collectionbrowser.h | 9 +++++---- .../collection/browser/gtpy_collectionbrowsermodel.cpp | 9 +++++---- .../collection/browser/gtpy_collectionbrowsermodel.h | 9 +++++---- .../browser/gtpy_collectionbrowsersortmodel.cpp | 9 +++++---- .../collection/browser/gtpy_collectionbrowsersortmodel.h | 9 +++++---- .../browser/items/gtpy_abstractbrowseritem.cpp | 9 +++++---- .../collection/browser/items/gtpy_abstractbrowseritem.h | 9 +++++---- src/module/collection/browser/items/gtpy_browseritem.cpp | 9 +++++---- src/module/collection/browser/items/gtpy_browseritem.h | 9 +++++---- .../browser/items/gtpy_collapsiblebrowseritem.cpp | 9 +++++---- .../browser/items/gtpy_collapsiblebrowseritem.h | 9 +++++---- .../collection/browser/items/gtpy_rootbrowseritem.cpp | 9 +++++---- .../collection/browser/items/gtpy_rootbrowseritem.h | 9 +++++---- src/module/collection/gtpy_collectionwidget.cpp | 9 +++++---- src/module/collection/gtpy_collectionwidget.h | 9 +++++---- src/module/collection/gtpy_scriptcollectionsettings.cpp | 9 +++++---- src/module/collection/gtpy_scriptcollectionsettings.h | 9 +++++---- .../collection/itemwidget/gtpy_collectionitemwidget.cpp | 9 +++++---- .../collection/itemwidget/gtpy_collectionitemwidget.h | 9 +++++---- .../collection/localwidget/gtpy_collectionlocalmodel.cpp | 9 +++++---- .../collection/localwidget/gtpy_collectionlocalmodel.h | 9 +++++---- .../localwidget/gtpy_collectionlocalwidget.cpp | 9 +++++---- .../collection/localwidget/gtpy_collectionlocalwidget.h | 9 +++++---- .../localwidget/items/gtpy_abstractlocalitem.cpp | 9 +++++---- .../localwidget/items/gtpy_abstractlocalitem.h | 9 +++++---- .../localwidget/items/gtpy_collapsiblelocalitem.cpp | 9 +++++---- .../localwidget/items/gtpy_collapsiblelocalitem.h | 9 +++++---- .../collection/localwidget/items/gtpy_localitem.cpp | 9 +++++---- src/module/collection/localwidget/items/gtpy_localitem.h | 9 +++++---- src/module/extensions/gtpy_pythonfunctions.cpp | 9 +++++---- src/module/extensions/gtpy_pythonfunctions.h | 9 +++++---- src/module/gt_python.cpp | 9 +++++---- src/module/gt_python.h | 9 +++++---- src/module/gt_pythonmodule_exports.h | 9 +++++---- src/module/gtpy_icons_compat.h | 9 +++++---- src/module/gtpy_stylesheet_compat.h | 9 +++++---- src/module/models/gtpy_completermodel.cpp | 9 +++++---- src/module/models/gtpy_completermodel.h | 9 +++++---- src/module/models/gtpy_objectmodel.cpp | 9 +++++---- src/module/models/gtpy_objectmodel.h | 9 +++++---- src/module/models/gtpy_taskstylemodel.cpp | 9 +++++---- src/module/models/gtpy_taskstylemodel.h | 9 +++++---- src/module/post/gtpy_pythonplotconfigdialog.cpp | 9 +++++---- src/module/post/gtpy_pythonplotconfigdialog.h | 9 +++++---- src/module/post/gtpy_pythonplotdata.cpp | 9 +++++---- src/module/post/gtpy_pythonplotdata.h | 9 +++++---- src/module/post/gtpy_pythonplotitem.cpp | 9 +++++---- src/module/post/gtpy_pythonplotitem.h | 9 +++++---- src/module/post/gtpy_pythonplotwidget.cpp | 9 +++++---- src/module/post/gtpy_pythonplotwidget.h | 9 +++++---- src/module/post/gtpy_pythonsvgwidget.cpp | 9 +++++---- src/module/post/gtpy_pythonsvgwidget.h | 9 +++++---- .../processcomponents/gtpy_abstractscriptcomponent.cpp | 9 +++++---- .../processcomponents/gtpy_abstractscriptcomponent.h | 9 +++++---- src/module/processcomponents/gtpy_scriptcalculator.cpp | 9 +++++---- src/module/processcomponents/gtpy_scriptcalculator.h | 9 +++++---- src/module/processcomponents/gtpy_task.cpp | 9 +++++---- src/module/processcomponents/gtpy_task.h | 9 +++++---- src/module/utilities/gtpy_calculatorfactory.cpp | 9 +++++---- src/module/utilities/gtpy_calculatorfactory.h | 9 +++++---- src/module/utilities/gtpy_codegenerator.cpp | 9 +++++---- src/module/utilities/gtpy_codegenerator.h | 9 +++++---- src/module/utilities/gtpy_constants.h | 9 +++++---- src/module/utilities/gtpy_contextmanager.cpp | 9 +++++---- src/module/utilities/gtpy_contextmanager.h | 9 +++++---- src/module/utilities/gtpy_convert.cpp | 9 +++++---- src/module/utilities/gtpy_convert.h | 9 +++++---- src/module/utilities/gtpy_decorator.cpp | 9 +++++---- src/module/utilities/gtpy_decorator.h | 9 +++++---- src/module/utilities/gtpy_gilscope.cpp | 9 +++++---- src/module/utilities/gtpy_gilscope.h | 9 +++++---- src/module/utilities/gtpy_globals.cpp | 9 +++++---- src/module/utilities/gtpy_globals.h | 9 +++++---- src/module/utilities/gtpy_interruptrunnable.cpp | 9 +++++---- src/module/utilities/gtpy_interruptrunnable.h | 9 +++++---- src/module/utilities/gtpy_matplotlib.h | 9 +++++---- src/module/utilities/gtpy_packageiteration.h | 9 +++++---- src/module/utilities/gtpy_processdatadistributor.cpp | 9 +++++---- src/module/utilities/gtpy_processdatadistributor.h | 9 +++++---- src/module/utilities/gtpy_regexp.cpp | 9 +++++---- src/module/utilities/gtpy_regexp.h | 9 +++++---- src/module/utilities/gtpy_scriptrunnable.cpp | 9 +++++---- src/module/utilities/gtpy_scriptrunnable.h | 9 +++++---- src/module/utilities/gtpy_tempdir.cpp | 9 +++++---- src/module/utilities/gtpy_tempdir.h | 9 +++++---- src/module/utilities/gtpy_threadscope.h | 2 +- src/module/utilities/gtpy_transfer.cpp | 9 +++++---- src/module/utilities/gtpy_transfer.h | 9 +++++---- src/module/utilities/gtpypp.h | 4 +++- .../pythonextensions/gtpy_calculatorsmodule.cpp | 9 +++++---- .../utilities/pythonextensions/gtpy_calculatorsmodule.h | 9 +++++---- .../pythonextensions/gtpy_createhelperfunction.cpp | 9 +++++---- .../pythonextensions/gtpy_createhelperfunction.h | 9 +++++---- .../utilities/pythonextensions/gtpy_extendedwrapper.cpp | 9 +++++---- .../utilities/pythonextensions/gtpy_extendedwrapper.h | 9 +++++---- .../utilities/pythonextensions/gtpy_importfunction.cpp | 9 +++++---- .../utilities/pythonextensions/gtpy_importfunction.h | 9 +++++---- .../utilities/pythonextensions/gtpy_loggingmodule.cpp | 9 +++++---- .../utilities/pythonextensions/gtpy_loggingmodule.h | 9 +++++---- .../utilities/pythonextensions/gtpy_propertysetter.cpp | 9 +++++---- .../utilities/pythonextensions/gtpy_propertysetter.h | 9 +++++---- src/module/utilities/pythonextensions/gtpy_stdout.cpp | 9 +++++---- src/module/utilities/pythonextensions/gtpy_stdout.h | 9 +++++---- src/module/widgets/gtpy_completer.cpp | 9 +++++---- src/module/widgets/gtpy_completer.h | 9 +++++---- src/module/widgets/gtpy_console.cpp | 9 +++++---- src/module/widgets/gtpy_console.h | 9 +++++---- src/module/widgets/gtpy_lineedit.cpp | 9 +++++---- src/module/widgets/gtpy_lineedit.h | 9 +++++---- src/module/widgets/gtpy_replacewidget.cpp | 9 +++++---- src/module/widgets/gtpy_replacewidget.h | 9 +++++---- src/module/widgets/gtpy_scripteditor.cpp | 9 +++++---- src/module/widgets/gtpy_scripteditor.h | 9 +++++---- src/module/widgets/gtpy_scripteditorwidget.cpp | 9 +++++---- src/module/widgets/gtpy_scripteditorwidget.h | 9 +++++---- src/module/widgets/gtpy_scriptview.cpp | 9 +++++---- src/module/widgets/gtpy_scriptview.h | 9 +++++---- src/module/widgets/gtpy_taskdelegate.cpp | 9 +++++---- src/module/widgets/gtpy_taskdelegate.h | 9 +++++---- src/module/widgets/gtpy_tasktreeview.cpp | 9 +++++---- src/module/widgets/gtpy_tasktreeview.h | 9 +++++---- .../wizards/editor_settings/gtpy_editorsettings.cpp | 9 +++++---- src/module/wizards/editor_settings/gtpy_editorsettings.h | 9 +++++---- .../editor_settings/gtpy_editorsettingsdialog.cpp | 9 +++++---- .../wizards/editor_settings/gtpy_editorsettingsdialog.h | 9 +++++---- .../editor_settings/pages/gtpy_abstractsettingspage.cpp | 9 +++++---- .../editor_settings/pages/gtpy_abstractsettingspage.h | 9 +++++---- .../wizards/editor_settings/pages/gtpy_generalpage.cpp | 9 +++++---- .../wizards/editor_settings/pages/gtpy_generalpage.h | 9 +++++---- src/module/wizards/gtpy_abstractscriptingwizardpage.cpp | 9 +++++---- src/module/wizards/gtpy_abstractscriptingwizardpage.h | 9 +++++---- src/module/wizards/gtpy_wizardgeometries.cpp | 9 +++++---- src/module/wizards/gtpy_wizardgeometries.h | 9 +++++---- src/module/wizards/gtpy_wizardgeometryitem.cpp | 9 +++++---- src/module/wizards/gtpy_wizardgeometryitem.h | 9 +++++---- src/module/wizards/python_task/gtpy_taskwizardpage.cpp | 9 +++++---- src/module/wizards/python_task/gtpy_taskwizardpage.h | 9 +++++---- .../gtpy_scriptcalculatorwizardpage.cpp | 9 +++++---- .../script_calculator/gtpy_scriptcalculatorwizardpage.h | 9 +++++---- src/setup_module/gt_python_setup.cpp | 9 +++++---- src/setup_module/gt_python_setup.h | 9 +++++---- src/setup_module/gtps_constants.h | 9 +++++---- src/setup_module/gtps_globals.cpp | 9 +++++---- src/setup_module/gtps_globals.h | 9 +++++---- src/setup_module/gtps_pythoninterpreter.cpp | 9 +++++---- src/setup_module/gtps_pythoninterpreter.h | 9 +++++---- src/setup_module/gtps_systemsettings.cpp | 9 +++++---- src/setup_module/gtps_systemsettings.h | 9 +++++---- 150 files changed, 744 insertions(+), 594 deletions(-) diff --git a/src/batch/batch-script.cpp b/src/batch/batch-script.cpp index db9dd92..71f8b27 100644 --- a/src/batch/batch-script.cpp +++ b/src/batch/batch-script.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: - * copyright 2009-2015 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 24.07.2015 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 24.07.2015 + * Author: Stanislaus Reitenbach (AT-TW) */ #include diff --git a/src/module/collection/browser/gtpy_collectionbrowser.cpp b/src/module/collection/browser/gtpy_collectionbrowser.cpp index 82d4942..d8e8591 100644 --- a/src/module/collection/browser/gtpy_collectionbrowser.cpp +++ b/src/module/collection/browser/gtpy_collectionbrowser.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionbrowser.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.08.2021 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/collection/browser/gtpy_collectionbrowser.h b/src/module/collection/browser/gtpy_collectionbrowser.h index 91e091d..f826e63 100644 --- a/src/module/collection/browser/gtpy_collectionbrowser.h +++ b/src/module/collection/browser/gtpy_collectionbrowser.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionbrowser.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.08.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCOLLECTIONBROWSER_H diff --git a/src/module/collection/browser/gtpy_collectionbrowsermodel.cpp b/src/module/collection/browser/gtpy_collectionbrowsermodel.cpp index 7237f65..b3c54c7 100644 --- a/src/module/collection/browser/gtpy_collectionbrowsermodel.cpp +++ b/src/module/collection/browser/gtpy_collectionbrowsermodel.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionbrowsermodel.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.08.2021 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_constants.h" diff --git a/src/module/collection/browser/gtpy_collectionbrowsermodel.h b/src/module/collection/browser/gtpy_collectionbrowsermodel.h index 4c5053a..a4cce51 100644 --- a/src/module/collection/browser/gtpy_collectionbrowsermodel.h +++ b/src/module/collection/browser/gtpy_collectionbrowsermodel.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionbrowsermodel.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.08.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCOLLECTIONBROWSERMODEL_H diff --git a/src/module/collection/browser/gtpy_collectionbrowsersortmodel.cpp b/src/module/collection/browser/gtpy_collectionbrowsersortmodel.cpp index 58bc281..ba3815e 100644 --- a/src/module/collection/browser/gtpy_collectionbrowsersortmodel.cpp +++ b/src/module/collection/browser/gtpy_collectionbrowsersortmodel.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionbrowsersortmodel.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 20.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 20.09.2021 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_collectionbrowsersortmodel.h" diff --git a/src/module/collection/browser/gtpy_collectionbrowsersortmodel.h b/src/module/collection/browser/gtpy_collectionbrowsersortmodel.h index 3169288..7fbcdc3 100644 --- a/src/module/collection/browser/gtpy_collectionbrowsersortmodel.h +++ b/src/module/collection/browser/gtpy_collectionbrowsersortmodel.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionbrowsersortmodel.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 20.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 20.09.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCOLLECTIONBROWSERSORTMODEL_H diff --git a/src/module/collection/browser/items/gtpy_abstractbrowseritem.cpp b/src/module/collection/browser/items/gtpy_abstractbrowseritem.cpp index 8960125..38fac43 100644 --- a/src/module/collection/browser/items/gtpy_abstractbrowseritem.cpp +++ b/src/module/collection/browser/items/gtpy_abstractbrowseritem.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_abstractbrowseritem.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 22.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 22.08.2021 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_abstractbrowseritem.h" diff --git a/src/module/collection/browser/items/gtpy_abstractbrowseritem.h b/src/module/collection/browser/items/gtpy_abstractbrowseritem.h index 30f8354..8481221 100644 --- a/src/module/collection/browser/items/gtpy_abstractbrowseritem.h +++ b/src/module/collection/browser/items/gtpy_abstractbrowseritem.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_abstractbrowseritem.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 22.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 22.08.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYABSTRACTBROWSERITEM_H diff --git a/src/module/collection/browser/items/gtpy_browseritem.cpp b/src/module/collection/browser/items/gtpy_browseritem.cpp index 356daf2..0992798 100644 --- a/src/module/collection/browser/items/gtpy_browseritem.cpp +++ b/src/module/collection/browser/items/gtpy_browseritem.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_browseritem.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.08.2021 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_browseritem.h" diff --git a/src/module/collection/browser/items/gtpy_browseritem.h b/src/module/collection/browser/items/gtpy_browseritem.h index 816f35d..ae04ec6 100644 --- a/src/module/collection/browser/items/gtpy_browseritem.h +++ b/src/module/collection/browser/items/gtpy_browseritem.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_browseritem.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.08.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYBROWSERITEM_H diff --git a/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.cpp b/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.cpp index 69a1b07..b6a2bde 100644 --- a/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.cpp +++ b/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collapsiblebrowseritem.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 22.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 22.08.2021 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_collapsiblebrowseritem.h" diff --git a/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.h b/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.h index f63561d..b3dcaba 100644 --- a/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.h +++ b/src/module/collection/browser/items/gtpy_collapsiblebrowseritem.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collapsiblebrowseritem.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 22.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 22.08.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCOLLAPSIBLEBROWSERITEM_H diff --git a/src/module/collection/browser/items/gtpy_rootbrowseritem.cpp b/src/module/collection/browser/items/gtpy_rootbrowseritem.cpp index 99ada72..9f9bb46 100644 --- a/src/module/collection/browser/items/gtpy_rootbrowseritem.cpp +++ b/src/module/collection/browser/items/gtpy_rootbrowseritem.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_rootbrowseritem.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 23.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 23.08.2021 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_collapsiblebrowseritem.h" diff --git a/src/module/collection/browser/items/gtpy_rootbrowseritem.h b/src/module/collection/browser/items/gtpy_rootbrowseritem.h index deb6fab..ab98c75 100644 --- a/src/module/collection/browser/items/gtpy_rootbrowseritem.h +++ b/src/module/collection/browser/items/gtpy_rootbrowseritem.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_rootbrowseritem.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 23.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 23.08.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYROOTBROWSERITEM_H diff --git a/src/module/collection/gtpy_collectionwidget.cpp b/src/module/collection/gtpy_collectionwidget.cpp index c02fd36..53fc2fb 100644 --- a/src/module/collection/gtpy_collectionwidget.cpp +++ b/src/module/collection/gtpy_collectionwidget.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionwidget.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2021 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/collection/gtpy_collectionwidget.h b/src/module/collection/gtpy_collectionwidget.h index b8c112f..1804f6c 100644 --- a/src/module/collection/gtpy_collectionwidget.h +++ b/src/module/collection/gtpy_collectionwidget.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionwidget.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCOLLECTIONWIDGET_H diff --git a/src/module/collection/gtpy_scriptcollectionsettings.cpp b/src/module/collection/gtpy_scriptcollectionsettings.cpp index e673389..ee56ad8 100644 --- a/src/module/collection/gtpy_scriptcollectionsettings.cpp +++ b/src/module/collection/gtpy_scriptcollectionsettings.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpyscriptcollectionsettings.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2021 + * Author: Marvin Noethen (AT-TW) */ #include "gt_collectionitem.h" diff --git a/src/module/collection/gtpy_scriptcollectionsettings.h b/src/module/collection/gtpy_scriptcollectionsettings.h index c62952d..af1b358 100644 --- a/src/module/collection/gtpy_scriptcollectionsettings.h +++ b/src/module/collection/gtpy_scriptcollectionsettings.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpyscriptcollectionsettings.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYSCRIPTCOLLECTIONSETTINGS_H diff --git a/src/module/collection/itemwidget/gtpy_collectionitemwidget.cpp b/src/module/collection/itemwidget/gtpy_collectionitemwidget.cpp index c8bab39..17a6862 100644 --- a/src/module/collection/itemwidget/gtpy_collectionitemwidget.cpp +++ b/src/module/collection/itemwidget/gtpy_collectionitemwidget.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionitemwidget.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/collection/itemwidget/gtpy_collectionitemwidget.h b/src/module/collection/itemwidget/gtpy_collectionitemwidget.h index 9404be6..9b4ce14 100644 --- a/src/module/collection/itemwidget/gtpy_collectionitemwidget.h +++ b/src/module/collection/itemwidget/gtpy_collectionitemwidget.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionitemwidget.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCOLLECTIONITEMWIDGET_H diff --git a/src/module/collection/localwidget/gtpy_collectionlocalmodel.cpp b/src/module/collection/localwidget/gtpy_collectionlocalmodel.cpp index b148faf..a9bbc63 100644 --- a/src/module/collection/localwidget/gtpy_collectionlocalmodel.cpp +++ b/src/module/collection/localwidget/gtpy_collectionlocalmodel.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionlocalmodel.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/collection/localwidget/gtpy_collectionlocalmodel.h b/src/module/collection/localwidget/gtpy_collectionlocalmodel.h index 734669c..adfefe3 100644 --- a/src/module/collection/localwidget/gtpy_collectionlocalmodel.h +++ b/src/module/collection/localwidget/gtpy_collectionlocalmodel.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionlocalmodel.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCOLLECTIONLOCALMODEL_H diff --git a/src/module/collection/localwidget/gtpy_collectionlocalwidget.cpp b/src/module/collection/localwidget/gtpy_collectionlocalwidget.cpp index b232eca..8737cb9 100644 --- a/src/module/collection/localwidget/gtpy_collectionlocalwidget.cpp +++ b/src/module/collection/localwidget/gtpy_collectionlocalwidget.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionlocalwidget.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/collection/localwidget/gtpy_collectionlocalwidget.h b/src/module/collection/localwidget/gtpy_collectionlocalwidget.h index 8fa4609..c94a7bb 100644 --- a/src/module/collection/localwidget/gtpy_collectionlocalwidget.h +++ b/src/module/collection/localwidget/gtpy_collectionlocalwidget.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collectionlocalwidget.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCOLLECTIONLOCALWIDGET_H diff --git a/src/module/collection/localwidget/items/gtpy_abstractlocalitem.cpp b/src/module/collection/localwidget/items/gtpy_abstractlocalitem.cpp index 44893b4..149f238 100644 --- a/src/module/collection/localwidget/items/gtpy_abstractlocalitem.cpp +++ b/src/module/collection/localwidget/items/gtpy_abstractlocalitem.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_abstractlocalitem.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_abstractlocalitem.h" diff --git a/src/module/collection/localwidget/items/gtpy_abstractlocalitem.h b/src/module/collection/localwidget/items/gtpy_abstractlocalitem.h index a17c555..79c8903 100644 --- a/src/module/collection/localwidget/items/gtpy_abstractlocalitem.h +++ b/src/module/collection/localwidget/items/gtpy_abstractlocalitem.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_abstractlocalitem.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYABSTRACTLOCALITEM_H diff --git a/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.cpp b/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.cpp index aa730e9..6978200 100644 --- a/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.cpp +++ b/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collapsiblelocalitem.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_collapsiblelocalitem.h" diff --git a/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.h b/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.h index 727e593..2e8ea35 100644 --- a/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.h +++ b/src/module/collection/localwidget/items/gtpy_collapsiblelocalitem.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_collapsiblelocalitem.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCOLLAPSIBLELOCALITEM_H diff --git a/src/module/collection/localwidget/items/gtpy_localitem.cpp b/src/module/collection/localwidget/items/gtpy_localitem.cpp index 5db0f69..e0491a6 100644 --- a/src/module/collection/localwidget/items/gtpy_localitem.cpp +++ b/src/module/collection/localwidget/items/gtpy_localitem.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpylocalitem.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_localitem.h" diff --git a/src/module/collection/localwidget/items/gtpy_localitem.h b/src/module/collection/localwidget/items/gtpy_localitem.h index abcea34..318c4d3 100644 --- a/src/module/collection/localwidget/items/gtpy_localitem.h +++ b/src/module/collection/localwidget/items/gtpy_localitem.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpylocalitem.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.09.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.09.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYLOCALITEM_H diff --git a/src/module/extensions/gtpy_pythonfunctions.cpp b/src/module/extensions/gtpy_pythonfunctions.cpp index d8f5d43..515dd64 100644 --- a/src/module/extensions/gtpy_pythonfunctions.cpp +++ b/src/module/extensions/gtpy_pythonfunctions.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonfunctions.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 04.04.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 04.04.2023 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/extensions/gtpy_pythonfunctions.h b/src/module/extensions/gtpy_pythonfunctions.h index bfa3237..a263eeb 100644 --- a/src/module/extensions/gtpy_pythonfunctions.h +++ b/src/module/extensions/gtpy_pythonfunctions.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonfunctions.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 04.04.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 04.04.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_PYTHONFUNCTIONS_H diff --git a/src/module/gt_python.cpp b/src/module/gt_python.cpp index 815f527..50644a7 100644 --- a/src/module/gt_python.cpp +++ b/src/module/gt_python.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: - * copyright 2009-2015 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 11.08.2015 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 11.08.2015 + * Author: Stanislaus Reitenbach (AT-TW) */ #include diff --git a/src/module/gt_python.h b/src/module/gt_python.h index 37a5201..a538bce 100644 --- a/src/module/gt_python.h +++ b/src/module/gt_python.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: - * copyright 2009-2015 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Stanislaus Reitenbach (AT-TWK) - * Tel.: +49 2203 601 2907 + * Created on: 12.08.2019 + * Author: Stanislaus Reitenbach (AT-TWK) */ #ifndef GTPYTHON_H diff --git a/src/module/gt_pythonmodule_exports.h b/src/module/gt_pythonmodule_exports.h index f563280..a90fd3f 100644 --- a/src/module/gt_pythonmodule_exports.h +++ b/src/module/gt_pythonmodule_exports.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gt_pythonmodule_exports.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GT_PYTHONMODULE_EXPORTS_H diff --git a/src/module/gtpy_icons_compat.h b/src/module/gtpy_icons_compat.h index 2576aa5..2b6d8cc 100644 --- a/src/module/gtpy_icons_compat.h +++ b/src/module/gtpy_icons_compat.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_icons_compat.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 08.03.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 08.03.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_ICONS_COMPAT_H diff --git a/src/module/gtpy_stylesheet_compat.h b/src/module/gtpy_stylesheet_compat.h index 33b4cea..41e6dcd 100644 --- a/src/module/gtpy_stylesheet_compat.h +++ b/src/module/gtpy_stylesheet_compat.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_stylesheet_compat.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 09.03.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 09.03.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_STYLESHEET_COMPAT_H diff --git a/src/module/models/gtpy_completermodel.cpp b/src/module/models/gtpy_completermodel.cpp index b91ad6d..b07fc7b 100644 --- a/src/module/models/gtpy_completermodel.cpp +++ b/src/module/models/gtpy_completermodel.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_completermodel.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_completermodel.h" diff --git a/src/module/models/gtpy_completermodel.h b/src/module/models/gtpy_completermodel.h index 5d1ddd3..855c164 100644 --- a/src/module/models/gtpy_completermodel.h +++ b/src/module/models/gtpy_completermodel.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_completermodel.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_COMPLETERMODEL_H diff --git a/src/module/models/gtpy_objectmodel.cpp b/src/module/models/gtpy_objectmodel.cpp index 84f84b4..57dbf2a 100644 --- a/src/module/models/gtpy_objectmodel.cpp +++ b/src/module/models/gtpy_objectmodel.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_objectmodel.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 20.12.2022 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 20.12.2022 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/models/gtpy_objectmodel.h b/src/module/models/gtpy_objectmodel.h index 0490bdd..db35df9 100644 --- a/src/module/models/gtpy_objectmodel.h +++ b/src/module/models/gtpy_objectmodel.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_objectmodel.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 20.12.2022 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 20.12.2022 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYOBJECTMODEL_H diff --git a/src/module/models/gtpy_taskstylemodel.cpp b/src/module/models/gtpy_taskstylemodel.cpp index 551d761..1c6e7e9 100644 --- a/src/module/models/gtpy_taskstylemodel.cpp +++ b/src/module/models/gtpy_taskstylemodel.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_taskstylemodel.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/models/gtpy_taskstylemodel.h b/src/module/models/gtpy_taskstylemodel.h index 7083294..1a87e07 100644 --- a/src/module/models/gtpy_taskstylemodel.h +++ b/src/module/models/gtpy_taskstylemodel.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_taskstylemodel.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_TASKSTYLEMODEL_H diff --git a/src/module/post/gtpy_pythonplotconfigdialog.cpp b/src/module/post/gtpy_pythonplotconfigdialog.cpp index 3a31190..ccf42eb 100644 --- a/src/module/post/gtpy_pythonplotconfigdialog.cpp +++ b/src/module/post/gtpy_pythonplotconfigdialog.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonplotconfigdialog.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.08.2019 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 13.08.2019 + * Author: Stanislaus Reitenbach (AT-TW) */ #include diff --git a/src/module/post/gtpy_pythonplotconfigdialog.h b/src/module/post/gtpy_pythonplotconfigdialog.h index 65d55b3..21dfdc4 100644 --- a/src/module/post/gtpy_pythonplotconfigdialog.h +++ b/src/module/post/gtpy_pythonplotconfigdialog.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonplotconfigdialog.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.08.2019 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 13.08.2019 + * Author: Stanislaus Reitenbach (AT-TW) */ #ifndef GTPY_PYTHONPLOTCONFIGDIALOG_H diff --git a/src/module/post/gtpy_pythonplotdata.cpp b/src/module/post/gtpy_pythonplotdata.cpp index 0740e67..d734a0b 100644 --- a/src/module/post/gtpy_pythonplotdata.cpp +++ b/src/module/post/gtpy_pythonplotdata.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonplotdata.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.08.2019 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 13.08.2019 + * Author: Stanislaus Reitenbach (AT-TW) */ #include "gtpy_pythonplotdata.h" diff --git a/src/module/post/gtpy_pythonplotdata.h b/src/module/post/gtpy_pythonplotdata.h index ff41982..408a558 100644 --- a/src/module/post/gtpy_pythonplotdata.h +++ b/src/module/post/gtpy_pythonplotdata.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonplotdata.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.08.2019 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 13.08.2019 + * Author: Stanislaus Reitenbach (AT-TW) */ #ifndef GTPY_PYTHONPLOTDATA_H diff --git a/src/module/post/gtpy_pythonplotitem.cpp b/src/module/post/gtpy_pythonplotitem.cpp index c527ee2..d4caa71 100644 --- a/src/module/post/gtpy_pythonplotitem.cpp +++ b/src/module/post/gtpy_pythonplotitem.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonplotitem.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.08.2019 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 13.08.2019 + * Author: Stanislaus Reitenbach (AT-TW) */ #include "gtpy_pythonplotwidget.h" diff --git a/src/module/post/gtpy_pythonplotitem.h b/src/module/post/gtpy_pythonplotitem.h index efeafff..cca9ce2 100644 --- a/src/module/post/gtpy_pythonplotitem.h +++ b/src/module/post/gtpy_pythonplotitem.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonplotitem.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.08.2019 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 13.08.2019 + * Author: Stanislaus Reitenbach (AT-TW) */ #ifndef GTPY_PYTHONPLOTITEM_H diff --git a/src/module/post/gtpy_pythonplotwidget.cpp b/src/module/post/gtpy_pythonplotwidget.cpp index 48aa450..e4ba0a4 100644 --- a/src/module/post/gtpy_pythonplotwidget.cpp +++ b/src/module/post/gtpy_pythonplotwidget.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonplotwidget.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.08.2019 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 13.08.2019 + * Author: Stanislaus Reitenbach (AT-TW) */ #include diff --git a/src/module/post/gtpy_pythonplotwidget.h b/src/module/post/gtpy_pythonplotwidget.h index da2046e..2b9814b 100644 --- a/src/module/post/gtpy_pythonplotwidget.h +++ b/src/module/post/gtpy_pythonplotwidget.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonplotwidget.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.08.2019 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 13.08.2019 + * Author: Stanislaus Reitenbach (AT-TW) */ #ifndef GTPY_PYTHONPLOTWIDGET_H diff --git a/src/module/post/gtpy_pythonsvgwidget.cpp b/src/module/post/gtpy_pythonsvgwidget.cpp index 57718aa..23557ac 100644 --- a/src/module/post/gtpy_pythonsvgwidget.cpp +++ b/src/module/post/gtpy_pythonsvgwidget.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonsvgwidget.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.08.2019 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 13.08.2019 + * Author: Stanislaus Reitenbach (AT-TW) */ #include diff --git a/src/module/post/gtpy_pythonsvgwidget.h b/src/module/post/gtpy_pythonsvgwidget.h index 5183f73..0d287d4 100644 --- a/src/module/post/gtpy_pythonsvgwidget.h +++ b/src/module/post/gtpy_pythonsvgwidget.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_pythonsvgwidget.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.08.2019 - * Author: Stanislaus Reitenbach (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 13.08.2019 + * Author: Stanislaus Reitenbach (AT-TW) */ #ifndef GTPY_PYTHONSVGWIDGET_H diff --git a/src/module/processcomponents/gtpy_abstractscriptcomponent.cpp b/src/module/processcomponents/gtpy_abstractscriptcomponent.cpp index d2a5019..4780519 100644 --- a/src/module/processcomponents/gtpy_abstractscriptcomponent.cpp +++ b/src/module/processcomponents/gtpy_abstractscriptcomponent.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_abstractscriptcomponent.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 09.08.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 09.08.2023 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_abstractscriptcomponent.h" diff --git a/src/module/processcomponents/gtpy_abstractscriptcomponent.h b/src/module/processcomponents/gtpy_abstractscriptcomponent.h index a7a43f8..0d41ca2 100644 --- a/src/module/processcomponents/gtpy_abstractscriptcomponent.h +++ b/src/module/processcomponents/gtpy_abstractscriptcomponent.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_abstractscriptcomponent.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 09.08.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 09.08.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCOMPONENTASSISTANT_H diff --git a/src/module/processcomponents/gtpy_scriptcalculator.cpp b/src/module/processcomponents/gtpy_scriptcalculator.cpp index 666553e..5f50b33 100644 --- a/src/module/processcomponents/gtpy_scriptcalculator.cpp +++ b/src/module/processcomponents/gtpy_scriptcalculator.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scriptcalculator.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include "gt_package.h" diff --git a/src/module/processcomponents/gtpy_scriptcalculator.h b/src/module/processcomponents/gtpy_scriptcalculator.h index 2eef666..568eea4 100644 --- a/src/module/processcomponents/gtpy_scriptcalculator.h +++ b/src/module/processcomponents/gtpy_scriptcalculator.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scriptcalculator.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_SCRIPTCALCULATOR_H diff --git a/src/module/processcomponents/gtpy_task.cpp b/src/module/processcomponents/gtpy_task.cpp index 063a33d..a71c2e3 100644 --- a/src/module/processcomponents/gtpy_task.cpp +++ b/src/module/processcomponents/gtpy_task.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_task.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include "gt_package.h" diff --git a/src/module/processcomponents/gtpy_task.h b/src/module/processcomponents/gtpy_task.h index 35943fd..949d65b 100644 --- a/src/module/processcomponents/gtpy_task.h +++ b/src/module/processcomponents/gtpy_task.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_task.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_TASK_H diff --git a/src/module/utilities/gtpy_calculatorfactory.cpp b/src/module/utilities/gtpy_calculatorfactory.cpp index 6423209..4715728 100644 --- a/src/module/utilities/gtpy_calculatorfactory.cpp +++ b/src/module/utilities/gtpy_calculatorfactory.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpycalculatorfactory.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include "PythonQtPythonInclude.h" diff --git a/src/module/utilities/gtpy_calculatorfactory.h b/src/module/utilities/gtpy_calculatorfactory.h index 101a632..307859b 100644 --- a/src/module/utilities/gtpy_calculatorfactory.h +++ b/src/module/utilities/gtpy_calculatorfactory.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpycalculatorfactory.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCALCULATORFACTORY_H diff --git a/src/module/utilities/gtpy_codegenerator.cpp b/src/module/utilities/gtpy_codegenerator.cpp index 877095c..269eb48 100644 --- a/src/module/utilities/gtpy_codegenerator.cpp +++ b/src/module/utilities/gtpy_codegenerator.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_codegenerator.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 18.11.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 18.11.2019 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/utilities/gtpy_codegenerator.h b/src/module/utilities/gtpy_codegenerator.h index d7818bf..c7ca1e8 100644 --- a/src/module/utilities/gtpy_codegenerator.h +++ b/src/module/utilities/gtpy_codegenerator.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_codegenerator.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 18.11.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 18.11.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_CODEGENERATOR_H diff --git a/src/module/utilities/gtpy_constants.h b/src/module/utilities/gtpy_constants.h index 2dffae9..0f0b25e 100644 --- a/src/module/utilities/gtpy_constants.h +++ b/src/module/utilities/gtpy_constants.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_constants.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 29.03.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 29.03.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_CONSTANTS_H diff --git a/src/module/utilities/gtpy_contextmanager.cpp b/src/module/utilities/gtpy_contextmanager.cpp index 6373b41..5098b18 100644 --- a/src/module/utilities/gtpy_contextmanager.cpp +++ b/src/module/utilities/gtpy_contextmanager.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_contextmanager.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/utilities/gtpy_contextmanager.h b/src/module/utilities/gtpy_contextmanager.h index f3f4276..21ac946 100644 --- a/src/module/utilities/gtpy_contextmanager.h +++ b/src/module/utilities/gtpy_contextmanager.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_contextmanager.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_CONTEXTMANAGER_H diff --git a/src/module/utilities/gtpy_convert.cpp b/src/module/utilities/gtpy_convert.cpp index cda09d2..0abb37a 100644 --- a/src/module/utilities/gtpy_convert.cpp +++ b/src/module/utilities/gtpy_convert.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_convert.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 15.11.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 15.11.2023 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_convert.h" diff --git a/src/module/utilities/gtpy_convert.h b/src/module/utilities/gtpy_convert.h index 56b4184..995accd 100644 --- a/src/module/utilities/gtpy_convert.h +++ b/src/module/utilities/gtpy_convert.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_convert.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 15.11.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 15.11.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCONVERT_H diff --git a/src/module/utilities/gtpy_decorator.cpp b/src/module/utilities/gtpy_decorator.cpp index fabb434..37aafc8 100644 --- a/src/module/utilities/gtpy_decorator.cpp +++ b/src/module/utilities/gtpy_decorator.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_decorator.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/utilities/gtpy_decorator.h b/src/module/utilities/gtpy_decorator.h index 7ea39ed..93f0c9a 100644 --- a/src/module/utilities/gtpy_decorator.h +++ b/src/module/utilities/gtpy_decorator.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_decorator.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_DECORATOR_H diff --git a/src/module/utilities/gtpy_gilscope.cpp b/src/module/utilities/gtpy_gilscope.cpp index 9e0fb92..d1209cc 100644 --- a/src/module/utilities/gtpy_gilscope.cpp +++ b/src/module/utilities/gtpy_gilscope.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_threadsupport.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 17.12.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 17.12.2019 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_gilscope.h" diff --git a/src/module/utilities/gtpy_gilscope.h b/src/module/utilities/gtpy_gilscope.h index 91b2da7..39975bb 100644 --- a/src/module/utilities/gtpy_gilscope.h +++ b/src/module/utilities/gtpy_gilscope.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_threadsupport.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 17.12.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 17.12.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_THREADSUPPORT_H diff --git a/src/module/utilities/gtpy_globals.cpp b/src/module/utilities/gtpy_globals.cpp index a4de105..9062de3 100644 --- a/src/module/utilities/gtpy_globals.cpp +++ b/src/module/utilities/gtpy_globals.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_globals.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 11.05.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 11.05.2020 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_globals.h" diff --git a/src/module/utilities/gtpy_globals.h b/src/module/utilities/gtpy_globals.h index b99a4d7..e149fad 100644 --- a/src/module/utilities/gtpy_globals.h +++ b/src/module/utilities/gtpy_globals.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_globals.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 11.05.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 11.05.2020 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYGLOBALS_H diff --git a/src/module/utilities/gtpy_interruptrunnable.cpp b/src/module/utilities/gtpy_interruptrunnable.cpp index 7ef2e14..f2d2a7c 100644 --- a/src/module/utilities/gtpy_interruptrunnable.cpp +++ b/src/module/utilities/gtpy_interruptrunnable.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_interruptrunnable.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.12.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.12.2019 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_interruptrunnable.h" diff --git a/src/module/utilities/gtpy_interruptrunnable.h b/src/module/utilities/gtpy_interruptrunnable.h index 795e69f..5ee07cc 100644 --- a/src/module/utilities/gtpy_interruptrunnable.h +++ b/src/module/utilities/gtpy_interruptrunnable.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_interruptrunnable.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.12.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.12.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_INTERRUPTRUNNABLE_H diff --git a/src/module/utilities/gtpy_matplotlib.h b/src/module/utilities/gtpy_matplotlib.h index 10ccfc1..6653f56 100644 --- a/src/module/utilities/gtpy_matplotlib.h +++ b/src/module/utilities/gtpy_matplotlib.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_matplotlib.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.09.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.09.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_MATPLOTLIB_H diff --git a/src/module/utilities/gtpy_packageiteration.h b/src/module/utilities/gtpy_packageiteration.h index 4ebd3ec..d3ddded 100644 --- a/src/module/utilities/gtpy_packageiteration.h +++ b/src/module/utilities/gtpy_packageiteration.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_packageiteration.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 02.03.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 02.03.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_PACKAGEITERATION_H diff --git a/src/module/utilities/gtpy_processdatadistributor.cpp b/src/module/utilities/gtpy_processdatadistributor.cpp index 03058a4..2d91b1e 100644 --- a/src/module/utilities/gtpy_processdatadistributor.cpp +++ b/src/module/utilities/gtpy_processdatadistributor.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_processdatadistributor.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 29.01.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 29.01.2020 + * Author: Marvin Noethen (AT-TW) */ #include "gt_application.h" diff --git a/src/module/utilities/gtpy_processdatadistributor.h b/src/module/utilities/gtpy_processdatadistributor.h index 65cdb77..7a540c4 100644 --- a/src/module/utilities/gtpy_processdatadistributor.h +++ b/src/module/utilities/gtpy_processdatadistributor.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_processdatadistributor.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 29.01.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 29.01.2020 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_PROCESSDATADISTRIBUTOR_H diff --git a/src/module/utilities/gtpy_regexp.cpp b/src/module/utilities/gtpy_regexp.cpp index da069de..c46b001 100644 --- a/src/module/utilities/gtpy_regexp.cpp +++ b/src/module/utilities/gtpy_regexp.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_regexp.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 15.02.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 15.02.2023 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_regexp.h" diff --git a/src/module/utilities/gtpy_regexp.h b/src/module/utilities/gtpy_regexp.h index f2204ce..e9ce9a7 100644 --- a/src/module/utilities/gtpy_regexp.h +++ b/src/module/utilities/gtpy_regexp.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_regexp.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 15.02.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 15.02.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYREGEXP_H diff --git a/src/module/utilities/gtpy_scriptrunnable.cpp b/src/module/utilities/gtpy_scriptrunnable.cpp index 94650da..da8ac84 100644 --- a/src/module/utilities/gtpy_scriptrunnable.cpp +++ b/src/module/utilities/gtpy_scriptrunnable.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scriptrunner.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.12.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.12.2019 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_scriptrunnable.h" diff --git a/src/module/utilities/gtpy_scriptrunnable.h b/src/module/utilities/gtpy_scriptrunnable.h index 61d51f7..75a24d3 100644 --- a/src/module/utilities/gtpy_scriptrunnable.h +++ b/src/module/utilities/gtpy_scriptrunnable.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scriptrunner.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 16.12.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 16.12.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_SCRIPTRUNNER_H diff --git a/src/module/utilities/gtpy_tempdir.cpp b/src/module/utilities/gtpy_tempdir.cpp index e839865..cfa2071 100644 --- a/src/module/utilities/gtpy_tempdir.cpp +++ b/src/module/utilities/gtpy_tempdir.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_tempdir.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.09.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.09.2023 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/utilities/gtpy_tempdir.h b/src/module/utilities/gtpy_tempdir.h index db1b38a..b701740 100644 --- a/src/module/utilities/gtpy_tempdir.h +++ b/src/module/utilities/gtpy_tempdir.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_tempdir.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.09.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.09.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_TEMPDIR_H diff --git a/src/module/utilities/gtpy_threadscope.h b/src/module/utilities/gtpy_threadscope.h index 50accfe..71fac26 100644 --- a/src/module/utilities/gtpy_threadscope.h +++ b/src/module/utilities/gtpy_threadscope.h @@ -2,7 +2,7 @@ * * SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR) * - * Author: Martin Siggelr (AT-TWK) + * Author: Martin Siggel (AT-TWK) */ #ifndef GTPYTHREADSCOPE_H diff --git a/src/module/utilities/gtpy_transfer.cpp b/src/module/utilities/gtpy_transfer.cpp index 4a3d6f8..64ccef2 100644 --- a/src/module/utilities/gtpy_transfer.cpp +++ b/src/module/utilities/gtpy_transfer.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_transfer.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 15.02.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 15.02.2023 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_transfer.h" diff --git a/src/module/utilities/gtpy_transfer.h b/src/module/utilities/gtpy_transfer.h index ac2494b..1d3e797 100644 --- a/src/module/utilities/gtpy_transfer.h +++ b/src/module/utilities/gtpy_transfer.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_transfer.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 15.02.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 15.02.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYUTILITIES_H diff --git a/src/module/utilities/gtpypp.h b/src/module/utilities/gtpypp.h index 057c673..5c49980 100644 --- a/src/module/utilities/gtpypp.h +++ b/src/module/utilities/gtpypp.h @@ -1,6 +1,8 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpypp.h - * copyright 2024 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * * Author: Martin Siggel (martin.siggel@dlr.de) */ diff --git a/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp b/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp index 6bc9ddc..5b6a2be 100644 --- a/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp +++ b/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_calculatorsmodule.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 22.04.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 22.04.2020 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.h b/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.h index 7a20dde..2c26ba4 100644 --- a/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.h +++ b/src/module/utilities/pythonextensions/gtpy_calculatorsmodule.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_calculatorsmodule.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 22.04.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 22.04.2020 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYCALCULATORSMODULE_H diff --git a/src/module/utilities/pythonextensions/gtpy_createhelperfunction.cpp b/src/module/utilities/pythonextensions/gtpy_createhelperfunction.cpp index 02cfa7c..02adcaf 100644 --- a/src/module/utilities/pythonextensions/gtpy_createhelperfunction.cpp +++ b/src/module/utilities/pythonextensions/gtpy_createhelperfunction.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_createhelperfunction.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 26.02.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 26.02.2020 + * Author: Marvin Noethen (AT-TW) */ #include "PythonQt.h" diff --git a/src/module/utilities/pythonextensions/gtpy_createhelperfunction.h b/src/module/utilities/pythonextensions/gtpy_createhelperfunction.h index 7dfb983..58a93ff 100644 --- a/src/module/utilities/pythonextensions/gtpy_createhelperfunction.h +++ b/src/module/utilities/pythonextensions/gtpy_createhelperfunction.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_createhelperfunction.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 26.02.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 26.02.2020 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_CREATEHELPERFUNCTION_H diff --git a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp index a4b7b5c..a265a67 100644 --- a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp +++ b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_examplewrapper.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 18.02.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 18.02.2020 + * Author: Marvin Noethen (AT-TW) */ #include "PythonQt.h" diff --git a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h index 80cbf66..86ddab7 100644 --- a/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h +++ b/src/module/utilities/pythonextensions/gtpy_extendedwrapper.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_examplewrapper.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 18.02.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 18.02.2020 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_EXAMPLEWRAPPER_H diff --git a/src/module/utilities/pythonextensions/gtpy_importfunction.cpp b/src/module/utilities/pythonextensions/gtpy_importfunction.cpp index 5342c8d..ce88a8a 100644 --- a/src/module/utilities/pythonextensions/gtpy_importfunction.cpp +++ b/src/module/utilities/pythonextensions/gtpy_importfunction.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_importfunction.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 23.03.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 23.03.2020 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_globals.h" diff --git a/src/module/utilities/pythonextensions/gtpy_importfunction.h b/src/module/utilities/pythonextensions/gtpy_importfunction.h index e69392b..855d988 100644 --- a/src/module/utilities/pythonextensions/gtpy_importfunction.h +++ b/src/module/utilities/pythonextensions/gtpy_importfunction.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_importfunction.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 23.03.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 23.03.2020 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYIMPORTFUNCTION_H diff --git a/src/module/utilities/pythonextensions/gtpy_loggingmodule.cpp b/src/module/utilities/pythonextensions/gtpy_loggingmodule.cpp index d8d07b9..3e4788d 100644 --- a/src/module/utilities/pythonextensions/gtpy_loggingmodule.cpp +++ b/src/module/utilities/pythonextensions/gtpy_loggingmodule.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_loggingmodule.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 22.07.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 22.07.2020 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_loggingmodule.h" diff --git a/src/module/utilities/pythonextensions/gtpy_loggingmodule.h b/src/module/utilities/pythonextensions/gtpy_loggingmodule.h index a6bfa81..992193a 100644 --- a/src/module/utilities/pythonextensions/gtpy_loggingmodule.h +++ b/src/module/utilities/pythonextensions/gtpy_loggingmodule.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_loggingmodule.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 22.07.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 22.07.2020 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYLOGGINGMODULE_H diff --git a/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp b/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp index 64aa90b..cf5a4a6 100644 --- a/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp +++ b/src/module/utilities/pythonextensions/gtpy_propertysetter.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_propertysetter.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 26.02.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 26.02.2020 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/utilities/pythonextensions/gtpy_propertysetter.h b/src/module/utilities/pythonextensions/gtpy_propertysetter.h index b3f47d5..5b05be7 100644 --- a/src/module/utilities/pythonextensions/gtpy_propertysetter.h +++ b/src/module/utilities/pythonextensions/gtpy_propertysetter.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_propertysetter.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 26.02.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 26.02.2020 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_PROPERTYSETTER_H diff --git a/src/module/utilities/pythonextensions/gtpy_stdout.cpp b/src/module/utilities/pythonextensions/gtpy_stdout.cpp index 5e2e099..5fe5fd9 100644 --- a/src/module/utilities/pythonextensions/gtpy_stdout.cpp +++ b/src/module/utilities/pythonextensions/gtpy_stdout.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_stdout.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.01.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 13.01.2020 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_gilscope.h" diff --git a/src/module/utilities/pythonextensions/gtpy_stdout.h b/src/module/utilities/pythonextensions/gtpy_stdout.h index db848e9..c4f38fd 100644 --- a/src/module/utilities/pythonextensions/gtpy_stdout.h +++ b/src/module/utilities/pythonextensions/gtpy_stdout.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_stdout.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 13.01.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 13.01.2020 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_STDOUT_H diff --git a/src/module/widgets/gtpy_completer.cpp b/src/module/widgets/gtpy_completer.cpp index dbe86a6..49bb91a 100644 --- a/src/module/widgets/gtpy_completer.cpp +++ b/src/module/widgets/gtpy_completer.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_completer.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/widgets/gtpy_completer.h b/src/module/widgets/gtpy_completer.h index 06baa2e..8947ffd 100644 --- a/src/module/widgets/gtpy_completer.h +++ b/src/module/widgets/gtpy_completer.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_completer.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_COMPLETER_H diff --git a/src/module/widgets/gtpy_console.cpp b/src/module/widgets/gtpy_console.cpp index af9fc2a..72b5eed 100644 --- a/src/module/widgets/gtpy_console.cpp +++ b/src/module/widgets/gtpy_console.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_console.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include "iostream" diff --git a/src/module/widgets/gtpy_console.h b/src/module/widgets/gtpy_console.h index af4b61f..29b2aaf 100644 --- a/src/module/widgets/gtpy_console.h +++ b/src/module/widgets/gtpy_console.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_console.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_CONSOLE_H diff --git a/src/module/widgets/gtpy_lineedit.cpp b/src/module/widgets/gtpy_lineedit.cpp index 751220a..0f1964f 100644 --- a/src/module/widgets/gtpy_lineedit.cpp +++ b/src/module/widgets/gtpy_lineedit.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_lineedit.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 24.10.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 24.10.2023 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_lineedit.h" diff --git a/src/module/widgets/gtpy_lineedit.h b/src/module/widgets/gtpy_lineedit.h index dde93d6..2b08266 100644 --- a/src/module/widgets/gtpy_lineedit.h +++ b/src/module/widgets/gtpy_lineedit.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_lineedit.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 24.10.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 24.10.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYLINEEDIT_H diff --git a/src/module/widgets/gtpy_replacewidget.cpp b/src/module/widgets/gtpy_replacewidget.cpp index 7f86817..43b1cc5 100644 --- a/src/module/widgets/gtpy_replacewidget.cpp +++ b/src/module/widgets/gtpy_replacewidget.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_replacewidget.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 20.10.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 20.10.2023 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/widgets/gtpy_replacewidget.h b/src/module/widgets/gtpy_replacewidget.h index 5692610..7156702 100644 --- a/src/module/widgets/gtpy_replacewidget.h +++ b/src/module/widgets/gtpy_replacewidget.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_replacewidget.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 20.10.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 20.10.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYREPLACEWIDGET_H diff --git a/src/module/widgets/gtpy_scripteditor.cpp b/src/module/widgets/gtpy_scripteditor.cpp index f81c4d4..24c3af4 100644 --- a/src/module/widgets/gtpy_scripteditor.cpp +++ b/src/module/widgets/gtpy_scripteditor.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scripteditor.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/widgets/gtpy_scripteditor.h b/src/module/widgets/gtpy_scripteditor.h index 90dbde5..6d2c566 100644 --- a/src/module/widgets/gtpy_scripteditor.h +++ b/src/module/widgets/gtpy_scripteditor.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scripteditor.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_SCRIPTEDITOR_H diff --git a/src/module/widgets/gtpy_scripteditorwidget.cpp b/src/module/widgets/gtpy_scripteditorwidget.cpp index 95cd676..09581b0 100644 --- a/src/module/widgets/gtpy_scripteditorwidget.cpp +++ b/src/module/widgets/gtpy_scripteditorwidget.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scripteditorwidget.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.10.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.10.2023 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/widgets/gtpy_scripteditorwidget.h b/src/module/widgets/gtpy_scripteditorwidget.h index fc1460e..61e03c0 100644 --- a/src/module/widgets/gtpy_scripteditorwidget.h +++ b/src/module/widgets/gtpy_scripteditorwidget.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scripteditorwidget.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.10.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.10.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYSCRIPTEDITORWIDGET_H diff --git a/src/module/widgets/gtpy_scriptview.cpp b/src/module/widgets/gtpy_scriptview.cpp index 5986468..8d5ec01 100644 --- a/src/module/widgets/gtpy_scriptview.cpp +++ b/src/module/widgets/gtpy_scriptview.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scriptview.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.10.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.10.2023 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/widgets/gtpy_scriptview.h b/src/module/widgets/gtpy_scriptview.h index 8ba56ba..aa69311 100644 --- a/src/module/widgets/gtpy_scriptview.h +++ b/src/module/widgets/gtpy_scriptview.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scriptview.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.10.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.10.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYSCRIPTVIEW_H diff --git a/src/module/widgets/gtpy_taskdelegate.cpp b/src/module/widgets/gtpy_taskdelegate.cpp index 3fe0d6c..01ece6e 100644 --- a/src/module/widgets/gtpy_taskdelegate.cpp +++ b/src/module/widgets/gtpy_taskdelegate.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_taskdelegate.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/widgets/gtpy_taskdelegate.h b/src/module/widgets/gtpy_taskdelegate.h index d5edb0b..3b291da 100644 --- a/src/module/widgets/gtpy_taskdelegate.h +++ b/src/module/widgets/gtpy_taskdelegate.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_taskdelegate.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_TASKDELEGATE_H diff --git a/src/module/widgets/gtpy_tasktreeview.cpp b/src/module/widgets/gtpy_tasktreeview.cpp index 0ddba30..ed208d0 100644 --- a/src/module/widgets/gtpy_tasktreeview.cpp +++ b/src/module/widgets/gtpy_tasktreeview.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_tasktreeview.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/widgets/gtpy_tasktreeview.h b/src/module/widgets/gtpy_tasktreeview.h index 25bf0f1..6aad550 100644 --- a/src/module/widgets/gtpy_tasktreeview.h +++ b/src/module/widgets/gtpy_tasktreeview.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_tasktreeview.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_TASKTREEVIEW_H diff --git a/src/module/wizards/editor_settings/gtpy_editorsettings.cpp b/src/module/wizards/editor_settings/gtpy_editorsettings.cpp index e8b1050..5211675 100644 --- a/src/module/wizards/editor_settings/gtpy_editorsettings.cpp +++ b/src/module/wizards/editor_settings/gtpy_editorsettings.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_editorsettings.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.07.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.07.2021 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_editorsettings.h" diff --git a/src/module/wizards/editor_settings/gtpy_editorsettings.h b/src/module/wizards/editor_settings/gtpy_editorsettings.h index 449f6f5..79b8251 100644 --- a/src/module/wizards/editor_settings/gtpy_editorsettings.h +++ b/src/module/wizards/editor_settings/gtpy_editorsettings.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_editorsettings.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.07.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.07.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYEDITORSETTINGS_H diff --git a/src/module/wizards/editor_settings/gtpy_editorsettingsdialog.cpp b/src/module/wizards/editor_settings/gtpy_editorsettingsdialog.cpp index 181253d..a751f35 100644 --- a/src/module/wizards/editor_settings/gtpy_editorsettingsdialog.cpp +++ b/src/module/wizards/editor_settings/gtpy_editorsettingsdialog.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_editorsettingsdialog.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.07.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.07.2021 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/wizards/editor_settings/gtpy_editorsettingsdialog.h b/src/module/wizards/editor_settings/gtpy_editorsettingsdialog.h index 4e69ea4..d95ecce 100644 --- a/src/module/wizards/editor_settings/gtpy_editorsettingsdialog.h +++ b/src/module/wizards/editor_settings/gtpy_editorsettingsdialog.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_editorsettingsdialog.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.07.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.07.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYEDITORSETTINGSDIALOG_H diff --git a/src/module/wizards/editor_settings/pages/gtpy_abstractsettingspage.cpp b/src/module/wizards/editor_settings/pages/gtpy_abstractsettingspage.cpp index 5e5ccaf..b9cd97c 100644 --- a/src/module/wizards/editor_settings/pages/gtpy_abstractsettingspage.cpp +++ b/src/module/wizards/editor_settings/pages/gtpy_abstractsettingspage.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_abstractsettingspage.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.07.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.07.2021 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/wizards/editor_settings/pages/gtpy_abstractsettingspage.h b/src/module/wizards/editor_settings/pages/gtpy_abstractsettingspage.h index 6402faa..e5b35bf 100644 --- a/src/module/wizards/editor_settings/pages/gtpy_abstractsettingspage.h +++ b/src/module/wizards/editor_settings/pages/gtpy_abstractsettingspage.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_abstractsettingspage.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.07.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.07.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYABSTRACTSETTINGSPAGE_H diff --git a/src/module/wizards/editor_settings/pages/gtpy_generalpage.cpp b/src/module/wizards/editor_settings/pages/gtpy_generalpage.cpp index 6a4b7c0..ee2f4f1 100644 --- a/src/module/wizards/editor_settings/pages/gtpy_generalpage.cpp +++ b/src/module/wizards/editor_settings/pages/gtpy_generalpage.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_generalpage.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.07.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.07.2021 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/wizards/editor_settings/pages/gtpy_generalpage.h b/src/module/wizards/editor_settings/pages/gtpy_generalpage.h index c12e5ea..117bd39 100644 --- a/src/module/wizards/editor_settings/pages/gtpy_generalpage.h +++ b/src/module/wizards/editor_settings/pages/gtpy_generalpage.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_generalpage.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 19.07.2021 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 19.07.2021 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYGENERALPAGE_H diff --git a/src/module/wizards/gtpy_abstractscriptingwizardpage.cpp b/src/module/wizards/gtpy_abstractscriptingwizardpage.cpp index 72aca40..3ffeccc 100644 --- a/src/module/wizards/gtpy_abstractscriptingwizardpage.cpp +++ b/src/module/wizards/gtpy_abstractscriptingwizardpage.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_abstractscriptingwizardpage.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ // Qt includes diff --git a/src/module/wizards/gtpy_abstractscriptingwizardpage.h b/src/module/wizards/gtpy_abstractscriptingwizardpage.h index 7398298..beead4c 100644 --- a/src/module/wizards/gtpy_abstractscriptingwizardpage.h +++ b/src/module/wizards/gtpy_abstractscriptingwizardpage.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_abstractscriptingwizardpage.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_ABSTRACTSCRIPTINGWIZARDPAGE_H diff --git a/src/module/wizards/gtpy_wizardgeometries.cpp b/src/module/wizards/gtpy_wizardgeometries.cpp index f6d6a19..8cd1462 100644 --- a/src/module/wizards/gtpy_wizardgeometries.cpp +++ b/src/module/wizards/gtpy_wizardgeometries.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_wizardsettings.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 27.05.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 27.05.2020 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/module/wizards/gtpy_wizardgeometries.h b/src/module/wizards/gtpy_wizardgeometries.h index ead6d04..6429aec 100644 --- a/src/module/wizards/gtpy_wizardgeometries.h +++ b/src/module/wizards/gtpy_wizardgeometries.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_wizardsettings.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 27.05.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 27.05.2020 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYWIZARDGEOMETRIES_H diff --git a/src/module/wizards/gtpy_wizardgeometryitem.cpp b/src/module/wizards/gtpy_wizardgeometryitem.cpp index 012c607..f471549 100644 --- a/src/module/wizards/gtpy_wizardgeometryitem.cpp +++ b/src/module/wizards/gtpy_wizardgeometryitem.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_wizardsettingsitem.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 29.05.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 29.05.2020 + * Author: Marvin Noethen (AT-TW) */ #include "gtpy_wizardgeometryitem.h" diff --git a/src/module/wizards/gtpy_wizardgeometryitem.h b/src/module/wizards/gtpy_wizardgeometryitem.h index 47f70cf..caf3138 100644 --- a/src/module/wizards/gtpy_wizardgeometryitem.h +++ b/src/module/wizards/gtpy_wizardgeometryitem.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_wizardsettingsitem.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 29.05.2020 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 29.05.2020 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPYWIZARDGEOMETRIESITEM_H diff --git a/src/module/wizards/python_task/gtpy_taskwizardpage.cpp b/src/module/wizards/python_task/gtpy_taskwizardpage.cpp index b933d32..5c0338d 100644 --- a/src/module/wizards/python_task/gtpy_taskwizardpage.cpp +++ b/src/module/wizards/python_task/gtpy_taskwizardpage.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_taskwizardpage.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ // Qt includes diff --git a/src/module/wizards/python_task/gtpy_taskwizardpage.h b/src/module/wizards/python_task/gtpy_taskwizardpage.h index aa8cbd2..f5caf3e 100644 --- a/src/module/wizards/python_task/gtpy_taskwizardpage.h +++ b/src/module/wizards/python_task/gtpy_taskwizardpage.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_taskwizardpage.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_TASKWIZARDPAGE_H diff --git a/src/module/wizards/script_calculator/gtpy_scriptcalculatorwizardpage.cpp b/src/module/wizards/script_calculator/gtpy_scriptcalculatorwizardpage.cpp index 7bf1140..1605631 100644 --- a/src/module/wizards/script_calculator/gtpy_scriptcalculatorwizardpage.cpp +++ b/src/module/wizards/script_calculator/gtpy_scriptcalculatorwizardpage.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scriptcalculatorwizardpage.cpp - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ diff --git a/src/module/wizards/script_calculator/gtpy_scriptcalculatorwizardpage.h b/src/module/wizards/script_calculator/gtpy_scriptcalculatorwizardpage.h index 7ff754f..e2d7190 100644 --- a/src/module/wizards/script_calculator/gtpy_scriptcalculatorwizardpage.h +++ b/src/module/wizards/script_calculator/gtpy_scriptcalculatorwizardpage.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtpy_scriptcalculatorwizardpage.h - * copyright 2009-2018 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 12.08.2019 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 12.08.2019 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPY_SCRIPTCALCULATORWIZARDPAGE_H diff --git a/src/setup_module/gt_python_setup.cpp b/src/setup_module/gt_python_setup.cpp index 86c4d3b..3ef4912 100644 --- a/src/setup_module/gt_python_setup.cpp +++ b/src/setup_module/gt_python_setup.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gt_python_setup.cpp - * copyright 2009-2022 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 17.10.2022 - * Author: Marvin Nöthen (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 17.10.2022 + * Author: Marvin Nöthen (AT-TW) */ #include "gt_python_setup.h" diff --git a/src/setup_module/gt_python_setup.h b/src/setup_module/gt_python_setup.h index 45209b4..82d1041 100644 --- a/src/setup_module/gt_python_setup.h +++ b/src/setup_module/gt_python_setup.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gt_python_setup.h - * copyright 2009-2022 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 17.10.2022 - * Author: Marvin Nöthen (AT-TW) - * Tel.: +49 2203 601 2907 + * Created on: 17.10.2022 + * Author: Marvin Nöthen (AT-TW) */ #ifndef GTPYTHON_H diff --git a/src/setup_module/gtps_constants.h b/src/setup_module/gtps_constants.h index ef87fd7..43d8b01 100644 --- a/src/setup_module/gtps_constants.h +++ b/src/setup_module/gtps_constants.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtps_constants.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 22.03.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 22.03.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPS_CONSTANTS_H diff --git a/src/setup_module/gtps_globals.cpp b/src/setup_module/gtps_globals.cpp index 1f7d76f..79f2b29 100644 --- a/src/setup_module/gtps_globals.cpp +++ b/src/setup_module/gtps_globals.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtps_globals.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 30.11.2022 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 30.11.2022 + * Author: Marvin Noethen (AT-TW) */ #include diff --git a/src/setup_module/gtps_globals.h b/src/setup_module/gtps_globals.h index 65c6356..ffb9867 100644 --- a/src/setup_module/gtps_globals.h +++ b/src/setup_module/gtps_globals.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtps_globals.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 30.11.2022 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 30.11.2022 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPSGLOBALS_H diff --git a/src/setup_module/gtps_pythoninterpreter.cpp b/src/setup_module/gtps_pythoninterpreter.cpp index dcdc863..2ab67ba 100644 --- a/src/setup_module/gtps_pythoninterpreter.cpp +++ b/src/setup_module/gtps_pythoninterpreter.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtps_pythoninterpreter.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 20.10.2022 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 20.10.2022 + * Author: Marvin Noethen (AT-TW) */ #include "gtps_pythoninterpreter.h" diff --git a/src/setup_module/gtps_pythoninterpreter.h b/src/setup_module/gtps_pythoninterpreter.h index f5302e5..c6afce4 100644 --- a/src/setup_module/gtps_pythoninterpreter.h +++ b/src/setup_module/gtps_pythoninterpreter.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtps_pythoninterpreter.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 20.10.2022 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 20.10.2022 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPSPYTHONINTERPRETER_H diff --git a/src/setup_module/gtps_systemsettings.cpp b/src/setup_module/gtps_systemsettings.cpp index e6de43c..31dfd74 100644 --- a/src/setup_module/gtps_systemsettings.cpp +++ b/src/setup_module/gtps_systemsettings.cpp @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtps_systemsettings.cpp - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 18.01.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 18.01.2023 + * Author: Marvin Noethen (AT-TW) */ #include "gt_environment.h" diff --git a/src/setup_module/gtps_systemsettings.h b/src/setup_module/gtps_systemsettings.h index 0d40642..9cc6bbe 100644 --- a/src/setup_module/gtps_systemsettings.h +++ b/src/setup_module/gtps_systemsettings.h @@ -1,10 +1,11 @@ /* GTlab - Gas Turbine laboratory * Source File: gtps_systemsettings.h - * copyright 2009-2019 by DLR + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * - * Created on: 18.01.2023 - * Author: Marvin Noethen (AT-TW) - * Tel.: +49 2203 601 2692 + * Created on: 18.01.2023 + * Author: Marvin Noethen (AT-TW) */ #ifndef GTPSSYSTEMSETTINGS_H From 19ff330998ff203f1b9c2fac706f1ae4fe2c861a Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 29 May 2024 15:44:01 +0200 Subject: [PATCH 039/130] Added license headers --- .reuse/dep5 | 13 +- CMakeLists.txt | 3 + LICENSES/MPL-2.0.txt | 373 ++++++++++++++++++ cmake/FindPythonQt.cmake | 3 + cmake/GTlabPythonConfig.in | 3 + examples/ExternalPyModule.py | 3 + examples/example_batch_script.py | 3 + features/package_template.xml | 13 - src/batch/CMakeLists.txt | 3 + src/module/CMakeLists.txt | 3 + src/module/gt_compat.h | 6 + src/module/utilities/gtpy_threadscope.h | 3 +- src/setup_module/CMakeLists.txt | 3 + .../gtps_pythonpreferencepage.cpp | 8 + src/setup_module/gtps_pythonpreferencepage.h | 8 + tests/unittests/CMakeLists.txt | 3 + tests/unittests/main.cpp | 6 + tests/unittests/test_helper.h | 7 + tests/unittests/test_variantconvert.cpp | 6 + 19 files changed, 449 insertions(+), 21 deletions(-) create mode 100644 LICENSES/MPL-2.0.txt delete mode 100644 features/package_template.xml diff --git a/.reuse/dep5 b/.reuse/dep5 index 1bb5be7..69f8cd7 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -3,17 +3,16 @@ Upstream-Name: GTlabPython Upstream-Contact: <> Source: -Files: .github/* -Copyright: 2023 German Aerospace Center (DLR) +Files: .github/* README.md CHANGELOG.md src/module/*.json src/setup_module/*.json +Copyright: 2024 German Aerospace Center (DLR) License: Apache-2.0 -Files: images/*.png -Copyright: 2023 German Aerospace Center (DLR) +Files: images/* +Copyright: 2024 German Aerospace Center (DLR) License: CC-BY-SA-4.0 -# sample test project files -Files: tests/**/*.gt* -Copyright: 2023 German Aerospace Center (DLR) +Files: .bumpversion.cfg .gitignore .gitlab/* .gitlab-ci.yml +Copyright: 2024 German Aerospace Center (DLR) License: CC0-1.0 diff --git a/CMakeLists.txt b/CMakeLists.txt index d01a647..44c175e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,9 @@ # ____/ /_/ /_/\__,_/_.___/ ###################################################################### +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + cmake_minimum_required(VERSION 3.15) project(GTlab-Python VERSION 1.5.0) diff --git a/LICENSES/MPL-2.0.txt b/LICENSES/MPL-2.0.txt new file mode 100644 index 0000000..ee6256c --- /dev/null +++ b/LICENSES/MPL-2.0.txt @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/cmake/FindPythonQt.cmake b/cmake/FindPythonQt.cmake index abf6eae..f5aad70 100644 --- a/cmake/FindPythonQt.cmake +++ b/cmake/FindPythonQt.cmake @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + include(CMakeFindDependencyMacro ) find_dependency(Python3 COMPONENTS Development) diff --git a/cmake/GTlabPythonConfig.in b/cmake/GTlabPythonConfig.in index 3befd4b..31ed43f 100644 --- a/cmake/GTlabPythonConfig.in +++ b/cmake/GTlabPythonConfig.in @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + include(CMakeFindDependencyMacro) find_dependency(Qt5 COMPONENTS Core Widgets Xml) diff --git a/examples/ExternalPyModule.py b/examples/ExternalPyModule.py index e487b35..b704c9f 100644 --- a/examples/ExternalPyModule.py +++ b/examples/ExternalPyModule.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + #For using this external module in a Python Task insert the following lines #to the GTlab Python Editor. #import sys diff --git a/examples/example_batch_script.py b/examples/example_batch_script.py index e9bb0b4..4e8c47c 100644 --- a/examples/example_batch_script.py +++ b/examples/example_batch_script.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + print ("##############-script-starts-###############") init() diff --git a/features/package_template.xml b/features/package_template.xml deleted file mode 100644 index aa78781..0000000 --- a/features/package_template.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - gtlab-python-module - 03_core_modules - de.dlr.gtlab.dev.{RELEASESTATUS}.{FRAMEWORK_MAJOR}.{FRAMEWORK_MINOR}.modules.python37 - GTlab Python Module Libraries for Python 3.7 - Libraries for Python GTlab module (Python 3.7). - {RELEASEDATE} - {VERSION} - 201 - false - de.dlr.gtlab.dev.{RELEASESTATUS}.{FRAMEWORK_MAJOR}.{FRAMEWORK_MINOR}.core, de.dlr.gtlab.dev.{RELEASESTATUS}.{FRAMEWORK_MAJOR}.{FRAMEWORK_MINOR}.logging, de.dlr.gtlab.dev.{RELEASESTATUS}.{FRAMEWORK_MAJOR}.{FRAMEWORK_MINOR}.thirdpartylibs.python37, de.dlr.gtlab.dev.{RELEASESTATUS}.{FRAMEWORK_MAJOR}.{FRAMEWORK_MINOR}.thirdpartylibs.pythonqt37 - diff --git a/src/batch/CMakeLists.txt b/src/batch/CMakeLists.txt index 1438e10..0773d2b 100644 --- a/src/batch/CMakeLists.txt +++ b/src/batch/CMakeLists.txt @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + # python batch application set (SOURCES diff --git a/src/module/CMakeLists.txt b/src/module/CMakeLists.txt index ca846e2..afd4d20 100644 --- a/src/module/CMakeLists.txt +++ b/src/module/CMakeLists.txt @@ -6,6 +6,9 @@ # ###################################################################### +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) diff --git a/src/module/gt_compat.h b/src/module/gt_compat.h index 68985ac..8fba91c 100644 --- a/src/module/gt_compat.h +++ b/src/module/gt_compat.h @@ -1,3 +1,9 @@ +/* GTlab - Gas Turbine laboratory + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + */ + #ifndef GT_COMPAT_H #define GT_COMPAT_H diff --git a/src/module/utilities/gtpy_threadscope.h b/src/module/utilities/gtpy_threadscope.h index 71fac26..94b6d37 100644 --- a/src/module/utilities/gtpy_threadscope.h +++ b/src/module/utilities/gtpy_threadscope.h @@ -1,6 +1,7 @@ /* GTlab - Gas Turbine laboratory * - * SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR) + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) * * Author: Martin Siggel (AT-TWK) */ diff --git a/src/setup_module/CMakeLists.txt b/src/setup_module/CMakeLists.txt index 1195cd8..69d7692 100644 --- a/src/setup_module/CMakeLists.txt +++ b/src/setup_module/CMakeLists.txt @@ -6,6 +6,9 @@ # ###################################################################### +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + # only for GTlab 2.x if (GTlab_VERSION_MAJOR LESS 2) diff --git a/src/setup_module/gtps_pythonpreferencepage.cpp b/src/setup_module/gtps_pythonpreferencepage.cpp index f210cff..724c19f 100644 --- a/src/setup_module/gtps_pythonpreferencepage.cpp +++ b/src/setup_module/gtps_pythonpreferencepage.cpp @@ -1,3 +1,11 @@ +/* GTlab - Gas Turbine laboratory + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + * + * Author: Martin Siggel (AT-TWK) + */ + #include "gtps_pythonpreferencepage.h" #include "ui_gtps_pythonpreferencepage.h" diff --git a/src/setup_module/gtps_pythonpreferencepage.h b/src/setup_module/gtps_pythonpreferencepage.h index bd6482f..f8e72d5 100644 --- a/src/setup_module/gtps_pythonpreferencepage.h +++ b/src/setup_module/gtps_pythonpreferencepage.h @@ -1,3 +1,11 @@ +/* GTlab - Gas Turbine laboratory + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + * + * Author: Martin Siggel (AT-TWK) + */ + #ifndef GTPS_PYTHONPREFERENCEPAGE_H #define GTPS_PYTHONPREFERENCEPAGE_H diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index 379ab48..2e39786 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + project(GTlabPython-UnitTests) if (NOT TARGET Qt5::Core) diff --git a/tests/unittests/main.cpp b/tests/unittests/main.cpp index 1d8ff1c..c12c204 100644 --- a/tests/unittests/main.cpp +++ b/tests/unittests/main.cpp @@ -1,3 +1,9 @@ +/* GTlab - Gas Turbine laboratory + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + */ + #include "gtest/gtest.h" #include diff --git a/tests/unittests/test_helper.h b/tests/unittests/test_helper.h index 59ea589..ff2c9d7 100644 --- a/tests/unittests/test_helper.h +++ b/tests/unittests/test_helper.h @@ -1,3 +1,10 @@ +/* GTlab - Gas Turbine laboratory + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + */ + + #ifndef TEST_HELPER_H #define TEST_HELPER_H diff --git a/tests/unittests/test_variantconvert.cpp b/tests/unittests/test_variantconvert.cpp index 0f10b53..0507243 100644 --- a/tests/unittests/test_variantconvert.cpp +++ b/tests/unittests/test_variantconvert.cpp @@ -1,3 +1,9 @@ +/* GTlab - Gas Turbine laboratory + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + */ + #include #include "test_helper.h" From 48e4812d1a3bba93c72d6d2f3d8c9d1c24169a49 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 29 May 2024 15:45:29 +0200 Subject: [PATCH 040/130] Added missing bsl license --- LICENSES/BSL-1.0.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 LICENSES/BSL-1.0.txt diff --git a/LICENSES/BSL-1.0.txt b/LICENSES/BSL-1.0.txt new file mode 100644 index 0000000..36b7cd9 --- /dev/null +++ b/LICENSES/BSL-1.0.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. From 646337fe1bddfa72f1bba456e816976beed6561e Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Wed, 29 May 2024 15:47:29 +0200 Subject: [PATCH 041/130] Added missing MIT license --- LICENSES/MIT.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 LICENSES/MIT.txt diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 0000000..1617f50 --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,20 @@ +The MIT License (MIT) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + From 235925c023a0a9ac00f45569b1e8a79bcc8c8b45 Mon Sep 17 00:00:00 2001 From: Martin Siggel Date: Mon, 3 Jun 2024 13:32:18 +0200 Subject: [PATCH 042/130] Added missing licenses + license check job --- .clang-format | 3 + .gitlab-ci.yml | 16 +- LICENSES/BSD-3-Clause.txt | 29 + features/doxygenConfig | 2656 ----------------- features/filefilter.txt | 50 - features/gt-logo.png | Bin 9185 -> 0 bytes src/batch/batch-script.rc.license | 2 + src/batch/icon.ico.license | 2 + src/setup_module/find_libpython.h | 5 + .../gtps_pythonpreferencepage.ui.license | 4 + style.astylerc | 41 - tests/unittests/cmake/AddGoogleTest.cmake | 18 +- 12 files changed, 68 insertions(+), 2758 deletions(-) create mode 100644 LICENSES/BSD-3-Clause.txt delete mode 100644 features/doxygenConfig delete mode 100644 features/filefilter.txt delete mode 100644 features/gt-logo.png create mode 100644 src/batch/batch-script.rc.license create mode 100644 src/batch/icon.ico.license create mode 100644 src/setup_module/gtps_pythonpreferencepage.ui.license delete mode 100644 style.astylerc diff --git a/.clang-format b/.clang-format index d521688..d2601db 100644 --- a/.clang-format +++ b/.clang-format @@ -1,3 +1,6 @@ +#SPDX-License-Identifier: CC0-1.0 +#SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR) + BasedOnStyle: Microsoft IndentWidth: 4 AlwaysBreakAfterReturnType: TopLevelDefinitions diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2fcfc00..63f5488 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -170,16 +170,24 @@ code-coverage: paths: - "test-coverage" -# code quality -codingstyle: - stage: codequality - extends: .codingStyleTemplate cppcheck: stage: codequality extends: .cppCheckTemplate allow_failure: true +check-license: + stage: codequality + tags: ["docker", "linux"] + needs: [] + image: at-twk-hal9000.intra.dlr.de:5000/dlr-at/buster-dev + before_script: + - python3 -m pip install reuse + script: + - reuse lint + variables: + GIT_SUBMODULE_STRATEGY: "none" + pages: stage: badges extends: .pageTemplate diff --git a/LICENSES/BSD-3-Clause.txt b/LICENSES/BSD-3-Clause.txt new file mode 100644 index 0000000..e466b0d --- /dev/null +++ b/LICENSES/BSD-3-Clause.txt @@ -0,0 +1,29 @@ +Copyright (c) 2016 Wenzel Jakob , All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Please also refer to the file .github/CONTRIBUTING.md, which clarifies licensing of +external contributions to this project including patches, pull requests, etc. diff --git a/features/doxygenConfig b/features/doxygenConfig deleted file mode 100644 index 1e9660a..0000000 --- a/features/doxygenConfig +++ /dev/null @@ -1,2656 +0,0 @@ -# Doxyfile 1.9.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the configuration -# file that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# https://www.gnu.org/software/libiconv/ for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = $(TARGETNAME) - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = $(CI_COMMIT_REF_NAME) - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = $(TARGETNAME) - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = ./features/gt-logo.png - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = ./doc/ - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all generated output in the proper direction. -# Possible values are: None, LTR, RTL and Context. -# The default value is: None. - -OUTPUT_TEXT_DIRECTION = None - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line -# such as -# /*************** -# as being the beginning of a Javadoc-style comment "banner". If set to NO, the -# Javadoc-style will behave just like regular comments and it will not be -# interpreted by doxygen. -# The default value is: NO. - -JAVADOC_BANNER = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# By default Python docstrings are displayed as preformatted text and doxygen's -# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the -# doxygen's special commands can be used and the contents of the docstring -# documentation blocks is shown as doxygen documentation. -# The default value is: YES. - -PYTHON_DOCSTRING = YES - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines (in the resulting output). You can put ^^ in the value part of an -# alias to insert a newline as if a physical newline was in the original file. -# When you need a literal { or } or , in the value part of an alias you have to -# escape them by means of a backslash (\), this can lead to conflicts with the -# commands \{ and \} for these it is advised to use the version @{ and @} or use -# a double escape (\\{ and \\}) - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice -# sources only. Doxygen will then generate output that is more tailored for that -# language. For instance, namespaces will be presented as modules, types will be -# separated into more groups, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_SLICE = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, -# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, -# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: -# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser -# tries to guess whether the code is fixed or free formatted code, this is the -# default for Fortran type files). For instance to make doxygen treat .inc files -# as Fortran files (default is PHP), and .f files as C (default is Fortran), -# use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. When specifying no_extension you should add -# * to the FILE_PATTERNS. -# -# Note see also the list of default file extension mappings. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See https://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up -# to that level are automatically included in the table of contents, even if -# they do not have an id attribute. -# Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 5. -# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. - -TOC_INCLUDE_HEADINGS = 5 - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# If one adds a struct or class to a group and this option is enabled, then also -# any nested class or struct is added to the same group. By default this option -# is disabled and one has to add nested compounds explicitly via \ingroup. -# The default value is: NO. - -GROUP_NESTED_COMPOUNDS = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use -# during processing. When set to 0 doxygen will based this on the number of -# cores available in the system. You can set it explicitly to a value larger -# than 0 to get more control over the balance between CPU load and processing -# speed. At this moment only the input processing can be done using multiple -# threads. Since this is still an experimental feature the default is set to 1, -# which efficively disables parallel processing. Please report any issues you -# encounter. Generating dot graphs in parallel is controlled by the -# DOT_NUM_THREADS setting. -# Minimum value: 0, maximum value: 32, default value: 1. - -NUM_PROC_THREADS = 1 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual -# methods of a class will be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIV_VIRTUAL = NO - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. If set to YES, local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO, only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If this flag is set to YES, the name of an unnamed parameter in a declaration -# will be determined by the corresponding definition. By default unnamed -# parameters remain unnamed in the output. -# The default value is: YES. - -RESOLVE_UNNAMED_PARAMS = YES - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# declarations. If set to NO, these declarations will be included in the -# documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# With the correct setting of option CASE_SENSE_NAMES doxygen will better be -# able to match the capabilities of the underlying filesystem. In case the -# filesystem is case sensitive (i.e. it supports files in the same directory -# whose names only differ in casing), the option must be set to YES to properly -# deal with such files in case they appear in the input. For filesystems that -# are not case sensitive the option should be be set to NO to properly deal with -# output files written for symbols that only differ in casing, such as for two -# classes, one named CLASS and the other named Class, and to also support -# references to files without having to specify the exact matching casing. On -# Windows (including Cygwin) and MacOS, users should typically set this option -# to NO, whereas on Linux or other Unix flavors it should typically be set to -# YES. -# The default value is: system dependent. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. If -# EXTRACT_ALL is set to YES then this flag will automatically be disabled. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS -# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but -# at the end of the doxygen process doxygen will return with a non-zero status. -# Possible values are: NO, YES and FAIL_ON_WARNINGS. -# The default value is: NO. - -WARN_AS_ERROR = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING -# Note: If this tag is empty the current directory is searched. - -INPUT = src README.md - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: -# https://www.gnu.org/software/libiconv/) for the list of possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# read by doxygen. -# -# Note the list of default checked file patterns might differ from the list of -# default file extension mappings. -# -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), -# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl, -# *.ucf, *.qsf and *.ice. - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.idl \ - *.ddl \ - *.odl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.cs \ - *.d \ - *.php \ - *.php4 \ - *.php5 \ - *.phtml \ - *.inc \ - *.m \ - *.markdown \ - *.md \ - *.mm \ - *.dox \ - *.py \ - *.pyw \ - *.f90 \ - *.f95 \ - *.f03 \ - *.f08 \ - *.f18 \ - *.f \ - *.for \ - *.vhd \ - *.vhdl \ - *.ucf \ - *.qsf \ - *.ice - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = README.md - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# entity all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see https://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: -# http://clang.llvm.org/) for more accurate parsing at the cost of reduced -# performance. This can be particularly helpful with template rich C++ code for -# which doxygen's built-in parser lacks the necessary type information. -# Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse_libclang=ON option for CMake. -# The default value is: NO. - -CLANG_ASSISTED_PARSING = NO - -# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to -# YES then doxygen will add the directory of each input to the include path. -# The default value is: YES. - -CLANG_ADD_INC_PATHS = YES - -# If clang assisted parsing is enabled you can provide the compiler with command -# line options that you would normally use when invoking the compiler. Note that -# the include paths will already be set by doxygen for the files and directories -# specified with INPUT and INCLUDE_PATH. -# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. - -CLANG_OPTIONS = - -# If clang assisted parsing is enabled you can provide the clang parser with the -# path to the directory containing a file called compile_commands.json. This -# file is the compilation database (see: -# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the -# options used when the source files were built. This is equivalent to -# specifying the -p option to a clang tool, such as clang-check. These options -# will then be passed to the parser. Any options specified with CLANG_OPTIONS -# will be added as well. -# Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse_libclang=ON option for CMake. - -CLANG_DATABASE_PATH = - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# https://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = NO - -# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML -# documentation will contain a main index with vertical navigation menus that -# are dynamically created via JavaScript. If disabled, the navigation index will -# consists of multiple levels of tabs that are statically embedded in every HTML -# page. Disable this option to support browsers that do not have JavaScript, -# like the Qt help browser. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_MENUS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: -# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To -# create a documentation set, doxygen will generate a Makefile in the HTML -# output directory. Running make will produce the docset in that directory and -# running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy -# genXcode/_index.html for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: -# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the main .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: -# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: -# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: -# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: -# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location (absolute path -# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to -# run qhelpgenerator on the generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg -# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see -# https://inkscape.org) to generate formulas as SVG images instead of PNGs for -# the HTML output. These images will generally look nicer at scaled resolutions. -# Possible values are: png (the default) and svg (looks nicer but requires the -# pdf2svg or inkscape tool). -# The default value is: png. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FORMULA_FORMAT = png - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANSPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands -# to create new LaTeX commands to be used in formulas as building blocks. See -# the section "Including formulas" for details. - -FORMULA_MACROFILE = - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# https://www.mathjax.org) which uses client side JavaScript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from https://www.mathjax.org before deployment. -# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2 - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: -# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /