Bladeren bron

Add convenience method addWrapperFactory()

See issue #157
Jean-Christophe Fillion-Robin 12 jaren geleden
bovenliggende
commit
f6961c7909

+ 1 - 1
Applications/ctkSimplePythonShell/ctkSimplePythonManager.cpp.in

@@ -101,7 +101,7 @@ void ctkSimplePythonManager::preInitialization()
 #endif
 
 #ifdef CTK_WRAP_PYTHONQT_USE_VTK
-  PythonQt::self()->addWrapperFactory(new ctkVTKPythonQtWrapperFactory);
+  this->addWrapperFactory(new ctkVTKPythonQtWrapperFactory);
 #endif
 
   // Register decorators

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

@@ -363,6 +363,12 @@ void ctkAbstractPythonManager::addObjectToPythonMain(const QString& name, QObjec
 }
 
 //-----------------------------------------------------------------------------
+void ctkAbstractPythonManager::addWrapperFactory(PythonQtForeignWrapperFactory* factory)
+{
+  PythonQt::self()->addWrapperFactory(factory);
+}
+
+//-----------------------------------------------------------------------------
 QVariant ctkAbstractPythonManager::getVariable(const QString& name)
 {
   PythonQtObjectPtr main = ctkAbstractPythonManager::mainContext();

+ 2 - 0
Libs/Scripting/Python/Core/ctkAbstractPythonManager.h

@@ -30,6 +30,7 @@
 #include "ctkScriptingPythonCoreExport.h"
 
 class ctkAbstractPythonManagerPrivate;
+class PythonQtForeignWrapperFactory;
 class PythonQtObjectPtr;
 
 /// \ingroup Scripting_Python_Core
@@ -62,6 +63,7 @@ public:
   PythonQtObjectPtr mainContext();
 
   void addObjectToPythonMain(const QString& name, QObject* obj);
+  void addWrapperFactory(PythonQtForeignWrapperFactory* factory);
   void registerPythonQtDecorator(QObject* decorator);
   void registerClassForPythonQt(const QMetaObject* metaobject);
   void registerCPPClassForPythonQt(const char* name);