CMAKE_DEPENDENT_OPTION(SALOME_USE_SALOMEOBJECT "Enable Salome Object (Mandatory in classic configurations)" ON
"SALOME_LIGHT_ONLY" ON)
OPTION(SALOME_USE_SINGLE_DESKTOP "Enable multiple document interface" ON)
+OPTION(SALOME_USE_PYSIDE "Use PySide + Shiboken to wrap GUI funtionality in the python module, otherwise PyQt + SIP is used" ON)
MARK_AS_ADVANCED(SALOME_LIGHT_ONLY SALOME_USE_VTKVIEWER SALOME_USE_GRAPHICSVIEW)
MARK_AS_ADVANCED(SALOME_USE_SALOMEOBJECT SALOME_USE_OCCVIEWER SALOME_USE_GLVIEWER SALOME_USE_PLOT2DVIEWER)
##
## GUI specifics
##
-
-FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt4
+IF(SALOME_USE_PYSIDE)
+ FIND_PACKAGE(SalomeShiboken REQUIRED) # should come after Python and before PySide
+ELSE(SALOME_USE_PYSIDE)
+ FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt4
+ENDIF()
# Build with GUI observers feature
IF(SALOME_GUI_USE_OBSERVERS)
FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL)
INCLUDE(${QT_USE_FILE})
-FIND_PACKAGE(SalomePyQt4 REQUIRED)
+IF(SALOME_USE_PYSIDE)
+ FIND_PACKAGE(SalomePySide REQUIRED)
+ELSE(SALOME_USE_PYSIDE)
+ FIND_PACKAGE(SalomePyQt4 REQUIRED)
+ENDIF(SALOME_USE_PYSIDE)
# Optional prerequisites for GUI
IF(SALOME_USE_GLVIEWER)
# Ensure the variables are always defined for the configure:
SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
-SET(SIP_ROOT_DIR "${SIP_ROOT_DIR}")
+IF(SALOME_USE_PYSIDE)
+ SET(SHIBOKEN_ROOT_DIR "${SHIBOKEN_ROOT_DIR}")
+ SET(PYSIDE_ROOT_DIR "${PYSIDE_ROOT_DIR}")
+ELSE(SALOME_USE_PYSIDE)
+ SET(SIP_ROOT_DIR "${SIP_ROOT_DIR}")
+ SET(PYQT4_ROOT_DIR "${PYQT4_ROOT_DIR}")
+ENDIF(SALOME_USE_PYSIDE)
SET(QT4_ROOT_DIR "${QT4_ROOT_DIR}")
-SET(PYQT4_ROOT_DIR "${PYQT4_ROOT_DIR}")
SET(CAS_ROOT_DIR "${CAS_ROOT_DIR}")
SET(OPENGL_ROOT_DIR "${OPENGL_ROOT_DIR}")
SET(VTK_ROOT_DIR "${VTK_ROOT_DIR}")
SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
-SALOME_CONFIGURE_PREPARE(CAS OpenGL PyQt4 Qt4 Qwt SIP VTK)
-
-CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
- ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
- INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
- PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
- KERNEL_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR CAS_ROOT_DIR
- OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
+IF(SALOME_USE_PYSIDE)
+ SALOME_CONFIGURE_PREPARE(CAS OpenGL PySide Qt4 Qwt Shiboken VTK)
+ CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
+ ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+ INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
+ PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
+ KERNEL_ROOT_DIR SHIBOKEN_ROOT_DIR QT4_ROOT_DIR PYSIDE_ROOT_DIR CAS_ROOT_DIR
+ OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
+ELSE(SALOME_USE_PYSIDE)
+ SALOME_CONFIGURE_PREPARE(CAS OpenGL PyQt4 Qt4 Qwt SIP VTK)
+ CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
+ ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+ INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
+ PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
+ KERNEL_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR CAS_ROOT_DIR
+ OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
+ENDIF(SALOME_USE_PYSIDE)
# - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
# Get the relative path of the include directory so
SET(SALOME_USE_PYCONSOLE @SALOME_USE_PYCONSOLE@)
SET(SALOME_USE_SALOMEOBJECT @SALOME_USE_SALOMEOBJECT@)
SET(SALOME_USE_SINGLE_DESKTOP @SALOME_USE_SINGLE_DESKTOP@)
+SET(SALOME_USE_PYSIDE @SALOME_USE_PYSIDE@)
SET(SALOME_GUI_USE_OBSERVERS @SALOME_GUI_USE_OBSERVERS@)
IF(SALOME_GUI_LIGHT_ONLY)
IF(NOT SALOME_USE_SALOMEOBJECT)
LIST(APPEND GUI_DEFINITIONS "-DDISABLE_SALOMEOBJECT")
ENDIF()
+IF(SALOME_USE_PYSIDE)
+ LIST(APPEND GUI_DEFINITIONS "-DWITH_PYSIDE")
+ELSE(SALOME_USE_PYSIDE)
+ LIST(APPEND GUI_DEFINITIONS "--DWITH_PYQT4")
+ENDIF(SALOME_USE_PYSIDE)
# Level 1 prerequisites:
SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@")
-SET_AND_CHECK(SIP_ROOT_DIR_EXP "@PACKAGE_SIP_ROOT_DIR@")
+IF(SALOME_USE_PYSIDE)
+ SET_AND_CHECK(SHIBOKEN_ROOT_DIR_EXP "@PACKAGE_SHIBOKEN_ROOT_DIR@")
+ SET_AND_CHECK(PYSIDE_ROOT_DIR_EXP "@PACKAGE_PYSIDE_ROOT_DIR@")
+ELSE(SALOME_USE_PYSIDE)
+ SET_AND_CHECK(SIP_ROOT_DIR_EXP "@PACKAGE_SIP_ROOT_DIR@")
+ SET_AND_CHECK(PYQT4_ROOT_DIR_EXP "@PACKAGE_PYQT4_ROOT_DIR@")
+ENDIF(SALOME_USE_PYSIDE)
+
SET_AND_CHECK(QT4_ROOT_DIR_EXP "@PACKAGE_QT4_ROOT_DIR@")
-SET_AND_CHECK(PYQT4_ROOT_DIR_EXP "@PACKAGE_PYQT4_ROOT_DIR@")
SET_AND_CHECK(CAS_ROOT_DIR_EXP "@PACKAGE_CAS_ROOT_DIR@")
# Optional level 1 prerequisites:
FindSIP.cmake
FindPyQt4.cmake
FindSalomePyQt4.cmake
+ FindSalomePySide.cmake
FindSalomeQt4.cmake
FindSalomeQwt.cmake
FindSalomeSIP.cmake
+ FindSalomeShiboken.cmake
FindSalomeGUI.cmake
FindSalomeOpenGL.cmake
UsePyQt4.cmake
+ UsePySide.cmake
+ UsePySide.cmake
UseQt4Ext.cmake
+ CommonTools.cmake
)
INSTALL(FILES ${_adm_data} DESTINATION ${SALOME_INSTALL_CMAKE_LOCAL})
--- /dev/null
+# Copyright (C) 2012-2014 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)
+
+####################################################################
+#
+# _GET_UNIQUE_TARGET_NAME: internal function
+#
+# Used to generate unique custom target name for usage in
+# PYQT4_WRAP_UIC macro.
+#
+# USAGE: _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(prefix unique_name)
+#
+# ARGUMENTS:
+# prefix [in] prefix for the name
+# unique_name [out] unique name generated by function
+#
+####################################################################
+FUNCTION(_GET_UNIQUE_TARGET_NAME name unique_name)
+ SET(_propertyName "_PYQT4_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()
--- /dev/null
+# Copyright (C) 2013-2014 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
+#
+
+# - Find PySide installation
+# Sets the following variables:
+# PYSIDE_PYUIC_EXECUTABLE - path to the pyside-uic executable
+# PYSIDE_PYRCC_EXECUTABLE - path to the pyside-rcc executable
+# PYSIDE_PYUIC_PATH - command to launch pyuic with the correct PYTHONPATH
+# PYSIDE_PYRCC_PATH - command to launch pyrcc with the correct PYTHONPATH
+#
+# The executables
+# pyside-uic and pyside-rcc are searched.
+
+IF(NOT PyTools_FIND_QUIETLY)
+ MESSAGE(STATUS "Looking for PyTools ...")
+ENDIF()
+
+FIND_PROGRAM(PYSIDE_PYUIC_EXECUTABLE NAMES pyside-uic)
+FIND_PROGRAM(PYSIDE_PYRCC_EXECUTABLE NAMES pyside-rcc)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PyTools REQUIRED_VARS PYSIDE_PYUIC_EXECUTABLE)
+
+# Wrap the final executables so that they always use the proper environment (PYTHONPATH):
+# The results are put to variables:
+# PYSIDE_PYUIC_PATH - command to launch pyuic with the correct PYTHONPATH
+# PYSIDE_PYRCC_PATH - command to launch pyrcc with the correct PYTHONPATH
+# TODO: should be done like Sphinx in KERNEL (i.e. generating a shell script)?
+
+IF(WIN32)
+ SET(PYSIDE_PYUIC_PATH set PYTHONPATH=${PYSIDE_PYTHONPATH};${SHIBOKEN_PYTHONPATH};%PYTHONPATH% && ${PYSIDE_PYUIC_EXECUTABLE})
+ SET(PYSIDE_PYRCC_PATH set PYTHONPATH=${PYSIDE_PYTHONPATH};${SHIBOKEN_PYTHONPATH};%PYTHONPATH% && ${PYSIDE_PYRCC_EXECUTABLE})
+ELSE()
+ SET(PYSIDE_PYUIC_PATH /usr/bin/env PYTHONPATH="${PYSIDE_PYTHONPATH}:${SHIBOKEN_PYTHONPATH}:$$PYTHONPATH" ${PYSIDE_PYUIC_EXECUTABLE})
+ SET(PYSIDE_PYRCC_PATH /usr/bin/env PYTHONPATH="${PYSIDE_PYTHONPATH}:${SHIBOKEN_PYTHONPATH}:$$PYTHONPATH" ${PYSIDE_PYRCC_EXECUTABLE})
+ENDIF()
MARK_AS_ADVANCED(PYQT_PYUIC_EXECUTABLE PYQT_PYRCC_EXECUTABLE PYQT_SIPS_DIR PYQT_PYUIC_PATH PYQT_PYRCC_PATH)
IF(PYQT4_FOUND)
+ SET(PYQT4_DEFINITIONS "-DWITH_PYQT4")
SALOME_ACCUMULATE_ENVIRONMENT(PATH ${PYQT_PYUIC_EXECUTABLE})
SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${PYQT_PYTHONPATH})
SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${PYQT_PYTHONPATH})
--- /dev/null
+# Copyright (C) 2013-2014 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: Roman NIKOLAEV
+#
+
+# PySide detection for Salome
+#
+# !! Please read the generic detection procedure in SalomeMacros.cmake !!
+#
+
+# PySide needs shiboken, call it automatically
+FIND_PACKAGE(SalomeShiboken REQUIRED)
+
+# Find the PySide
+SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(PySide PYSIDE_INCLUDE_DIR 2)
+
+# Find the pyside-uic and pyside-rcc executables
+SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(PyTools PYSIDE_PYUIC_EXECUTABLE 2)
+MARK_AS_ADVANCED(PYSIDE_PYUIC_EXECUTABLE PYSIDE_PYRCC_EXECUTABLE PYSIDE_PYUIC_PATH PYSIDE_PYRCC_PATH)
+
+# TODO : RNV : Check difference between Pakage_FOUND and PACKAGE_FOUND (in upper case and "as is") !!!
+IF(PySide_FOUND AND PYTOOLS_FOUND)
+ SALOME_ACCUMULATE_ENVIRONMENT(PATH ${PYSIDE_PYUIC_EXECUTABLE})
+ SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${PYSIDE_PYTHONPATH})
+ SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${PYSIDE_PYTHONPATH})
+
+ # Define shiboken generator options
+ SET(SIHBOKEN_GENERATOR_EXTRA_FLAGS --generator-set=shiboken --enable-parent-ctor-heuristic --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero)
+
+ # Define C++ preprocessor options
+ SET(PYSIDE_DEFINITIONS -DWITH_PYSIDE -DAVOID_PROTECTED_HACK)
+
+ # Costomize include directories
+ SET(PYSIDE_INCLUDE_DIRS ${PYSIDE_INCLUDE_DIR}
+ PYSIDE_INCLUDE_DIRS ${PYSIDE_INCLUDE_DIR}/QtCore
+ PYSIDE_INCLUDE_DIRS ${PYSIDE_INCLUDE_DIR}/QtGui
+ PYSIDE_INCLUDE_DIRS ${PYSIDE_INCLUDE_DIR}/QtXml)
+ENDIF()
--- /dev/null
+# Copyright (C) 2013-2014 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: Roman NIKOLAEV
+#
+
+# Shiboken detection for Salome
+#
+# !! Please read the generic detection procedure in SalomeMacros.cmake !!
+#
+SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Shiboken SHIBOKEN_BINARY 2)
+MARK_AS_ADVANCED(SHIBOKEN_BINARY SHIBOKEN_INCLUDE_DIR SHIBOKEN_LIBRARY)
+
+IF(SHIBOKEN_FOUND)
+ SALOME_ACCUMULATE_ENVIRONMENT(PATH ${SHIBOKEN_EXECUTABLE})
+ SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${SHIBOKEN_PYTHONPATH})
+ SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${SHIBOKEN_PYTHONPATH})
+ENDIF()
+
#
# Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-####################################################################
-#
-# _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME: internal function
-#
-# Used to generate unique custom target name for usage in
-# PYQT4_WRAP_UIC macro.
-#
-# USAGE: _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(prefix unique_name)
-#
-# ARGUMENTS:
-# prefix [in] prefix for the name
-# unique_name [out] unique name generated by function
-#
-####################################################################
-FUNCTION(_PYQT4_WRAP_GET_UNIQUE_TARGET_NAME name unique_name)
- SET(_propertyName "_PYQT4_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()
+INCLUDE(CommonTools)
####################################################################
#
--- /dev/null
+# Copyright (C) 2012-2014 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: Roman NIKOLAEV, (roman.nikolaev@opencascade.com)
+
+INCLUDE(CommonTools)
+
+####################################################################
+#
+# PYSIDE_WRAP_UIC macro
+#
+# Create Python modules by processing input *.ui (Qt designer) files with
+# PySide pyside-uic tool.
+#
+# USAGE: PYSIDE_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(PYSIDE_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 ${PYSIDE_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+ MAIN_DEPENDENCY ${_input}
+ )
+ SET(${outfiles} ${${outfiles}} ${_output})
+ ENDFOREACH()
+ _GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName)
+ ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
+
+ ELSEIF(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)
+ _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})
+ _GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _TgName)
+ ADD_CUSTOM_TARGET(${_TgName} ${PYSIDE_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+ DEPENDS ${_input}
+ )
+ SET_TARGET_PROPERTIES(${_TgName} PROPERTIES FOLDER PYSIDE_WRAP_UIC_TARGETS)
+ ADD_DEPENDENCIES(${_uniqueTargetName} DEPEND ${_TgName})
+ SET(${outfiles} ${${outfiles}} ${_output})
+ ENDFOREACH()
+ ENDIF(NOT WIN32)
+ENDMACRO(PYSIDE_WRAP_UIC)
+
+####################################################################
+#
+# PYSIDE_WRAP_QRC macro
+#
+# Generate Python wrappings for *.qrc files by processing them with pyrcc4.
+#
+# USAGE: PYSIDE_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(PYSIDE_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 ${PYSIDE_PYRCC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+ MAIN_DEPENDENCY ${_input}
+ )
+ SET(${outfiles} ${${outfiles}} ${_output})
+ ENDFOREACH()
+ _GET_UNIQUE_TARGET_NAME(BUILD_QRC_PY_FILES _uniqueTargetName)
+ ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
+ENDMACRO(PYSIDE_WRAP_QRC)
+
+####################################################################
+#
+# CREATE_PYSIDE_MODULE macro
+#
+# Create PySide module.
+#
+# USAGE: CREATE_PYSIDE_MODULE( module_name module_include_dir
+# module_libraries module_global_file
+# module_dependencies module_timesystem_path
+# module_sources module_gen_sources )
+#
+# ARGUMENTS:
+# module_name [in] name of the PySide module.
+# module_global_file [in] module global header file
+# module_include_dir [in] list of the module include directories.
+# module_include_dir [in] list of the libraries with witch to
+# be module linked.
+# module_dependencies [in] list of the module dependencies.
+# module_timesystem_path [in] list of the module typesystem paths.
+# module_sources [in] module static sources.
+# module_gen_sources [in] list of the sources to be generated.
+#
+# NOTES:
+# - Output files are generated in the current build directory.
+# - This version of macro requires class(es) definition in the *_typesystem.xml file.
+#
+####################################################################
+MACRO(CREATE_PYSIDE_MODULE MODULE_NAME MODULE_GLOBAL_FILE MODULE_INCLUDE_DIR MODULE_LIBRARIES MODULE_DEPS MODULE_TYPESYSTEM_PATH MODULE_SOURCES MODULE_GEN_SOURCES)
+
+ IF(${ARGC} GREATER 8)
+ SET(TYPESYSTEM_NAME ${ARGV8})
+ ELSE()
+ set (TYPESYSTEM_NAME "")
+ ENDIF()
+
+ IF(${ARGC} GREATER 9)
+ string(REPLACE ";" "\\;" DROPPED_ENTRIES "${${ARGV9}}")
+ ELSE()
+ SET (DROPPED_ENTRIES "")
+ ENDIF()
+
+ IF(NOT EXISTS ${TYPESYSTEM_NAME})
+ SET(TYPESYSTEM_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_NAME}_typesystem.xml)
+ ELSE()
+ SET(TYPESYSTEM_PATH ${TYPESYSTEM_NAME})
+ ENDIF()
+
+ STRING(REPLACE ";" "${PATH_SEP}" _TMP_QT_INCLUDES "${QT_INCLUDES}")
+ STRING(REPLACE ";" "${PATH_SEP}" _TMP_MODULE_INCLUDE_DIR "${${MODULE_INCLUDE_DIR}}")
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${${MODULE_GEN_SOURCES}}
+ COMMAND ${SHIBOKEN_BINARY} ${SIHBOKEN_GENERATOR_EXTRA_FLAGS}
+ ${MODULE_GLOBAL_FILE}
+ --include-paths=${PYSIDE_INCLUDE_DIR}${PATH_SEP}${_TMP_QT_INCLUDES}${PATH_SEP}${_TMP_MODULE_INCLUDE_DIR}
+ --typesystem-paths=${PYSIDE_TYPESYSTEMS}${PATH_SEP}${${MODULE_TYPESYSTEM_PATH}}
+ --output-directory=${CMAKE_CURRENT_BINARY_DIR}
+ --avoid-protected-hack
+ ${TYPESYSTEM_PATH}
+ --api-version="${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}"
+ --drop-type-entries="${DROPPED_ENTRIES}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMENT "Running shiboken generator for ${MODULE_NAME}..."
+ MAIN_DEPENDENCY ${TYPESYSTEM_PATH})
+
+ ADD_LIBRARY(${MODULE_NAME} ${${MODULE_SOURCES}} ${${MODULE_GEN_SOURCES}})
+ IF(WIN32)
+ SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES SUFFIX ".pyd")
+ SET(${MODULE_NAME}_SUFFIX ".pyd")
+ ELSE()
+ SET(${MODULE_NAME}_SUFFIX ${CMAKE_SHARED_MODULE_SUFFIX})
+ ENDIF()
+ TARGET_LINK_LIBRARIES(${MODULE_NAME} ${${MODULE_LIBRARIES}})
+ IF(${MODULE_DEPS})
+ ADD_DEPENDENCIES(${MODULE_NAME} ${${MODULE_DEPS}})
+ ENDIF()
+ENDMACRO()
\ No newline at end of file
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-
-INCLUDE(UsePyQt4)
+IF(SALOME_USE_PYSIDE)
+ INCLUDE(UsePySide)
+ELSE(SALOME_USE_PYSIDE)
+ INCLUDE(UsePyQt4)
+ENDIF(SALOME_USE_PYSIDE)
# --- resources ---
# scripts / pyuic wrappings
-PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
+IF(SALOME_USE_PYSIDE)
+ PYSIDE_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
+ELSE(SALOME_USE_PYSIDE)
+ PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
+ENDIF(SALOME_USE_PYSIDE)
+
+
# scripts / static
SET(_other_SCRIPTS
${PROJECT_SOURCE_DIR}/src/SalomeApp
)
+
+
# additional preprocessor / compiler flags
+IF(SALOME_USE_PYSIDE)
+ SET(PACKAGE_DEFINITIONS ${PYSIDE_DEFINITIONS})
+ELSE(SALOME_USE_PYSIDE)
+ SET(PACKAGE_DEFINITIONS ${PYQT4_DEFINITIONS})
+ENDIF(SALOME_USE_PYSIDE)
+
ADD_DEFINITIONS(
${QT_DEFINITIONS}
${CAS_DEFINITIONS}
${PYTHON_DEFINITIONS}
${BOOST_DEFINITIONS}
${OMNIORB_DEFINITIONS}
+ ${PACKAGE_DEFINITIONS}
)
# libraries to link to
// and to get C API from sip : sipBuildResult for example
//
-#define INIT_FUNCTION initSalomePyQtGUILight
-#if defined(SIP_STATIC_MODULE)
-extern "C" void INIT_FUNCTION();
-#else
-PyMODINIT_FUNC INIT_FUNCTION();
-#endif
+#ifdef WITH_PYQT4
+ #define INIT_FUNCTION initSalomePyQtGUILight
+ #if defined(SIP_STATIC_MODULE)
+ extern "C" void INIT_FUNCTION();
+ #else
+ PyMODINIT_FUNC INIT_FUNCTION();
+ #endif //SIP_STATIC_MODULE
+#endif //WITH_PYQT4
+
+#ifdef WITH_PYSIDE
+ #define INIT_FUNCTION initSalomePyQtGUILight
+ extern "C" void INIT_FUNCTION();
+#endif //WITH_PYSIDE
/*!
\fn CAM_Module* createModule()
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UsePyQt4)
+IF(SALOME_USE_PYSIDE)
+ SET(PACKAGE_DEFINITIONS ${PYSIDE_DEFINITIONS})
+ INCLUDE(UsePySide)
+ELSE(SALOME_USE_PYSIDE)
+ INCLUDE(UsePyQt4)
+ SET(PACKAGE_DEFINITIONS ${PYQT4_DEFINITIONS})
+ENDIF(SALOME_USE_PYSIDE)
+
IF(SALOME_USE_VTKVIEWER)
INCLUDE(${VTK_USE_FILE})
ENDIF()
# --- options ---
-# additional include directories
-INCLUDE_DIRECTORIES(
+# --- common include directories ---
+SET(SalomePyQtGUILight_INCLUDE_DIRS
${CAS_INCLUDE_DIRS}
${QT_INCLUDES}
- ${SIP_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/src/SUIT
${PROJECT_SOURCE_DIR}/src/SUITApp
${PROJECT_SOURCE_DIR}/src/ObjBrowser
-)
+ )
+
+# additional include directories
+IF(SALOME_USE_PYSIDE)
+ SET(SalomePyQtGUILight_INCLUDE_DIRS
+ ${SalomePyQtGUILight_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}/SalomePyQtGUILight
+ ${SHIBOKEN_INCLUDE_DIR}
+ ${PYSIDE_INCLUDE_DIRS})
+ELSE(SALOME_USE_PYSIDE)
+ SET(SalomePyQtGUILight_INCLUDE_DIRS
+ ${SalomePyQtGUILight_INCLUDE_DIRS}
+ ${SIP_INCLUDE_DIRS})
+ENDIF(SALOME_USE_PYSIDE)
+
+INCLUDE_DIRECTORIES(${SalomePyQtGUILight_INCLUDE_DIRS})
# additional preprocessor / compiler flags
+IF(SALOME_USE_PYSIDE)
+ SET(PACKAGE_DEFINITIONS ${PYSIDE_DEFINITIONS})
+ELSE(SALOME_USE_PYSIDE)
+ SET(PACKAGE_DEFINITIONS ${PYQT4_DEFINITIONS})
+ENDIF(SALOME_USE_PYSIDE)
+
ADD_DEFINITIONS(
${QT_DEFINITIONS}
${CAS_DEFINITIONS}
${PYTHON_DEFINITIONS}
-)
+ ${PACKAGE_DEFINITIONS})
# libraries to link to
SET(_link_LIBRARIES
${PYTHON_LIBRARIES}
${VTK_LIBRARIES}
${OPENGL_LIBRARIES}
- LightApp
-)
+ LightApp)
+
IF(NOT SALOME_LIGHT_ONLY)
LIST(APPEND _link_LIBRARIES ${KERNEL_SalomeContainer})
ENDIF()
+IF(SALOME_USE_PYSIDE)
+ LIST(APPEND _link_LIBRARIES ${SHIBOKEN_LIBRARY} ${PYSIDE_LIBRARY})
+ENDIF(SALOME_USE_PYSIDE)
+
# --- headers ---
# header files / to be processed by moc
SET(SalomePyQtGUILight_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
# --- resources ---
-
-# sip files / to be processed by sip
-SET(_sip_files SALOME_PYQT_GUILight.sip)
+IF(NOT SALOME_USE_PYSIDE)
+ # sip files / to be processed by sip
+ SET(_sip_files SALOME_PYQT_GUILight.sip)
+ENDIF(NOT SALOME_USE_PYSIDE)
# --- sources ---
# sources / moc wrappings
QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
-# sources / sip wrappings
-PYQT4_WRAP_SIP(_sip_SOURCES ${_sip_files})
-
# sources / static
SET(_other_SOURCES
SALOME_PYQT_DataModelLight.cxx
SALOME_PYQT_PyModule.cxx
)
-# sources / to compile
-SET(SalomePyQtGUILight_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_sip_SOURCES})
+SET(SalomePyQtGUILight_SOURCES ${_other_SOURCES} ${_moc_SOURCES})
-# --- rules ---
-ADD_LIBRARY(SalomePyQtGUILight ${SalomePyQtGUILight_SOURCES})
-TARGET_LINK_LIBRARIES(SalomePyQtGUILight ${_link_LIBRARIES})
-INSTALL(TARGETS SalomePyQtGUILight DESTINATION ${SALOME_INSTALL_LIBS})
+IF(SALOME_USE_PYSIDE)
+
+ # --- create pyside module ---
+ SET(SalomePyQtGUILight_WRAPPED_SOURCES
+ ${CMAKE_CURRENT_BINARY_DIR}/SalomePyQtGUILight/salomepyqtguilight_module_wrapper.cpp)
+
+ CREATE_PYSIDE_MODULE(
+ SalomePyQtGUILight
+ ${CMAKE_CURRENT_SOURCE_DIR}/SALOME_PYQT_GUILight_global.h
+ ""
+ _link_LIBRARIES
+ ""
+ ""
+ SalomePyQtGUILight_SOURCES
+ SalomePyQtGUILight_WRAPPED_SOURCES
+ ${CMAKE_CURRENT_SOURCE_DIR}/SALOME_PYQT_GUILight_typesystem.xml
+ )
+ELSE(SALOME_USE_PYSIDE)
+ # sources / sip wrappings
+ PYQT4_WRAP_SIP(_sip_SOURCES ${_sip_files})
+ # sources / to compile
+ SET(SalomePyQtGUILight_SOURCES ${SalomePyQtGUILight_SOURCES} ${_sip_SOURCES})
+
+ # --- rules ---
+
+ ADD_LIBRARY(SalomePyQtGUILight ${SalomePyQtGUILight_SOURCES})
+ TARGET_LINK_LIBRARIES(SalomePyQtGUILight ${_link_LIBRARIES})
+ENDIF(SALOME_USE_PYSIDE)
+
+INSTALL(TARGETS SalomePyQtGUILight DESTINATION ${SALOME_INSTALL_LIBS})
INSTALL(FILES ${SalomePyQtGUILight_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-FILE(GLOB make_clean_files ${CMAKE_CURRENT_BINARY_DIR}/sip*)
+IF(SALOME_USE_PYSIDE)
+ FILE(GLOB make_clean_files ${CMAKE_CURRENT_BINARY_DIR}/sip*)
+ENDIF(SALOME_USE_PYSIDE)
+
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}")
--- /dev/null
+// Copyright (C) 2007-2014 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
+//
+
+// File : SALOME_PYQT_ModuleLight_global.h
+// Author : Roman NIKOLAEV, (roman.nikolaev@opencascade.com)
+
+#undef QT_NO_STL
+#undef QT_NO_STL_WCHAR
+#ifndef NULL
+#define NULL 0
+#endif
+#include "pyside_global.h"
+#include <QStringList.h>
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+
+ Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+ 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
+
+ File : SALOME_PYQT_GUILight_typesystem.xml
+ Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+-->
+
+<typesystem package="SalomePyQtGUILight">
+ <load-typesystem name="typesystem_core.xml" generate="no"/>
+ <load-typesystem name="typesystem_gui.xml" generate="no"/>
+</typesystem>
#include "SUIT_DataObjectIterator.h"
#include "LightApp_Application.h"
#include "SUIT_DataBrowser.h"
+
+#ifdef WITH_PYQT4
#include "sipAPISalomePyQtGUILight.h"
+#endif
+
+#ifdef WITH_PYSIDE
+#include "salomepyqtguilight_python.h"
+#endif
#ifndef GUI_DISABLE_CORBA
#include <Container_init_python.hxx>
// and to get C API from sip : sipBuildResult for example
//
-#define INIT_FUNCTION initSalomePyQtGUILight
-#if defined(SIP_STATIC_MODULE)
-extern "C" void INIT_FUNCTION();
-#else
-PyMODINIT_FUNC INIT_FUNCTION();
-#endif
+#ifdef WITH_PYQT4
+ #define INIT_FUNCTION initSalomePyQtGUILight
+ #if defined(SIP_STATIC_MODULE)
+ extern "C" void INIT_FUNCTION();
+ #else
+ PyMODINIT_FUNC INIT_FUNCTION();
+ #endif //SIP_STATIC_MODULE
+#endif //WITH_PYQT4
+
+#ifdef WITH_PYSIDE
+ #define INIT_FUNCTION initSalomePyQtGUILight
+ extern "C" void INIT_FUNCTION();
+#endif //WITH_PYSIDE
/*!
\fn CAM_Module* createModule()
#include <utilities.h>
+#ifdef WITH_PYQT4
#include "sipAPISalomePyQtGUILight.h"
+#endif
+
+#ifdef WITH_PYSIDE
+#include <shiboken.h>
+#include <salomepyqtguilight_python.h>
+#endif
/*!
\brief Default menu group number.
if ( d )
aWorkspace = d->workstack();
}
+#ifdef WITH_PYQT4
#if SIP_VERSION < 0x040800
PyObjWrapper pyws( sipBuildResult( 0, "M", aWorkspace, sipClass_QWidget) );
#else
PyObjWrapper pyws( sipBuildResult( 0, "D", aWorkspace, sipType_QWidget , NULL) );
+#endif
+#endif
+
+#ifdef WITH_PYSIDE
+ PyObjWrapper pyws(Shiboken::Converter<QWidget*>::toPython(aWorkspace));
#endif
// ... and finally call Python module's setWorkSpace() method (obsolete)
if ( PyObject_HasAttrString( myPyModule, (char*)"setWorkSpace" ) ) {
// parse the return value
// it should be a map: {integer:integer}
int aKey, aValue;
+#ifdef WITH_PYQT4
if( key && PyInt_Check( key ) && value && PyInt_Check( value ) ) {
- aKey = PyInt_AsLong( key );
+ aKey = PyInt_AsLong( key );
aValue = PyInt_AsLong( value );
- myWindowsMap[ aKey ] = aValue;
- }
+ }
+#endif
+#ifdef WITH_PYSIDE
+ if( key && Shiboken::isShibokenEnum(key) && value && Shiboken::isShibokenEnum(value) ) {
+ aKey = Shiboken::Enum::getValue(key);
+ aValue = Shiboken::Enum::getValue(value);
+ myWindowsMap[ aKey ] = aValue;
+ }
+#endif
}
}
}
// we create popup menus without help of QtxPopupMgr
if ( myXmlHandler )
myXmlHandler->createPopup( menu, aContext, aParent, aObject );
-
+#ifdef WITH_PYQT4
#if SIP_VERSION < 0x040800
- PyObjWrapper sipPopup( sipBuildResult( 0, "M", menu, sipClass_QMenu ) );
+ PyObjWrapper aPopup( sipBuildResult( 0, "M", menu, sipClass_QMenu ) );
#else
- PyObjWrapper sipPopup( sipBuildResult( 0, "D", menu, sipType_QMenu, NULL ) );
+ PyObjWrapper aPopup( sipBuildResult( 0, "D", menu, sipType_QMenu, NULL ) );
+#endif
+#endif
+
+#ifdef WITH_PYSIDE
+ PyObjWrapper aPopup( Shiboken::Converter<QMenu*>::toPython(menu) );
#endif
// then call Python module's createPopupMenu() method (for new modules)
PyObjWrapper res1( PyObject_CallMethod( myPyModule,
(char*)"createPopupMenu",
(char*)"Os",
- sipPopup.get(),
+ aPopup.get(),
context.toLatin1().constData() ) );
if( !res1 ) {
PyErr_Print();
PyObjWrapper res2( PyObject_CallMethod( myPyModule,
(char*)"customPopup",
(char*)"Osss",
- sipPopup.get(),
+ aPopup.get(),
aContext.toLatin1().constData(),
aObject.toLatin1().constData(),
aParent.toLatin1().constData() ) );
QStringList* theList = new QStringList( files );
+
+#ifdef WITH_PYQT4
#if SIP_VERSION < 0x040800
- PyObjWrapper sipList( sipBuildResult( 0, "M", theList, sipClass_QStringList ) );
+ PyObjWrapper aList( sipBuildResult( 0, "M", theList, sipClass_QStringList ) );
#else
- PyObjWrapper sipList( sipBuildResult( 0, "D", theList, sipType_QStringList, NULL ) );
+ PyObjWrapper aList( sipBuildResult( 0, "D", theList, sipType_QStringList, NULL ) );
+#endif
+#endif
+
+#ifdef WITH_PYSIDE
+ PyObjWrapper aList(Shiboken::Conversions::copyToPython(SbkPySide_QtCoreTypeConverters[SBK_QSTRINGLIST_IDX], &files));
#endif
if ( PyObject_HasAttrString(myPyModule , (char*)"openFiles") ) {
PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"openFiles",
- (char*)"O", sipList.get()));
+ (char*)"O", aList.get()));
if( !res || !PyBool_Check( res )) {
PyErr_Print();
opened = false;
if ( dataObject ) theList->append( dataObject->entry() );
}
+#ifdef WITH_PYQT4
#if SIP_VERSION < 0x040800
- PyObjWrapper sipList( sipBuildResult( 0, "M", theList, sipClass_QStringList) );
+ PyObjWrapper aList( sipBuildResult( 0, "M", theList, sipClass_QStringList) );
#else
- PyObjWrapper sipList( sipBuildResult( 0, "D", theList, sipType_QStringList, NULL) );
+ PyObjWrapper aList( sipBuildResult( 0, "D", theList, sipType_QStringList, NULL) );
+#endif
#endif
+
+#ifdef WITH_PYSIDE
+ PyObjWrapper aList(Shiboken::Conversions::copyToPython(SbkPySide_QtCoreTypeConverters[SBK_QSTRINGLIST_IDX], &theList));
+#endif
+
if ( PyObject_HasAttrString(myPyModule, (char*)"dropObjects") ) {
PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"dropObjects", (char*)"Osii",
- sipList.get(),
+ aList.get(),
whereObject->entry().toLatin1().constData(),
row, action ) );
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UsePyQt4)
+IF(SALOME_USE_PYSIDE)
+ INCLUDE(UsePySide)
+ELSE(SALOME_USE_PYSIDE)
+ INCLUDE(UsePyQt4)
+ENDIF(SALOME_USE_PYSIDE)
IF(SALOME_USE_VTKVIEWER)
INCLUDE(${VTK_USE_FILE})
ENDIF()
# --- options ---
-# additional include directories
-INCLUDE_DIRECTORIES(
+# --- common include directories ---
+SET(SalomePyQt_INCLUDE_DIRS
${CAS_INCLUDE_DIRS}
${QT_INCLUDES}
${QWT_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src/SUIT
)
+# additional include directories
+IF(SALOME_USE_PYSIDE)
+ SET(SalomePyQt_INCLUDE_DIRS
+ ${SalomePyQt_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}/SalomePyQt
+ ${SHIBOKEN_INCLUDE_DIR}
+ ${PYSIDE_INCLUDE_DIRS})
+ELSE(SALOME_USE_PYSIDE)
+ SET(SalomePyQt_INCLUDE_DIRS
+ ${SalomePyQt_INCLUDE_DIRS}
+ ${SIP_INCLUDE_DIRS})
+ENDIF(SALOME_USE_PYSIDE)
+
+INCLUDE_DIRECTORIES(
+ ${SalomePyQt_INCLUDE_DIRS}
+)
+
IF(SALOME_LIGHT_ONLY)
#disable 'ENABLE_CORBA' feature
SET(PYQT_SIPFLAGS ${PYQT_SIPFLAGS} "-xENABLE_CORBA;")
ENDIF(SALOME_LIGHT_ONLY)
# additional preprocessor / compiler flags
+
+# additional preprocessor / compiler flags
+IF(SALOME_USE_PYSIDE)
+ SET(PACKAGE_DEFINITIONS ${PYSIDE_DEFINITIONS})
+ELSE(SALOME_USE_PYSIDE)
+ SET(PACKAGE_DEFINITIONS ${PYQT4_DEFINITIONS})
+ENDIF(SALOME_USE_PYSIDE)
+
+
ADD_DEFINITIONS(
${QWT_DEFINITIONS}
${QT_DEFINITIONS}
${BOOST_DEFINITIONS}
${PYTHON_DEFINITIONS}
${OMNIORB_DEFINITIONS}
-)
+ ${PACKAGE_DEFINITIONS})
# libraries to link to
SET(_link_LIBRARIES
# --- resources ---
# sip files / to be processed by sip
-SET(_sip_files SalomePyQt.sip)
+IF(NOT SALOME_USE_PYSIDE)
+ SET(_sip_files SalomePyQt.sip)
+ENDIF(NOT SALOME_USE_PYSIDE)
# --- sources ---
# sources / moc wrappings
QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
-# sources / sip wrappings
-PYQT4_WRAP_SIP(_sip_SOURCES ${_sip_files})
+IF(NOT SALOME_USE_PYSIDE)
+ # sources / sip wrappings
+ PYQT4_WRAP_SIP(_sip_SOURCES ${_sip_files})
+ENDIF(NOT SALOME_USE_PYSIDE)
# sources / static
SET(_other_SOURCES SalomePyQt.cxx)
SET(SalomePyQt_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_sip_SOURCES})
# --- rules ---
+IF(SALOME_USE_PYSIDE)
+
+ # --- list of the wrapped sources ---
+ SET(SalomePyQt_WRAPPED_SOURCES
+ ${CMAKE_CURRENT_BINARY_DIR}/SalomePyQt/salomepyqt_module_wrapper.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/SalomePyQt/salome_selection_wrapper.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/SalomePyQt/qtxaction_wrapper.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/SalomePyQt/qtxactionset_wrapper.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/SalomePyQt/qtxactiongroup_wrapper.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/SalomePyQt/plot2d_curve_wrapper.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/SalomePyQt/salomepyqt_wrapper.cpp)
+
+ # --- module include directories ---
+ SET(SalomePy_MODULE_INCLUDES
+ ${PROJECT_SOURCE_DIR}/src/Qtx
+ ${PROJECT_SOURCE_DIR}/src/Plot2d)
+
+
+ # --- create pyside module ---
+ MESSAGE("Create pyside module in the ${CAMKE_CURRENT_SOURCE_DIR}")
+ CREATE_PYSIDE_MODULE(
+ SalomePyQt
+ ${CMAKE_CURRENT_SOURCE_DIR}/SalomePyQt_global.h
+ SalomePy_MODULE_INCLUDES
+ _link_LIBRARIES
+ ""
+ ""
+ SalomePyQt_SOURCES
+ SalomePyQt_WRAPPED_SOURCES
+ ${CMAKE_CURRENT_SOURCE_DIR}/SalomePyQt_typesystem.xml
+ )
-ADD_LIBRARY(SalomePyQt ${SalomePyQt_SOURCES})
-TARGET_LINK_LIBRARIES(SalomePyQt ${_link_LIBRARIES})
-INSTALL(TARGETS SalomePyQt DESTINATION ${SALOME_INSTALL_LIBS})
+ELSE(SALOME_USE_PYSIDE)
+ ADD_LIBRARY(SalomePyQt ${SalomePyQt_SOURCES})
+ TARGET_LINK_LIBRARIES(SalomePyQt ${_link_LIBRARIES})
+ENDIF(SALOME_USE_PYSIDE)
+# --- set prefix ---
+SET_TARGET_PROPERTIES(SalomePyQt PROPERTIES PREFIX "")
+
+# --- set correct names of the library on win32 platform ---
IF(WIN32)
SET_TARGET_PROPERTIES(SalomePyQt PROPERTIES SUFFIX ".pyd" DEBUG_OUTPUT_NAME SalomePyQt_d RELEASE_OUTPUT_NAME SalomePyQt)
-ELSE()
- SET_TARGET_PROPERTIES(SalomePyQt PROPERTIES PREFIX "")
-ENDIF()
+ENDIF(WIN32)
+
+INSTALL(TARGETS SalomePyQt DESTINATION ${SALOME_INSTALL_LIBS})
FILE(GLOB make_clean_files ${CMAKE_CURRENT_BINARY_DIR}/sip*)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}")
Help = 7
};
-enum {
+enum WindowType {
WT_ObjectBrowser = LightApp_Application::WT_ObjectBrowser,
WT_PyConsole = LightApp_Application::WT_PyConsole,
WT_LogWindow = LightApp_Application::WT_LogWindow,
#endif
};
-enum {
+enum PrefType {
PT_Auto = LightApp_Preferences::Auto,
PT_Space = LightApp_Preferences::Space,
PT_Bool = LightApp_Preferences::Bool,
--- /dev/null
+// Copyright (C) 2007-2014 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
+//
+
+// File : SalomePyQt_global.h
+// Author : Roman NIKOLAEV, (roman.nikolaev@opencascade.com)
+
+#undef QT_NO_STL
+#undef QT_NO_STL_WCHAR
+#ifndef NULL
+#define NULL 0
+#endif
+#include "pyside_global.h"
+
+#include <SalomePyQt.h>
+#include <QtxAction.h>
+#include <QtxActionSet.h>
+#include <QtxActionGroup.h>
+#include <Plot2d_Curve.h>
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+
+ Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+ 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
+
+ File : SalomePyQt_typesystem.xml
+ Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
+-->
+
+
+
+<typesystem package="SalomePyQt">
+ <load-typesystem name="typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="typesystem_xml.xml" generate="no"/>
+
+ <enum-type name="MenuName"/>
+ <enum-type name="WindowType"/>
+ <enum-type name="PrefType"/>
+ <enum-type name="Orientation"/>
+ <enum-type name="Action"/>
+ <enum-type name="Axis"/>
+ <enum-type name="ObjectType"/>
+ <enum-type name="VisibilityState"/>
+
+ <object-type name="SALOME_Selection"/>
+ <object-type name="QtxAction"/>
+ <object-type name="QtxActionSet"/>
+ <object-type name="QtxActionGroup"/>
+ <object-type name="Plot2d_Curve"/>
+ <object-type name="SalomePyQt">
+
+ <rejection class="Plot2d_Curve" function-name="getDeviationData"/>
+ <rejection class="Plot2d_Curve" function-name="setDeviationData"/>
+
+ <modify-function signature="addPreference( const QString&, const int, const int ,const QString&, const QString&)">
+ <!--Workaround to avoid a problem with the shiboken generator and global enumerations -->
+ <modify-argument index="3">
+ <replace-default-expression with="PT_Auto "/>
+ </modify-argument>
+ </modify-function>
+
+ <modify-function signature="getActivePythonModule()">
+ <modify-argument index="return">
+ <conversion-rule class="target">
+ %PYARG_0 = %0;
+ </conversion-rule>
+ </modify-argument>
+ </modify-function>
+ </object-type>
+</typesystem>
import salome_pluginsmanager
def about(context):
- from PyQt4.QtGui import QMessageBox
+ from PySide.QtGui import QMessageBox
QMessageBox.about(None, "About SALOME pluginmanager", "SALOME plugins manager in SALOME virtual application ")
salome_pluginsmanager.AddFunction('About plugins','About SALOME pluginmanager',about)
"""
import os,sys,traceback
-from PyQt4 import QtGui
-from PyQt4 import QtCore
+from PySide import QtGui
+from PySide import QtCore
import salome