瀏覽代碼

Added option CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTCORE

If the ScriptingPythonCore library is build with that option turned ON,
"core" library is now initialized within the PythonManager
Jean-Christophe Fillion-Robin 14 年之前
父節點
當前提交
d1328311bd

+ 2 - 2
CMakeExternals/PythonQt.cmake

@@ -20,9 +20,9 @@ IF(${add_project})
   IF(NOT DEFINED PYTHONQT_INSTALL_DIR)
   #   MESSAGE(STATUS "Adding project:${proj}")
     
-    # Generate ep_PythonQt_args
     SET(ep_PythonQt_args)
-    foreach(qtlib gui network opengl sql svg uitools webkit xml xmlpatterns)
+    # Enable Qt libraries PythonQt wrapping if required
+    foreach(qtlib core gui network opengl sql svg uitools webkit xml xmlpatterns)
       STRING(TOUPPER ${qtlib} qtlib_uppercase)
       LIST(APPEND ep_PythonQt_args -DPythonQt_Wrap_Qt${qtlib}:BOOL=${CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QT${qtlib_uppercase}})
     endforeach()

+ 1 - 4
Libs/Scripting/Python/Core/CMakeLists.txt

@@ -30,14 +30,11 @@ SET(KIT_resources
 #
 # Configure file describing which Qt modules are wrapped
 #
-FOREACH(qtlib GUI NETWORK OPENGL SQL SVG UITOOLS WEBKIT XML XMLPATTERNS)
+FOREACH(qtlib CORE GUI NETWORK OPENGL SQL SVG UITOOLS WEBKIT XML XMLPATTERNS)
   SET(CTK_PYTHONQT_WRAP_QT${qtlib} ${CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QT${qtlib}})
   #message(CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QT${qtlib}:${CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QT${qtlib}})
 ENDFOREACH()
 
-# TODO Ideally a file named ctkScripingPythonWidgetsConfigure.h should
-# also be configured, this file should deal with Qt Module depending only on QtGui
-
 CONFIGURE_FILE(
   ctkScriptingPythonCoreConfigure.h.in
   ${CMAKE_CURRENT_BINARY_DIR}/ctkScriptingPythonCoreConfigure.h

+ 8 - 0
Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp

@@ -39,6 +39,10 @@
 #pragma GCC diagnostic ignored "-Wold-style-cast"
 #endif
 
+#ifdef CTK_PYTHONQT_WRAP_QTCORE
+void PythonQt_init_QtCore(PyObject*);
+#endif
+
 #ifdef CTK_PYTHONQT_WRAP_QTGUI
 void PythonQt_init_QtGui(PyObject*);
 #endif
@@ -121,6 +125,10 @@ void ctkAbstractPythonManager::initPythonQt()
   this->connect(PythonQt::self(), SIGNAL(pythonStdErr(const QString&)),
                 SLOT(printStderr(const QString&)));
   
+  #ifdef CTK_PYTHONQT_WRAP_QTCORE
+  PythonQt_init_QtCore(0);
+  #endif
+  
   #ifdef CTK_PYTHONQT_WRAP_QTGUI
   PythonQt_init_QtGui(0);
   #endif

+ 1 - 0
Libs/Scripting/Python/Core/ctkScriptingPythonCoreConfigure.h.in

@@ -6,6 +6,7 @@
 /// Here is where system computed values get stored
 ///
 
+#cmakedefine CTK_PYTHONQT_WRAP_QTCORE
 #cmakedefine CTK_PYTHONQT_WRAP_QTGUI
 #cmakedefine CTK_PYTHONQT_WRAP_QTNETWORK
 #cmakedefine CTK_PYTHONQT_WRAP_QTOPENGL

+ 1 - 0
Libs/Scripting/Python/Core/ctk_library_options.cmake

@@ -6,6 +6,7 @@
 #
 
 SET(ctk_library_options
+  PYTHONQT_WRAP_QTCORE:OFF
   PYTHONQT_WRAP_QTGUI:OFF
   PYTHONQT_WRAP_QTNETWORK:OFF
   PYTHONQT_WRAP_QTOPENGL:OFF