From: vsr Date: Thu, 24 Mar 2016 11:13:41 +0000 (+0300) Subject: Merge branch 'V7_dev' X-Git-Tag: V8_1_0a1~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d6bd12111347879cd8dbe1a15ac4d6ba32ce0d6b;p=modules%2Fgui.git Merge branch 'V7_dev' --- d6bd12111347879cd8dbe1a15ac4d6ba32ce0d6b diff --cc adm_local/cmake_files/UsePyQt.cmake index c9f747780,000000000..1c07ecd5c mode 100644,000000..100644 --- a/adm_local/cmake_files/UsePyQt.cmake +++ b/adm_local/cmake_files/UsePyQt.cmake @@@ -1,161 -1,0 +1,161 @@@ - # Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE ++# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +INCLUDE(UseSIP) + +#################################################################### +# +# _PYQT_WRAP_GET_UNIQUE_TARGET_NAME: internal function +# +# Used to generate unique custom target name for usage in +# PYQT_WRAP_UIC macro. +# +# USAGE: _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(prefix unique_name) +# +# ARGUMENTS: +# prefix [in] prefix for the name +# unique_name [out] unique name generated by function +# +#################################################################### +FUNCTION(_PYQT_WRAP_GET_UNIQUE_TARGET_NAME name unique_name) + SET(_propertyName "_PYQT_WRAP_UNIQUE_COUNTER_${name}") + GET_PROPERTY(_currentCounter GLOBAL PROPERTY "${_propertyName}") + IF(NOT _currentCounter) + SET(_currentCounter 1) + ENDIF() + SET(${unique_name} "${name}_${_currentCounter}" PARENT_SCOPE) + MATH(EXPR _currentCounter "${_currentCounter} + 1") + SET_PROPERTY(GLOBAL PROPERTY ${_propertyName} ${_currentCounter} ) +ENDFUNCTION() + +#################################################################### +# +# PYQT_WRAP_UIC macro +# +# Create Python modules by processing input *.ui (Qt designer) files with +# PyQt pyuic tool. +# +# USAGE: PYQT_WRAP_UIC(output_files pyuic_files) +# +# ARGUMENTS: +# output_files [out] variable where output file names are listed to +# pyuic_files [in] list of *.ui files +# +# NOTES: +# - Input files are considered relative to the current source directory. +# - Output files are generated in the current build directory. +# - Macro automatically adds custom build target to generate output files +# +#################################################################### +MACRO(PYQT_WRAP_UIC outfiles) + + IF(NOT WIN32) + + FOREACH(_input ${ARGN}) + GET_FILENAME_COMPONENT(_input_name ${_input} NAME) + STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name}) + SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name}) + ADD_CUSTOM_COMMAND( + OUTPUT ${_output} + COMMAND ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input} + MAIN_DEPENDENCY ${_input} + ) + SET(${outfiles} ${${outfiles}} ${_output}) + ENDFOREACH() + _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName) + ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}}) + + ELSE(NOT WIN32) + +#### +# ANA: Workaround for the Microsoft Visual Studio 2010. Seems there is a bug in +# the Microsoft Visual Studio 2010 or CMake 2.8.10.2: custom target doesn't work +# for the list of the dependencies. It works only for the first dependency in the +# list. So generate separate target for the each input file. This problem will be +#investigated in the future. +#### + + SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) + _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName) + ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL) + FOREACH(_input ${ARGN}) + GET_FILENAME_COMPONENT(_input_name ${_input} NAME) + STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name}) + SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name}) + _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _TgName) + ADD_CUSTOM_TARGET(${_TgName} ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input} + DEPENDS ${_input} + ) + SET_TARGET_PROPERTIES(${_TgName} PROPERTIES FOLDER PYQT_WRAP_UIC_TARGETS) + ADD_DEPENDENCIES(${_uniqueTargetName} DEPEND ${_TgName}) + SET(${outfiles} ${${outfiles}} ${_output}) + ENDFOREACH() + ENDIF(NOT WIN32) +ENDMACRO(PYQT_WRAP_UIC) + +#################################################################### +# +# PYQT_WRAP_SIP macro +# +# Generate C++ wrappings for *.sip files by processing them with sip. +# +# USAGE: PYQT_WRAP_SIP(output_files sip_file [sip_file...] [OPTIONS options] [SOURCES sources]) +# +# NOTES: See SIP_WRAP_SIP macro from UseSIP.cmake for the usage description. +# +#################################################################### +MACRO(PYQT_WRAP_SIP outfiles) + SIP_WRAP_SIP(${outfiles} ${ARGN} OPTIONS ${PYQT_SIPFLAGS}) +ENDMACRO(PYQT_WRAP_SIP) + +#################################################################### +# +# PYQT_WRAP_QRC macro +# +# Generate Python wrappings for *.qrc files by processing them with pyrcc5. +# +# USAGE: PYQT_WRAP_QRC(output_files qrc_files) +# +# ARGUMENTS: +# output_files [out] variable where output file names are listed to +# qrc_files [in] list of *.qrc files +# +# NOTES: +# - Input files are considered relative to the current source directory. +# - Output files are generated in the current build directory. +# - Macro automatically adds custom build target to generate output files +# +#################################################################### + +MACRO(PYQT_WRAP_QRC outfiles) + FOREACH(_input ${ARGN}) + GET_FILENAME_COMPONENT(_input_name ${_input} NAME) + STRING(REPLACE ".qrc" "_qrc.py" _input_name ${_input_name}) + SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name}) + ADD_CUSTOM_COMMAND( + OUTPUT ${_output} + COMMAND ${PYQT_PYRCC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input} + MAIN_DEPENDENCY ${_input} + ) + SET(${outfiles} ${${outfiles}} ${_output}) + ENDFOREACH() + _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_QRC_PY_FILES _uniqueTargetName) + ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}}) +ENDMACRO(PYQT_WRAP_QRC) diff --cc adm_local/cmake_files/UseQtExt.cmake index 03e40f2ac,000000000..95985b7b7 mode 100644,000000..100644 --- a/adm_local/cmake_files/UseQtExt.cmake +++ b/adm_local/cmake_files/UseQtExt.cmake @@@ -1,68 -1,0 +1,68 @@@ - # Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE ++# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +IF (QT_VERSION VERSION_LESS "5.0") + INCLUDE(${QT_USE_FILE}) +ENDIF() + +INSTALL(CODE "MACRO(QT_COMPILE_TS_ON_INSTALL MYLRELEASE MYTSFILE MYFULLDIR MYOUTQMFILE) + FILE(MAKE_DIRECTORY \${MYFULLDIR}) + MESSAGE(STATUS \"Compiling \${MYTSFILE}\") + EXECUTE_PROCESS(COMMAND \${MYLRELEASE} \${MYTSFILE} -qm \${MYFULLDIR}/\${MYOUTQMFILE}) +ENDMACRO(QT_COMPILE_TS_ON_INSTALL)") + +# This MACRO uses the following vars +# - QT_LRELEASE_EXECUTABLE : (given by default by FindQT.cmake) +# +# MYTSFILES containing all ts files to be compiled. +# WHERETOINSTALL contains directory (relative to install_prefix) where to install files after compilation of ts files too qm. +MACRO(QT_INSTALL_TS_RESOURCES MYTSFILES WHERETOINSTALL) + INSTALL(CODE "SET(INSTALL_TS_DIR ${WHERETOINSTALL})") + SET(MYSOURCES) + FOREACH(input ${MYTSFILES}) + GET_FILENAME_COMPONENT(input2 ${input} NAME) + STRING(REGEX REPLACE ".ts" "" base ${input2}) + SET(output "${base}.qm") + INSTALL(CODE "QT_COMPILE_TS_ON_INSTALL( \"${QT_LRELEASE_EXECUTABLE}\" \"${CMAKE_CURRENT_SOURCE_DIR}/${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_TS_DIR}\" ${output})") + ENDFOREACH(input ${MYIDLFILES}) +ENDMACRO(QT_INSTALL_TS_RESOURCES) + +MACRO(QT_WRAP_MOC) +IF (QT_VERSION VERSION_LESS "5.0") + QT4_WRAP_CPP(${ARGN}) +ELSE() + QT5_WRAP_CPP(${ARGN}) +ENDIF() +ENDMACRO(QT_WRAP_MOC) + +MACRO(QT_WRAP_UIC) +IF (QT_VERSION VERSION_LESS "5.0") + QT4_WRAP_UI(${ARGN}) +ELSE() + QT5_WRAP_UI(${ARGN}) +ENDIF() +ENDMACRO(QT_WRAP_UIC) + +MACRO(QT_ADD_RESOURCES) +IF (QT_VERSION VERSION_LESS "5.0") + QT4_ADD_RESOURCES(${ARGN}) +ELSE() + QT5_ADD_RESOURCES(${ARGN}) +ENDIF() +ENDMACRO(QT_ADD_RESOURCES) diff --cc src/CAF/CMakeLists.txt index a34448604,29b844282..6872baf2c --- a/src/CAF/CMakeLists.txt +++ b/src/CAF/CMakeLists.txt @@@ -86,4 -86,4 +86,4 @@@ TARGET_LINK_LIBRARIES(caf ${QT_LIBRARIE INSTALL(TARGETS caf EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(FILES ${caf_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) - QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") -QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") ++QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") diff --cc src/CAM/CMakeLists.txt index 012c32b5e,bb2f139a4..206f88e45 --- a/src/CAM/CMakeLists.txt +++ b/src/CAM/CMakeLists.txt @@@ -88,4 -88,4 +88,4 @@@ TARGET_LINK_LIBRARIES(CAM ${_link_LIBRA INSTALL(TARGETS CAM EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(FILES ${CAM_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) - QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") -QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") ++QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") diff --cc src/GUI_PY/dockwidgets.py index 2d370e905,e6e10bcf9..08a9bc77b --- a/src/GUI_PY/dockwidgets.py +++ b/src/GUI_PY/dockwidgets.py @@@ -1,4 -1,24 +1,23 @@@ + # Copyright (C) 2014-2016 CEA/DEN, EDF R&D, OPEN CASCADE + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public + # License as published by the Free Software Foundation; either + # version 2.1 of the License, or (at your option) any later version. + # + # This library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Lesser General Public License for more details. + # + # You should have received a copy of the GNU Lesser General Public + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + # + -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from qtsalome import * import SalomePyQt diff --cc src/PyConsole/CMakeLists.txt index a2f3b4636,bc49aebc6..713769e8b --- a/src/PyConsole/CMakeLists.txt +++ b/src/PyConsole/CMakeLists.txt @@@ -93,5 -86,4 +86,4 @@@ TARGET_LINK_LIBRARIES(PyConsole ${_link INSTALL(TARGETS PyConsole EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(FILES ${PyConsole_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) -QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") +QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") - diff --cc src/PyInterp/CMakeLists.txt index 07cef33db,987380dac..d44a73ff3 --- a/src/PyInterp/CMakeLists.txt +++ b/src/PyInterp/CMakeLists.txt @@@ -56,7 -55,7 +55,7 @@@ SET(PyInterp_HEADERS ${_moc_HEADERS} ${ # --- sources --- # sources / moc wrappings - QT_WRAP_MOC(_moc_SOURCES ${_moc_internal_HEADERS}) -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) ++QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS}) # sources / static SET(_other_SOURCES diff --cc src/SVTK/CMakeLists.txt index d2a4072e9,dd03219cd..53dcf7e84 --- a/src/SVTK/CMakeLists.txt +++ b/src/SVTK/CMakeLists.txt @@@ -196,6 -196,7 +196,6 @@@ TARGET_LINK_LIBRARIES(SVTK ${_link_LIBR INSTALL(TARGETS SVTK EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(FILES ${SVTK_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) -QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") +QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") - INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA}) + INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA}) - diff --cc src/TOOLSGUI/CMakeLists.txt index db9f680ed,94ed39d56..d391fc676 --- a/src/TOOLSGUI/CMakeLists.txt +++ b/src/TOOLSGUI/CMakeLists.txt @@@ -97,4 -97,5 +97,4 @@@ TARGET_LINK_LIBRARIES(ToolsGUI ${_link_ INSTALL(TARGETS ToolsGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(FILES ${ToolsGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) - QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") -QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") - ++QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")