Explorar el Código

ENH: ctkSimplePythonShell - CTKCore/CTKWidgets PythonQt wrapper are initialized within a custom PythonManager

Jean-Christophe Fillion-Robin hace 15 años
padre
commit
2bd8cbbd7d

+ 5 - 0
Applications/ctkSimplePythonShell/CMakeLists.txt

@@ -33,6 +33,11 @@ ctkMacroGetTargetLibraries(KIT_target_libraries)
 SET(KIT_include_directories
 SET(KIT_include_directories
   )
   )
 
 
+IF(CTK_WRAP_PYTHONQT_LIGHT OR CTK_WRAP_PYTHONQT_FULL)
+  LIST(APPEND KIT_target_libraries CTKCorePythonQt)
+  LIST(APPEND KIT_target_libraries CTKWidgetsPythonQt)
+ENDIF()
+
 ctkMacroBuildApp(
 ctkMacroBuildApp(
   NAME ${PROJECT_NAME}
   NAME ${PROJECT_NAME}
   INCLUDE_DIRECTORIES ${KIT_include_directories}
   INCLUDE_DIRECTORIES ${KIT_include_directories}

+ 11 - 0
Applications/ctkSimplePythonShell/ctkSimplePythonManager.cpp

@@ -3,6 +3,13 @@
 #include "ctkSimplePythonManager.h"
 #include "ctkSimplePythonManager.h"
 #include "ctkSimplePythonQtDecorators.h"
 #include "ctkSimplePythonQtDecorators.h"
 
 
+// PythonQT includes
+#include <PythonQt.h>
+
+// PythonQt wrapper initialization methods
+void PythonQt_init_org_commontk_CTKCore(PyObject*);
+void PythonQt_init_org_commontk_CTKWidgets(PyObject*);
+
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 ctkSimplePythonManager::ctkSimplePythonManager(QObject* _parent) : Superclass(_parent)
 ctkSimplePythonManager::ctkSimplePythonManager(QObject* _parent) : Superclass(_parent)
 {
 {
@@ -27,6 +34,10 @@ void ctkSimplePythonManager::preInitialization()
 {
 {
   Superclass::preInitialization();
   Superclass::preInitialization();
 
 
+  // Initialize wrappers
+  PythonQt_init_org_commontk_CTKCore(0);
+  PythonQt_init_org_commontk_CTKWidgets(0);
+
   // Register decorators
   // Register decorators
   this->registerPythonQtDecorator(new ctkSimplePythonQtDecorators(this));  
   this->registerPythonQtDecorator(new ctkSimplePythonQtDecorators(this));