Преглед на файлове

Add ctkAbstractPythonManager::isPythonInitialized

Jean-Christophe Fillion-Robin преди 13 години
родител
ревизия
c7aadfe3b2

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

@@ -76,5 +76,5 @@ ADD_SUBDIRECTORY(Python)
 
 # Testing
 IF(BUILD_TESTING)
-  #ADD_SUBDIRECTORY(Testing)
+  ADD_SUBDIRECTORY(Testing)
 ENDIF(BUILD_TESTING)

+ 2 - 2
Libs/Scripting/Python/Core/Testing/Cpp/CMakeLists.txt

@@ -1,7 +1,7 @@
 SET(KIT ${PROJECT_NAME})
 
 CREATE_TEST_SOURCELIST(Tests ${KIT}CppTests.cpp
-  
+  ctkAbstractPythonManagerTest1.cpp
   #EXTRA_INCLUDE TestingMacros.h
   )
 
@@ -24,4 +24,4 @@ ENDMACRO( SIMPLE_TEST  )
 # Add Tests
 #
 
-#SIMPLE_TEST( ctkModelTesterTest1 )
+SIMPLE_TEST( ctkAbstractPythonManagerTest1 )

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

@@ -114,6 +114,12 @@ void ctkAbstractPythonManager::initPythonQt()
 }
 
 //-----------------------------------------------------------------------------
+bool ctkAbstractPythonManager::isPythonInitialized()
+{
+  return PythonQt::self() != 0;
+}
+
+//-----------------------------------------------------------------------------
 QStringList ctkAbstractPythonManager::pythonPaths()
 {
   return QStringList();

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

@@ -69,6 +69,10 @@ public:
                                const QString& module = QLatin1String("__main__"),
                                bool appendParenthesis = false) const;
 
+  /// Returns True if python is initialized
+  /// \sa pythonInitialized
+  bool isPythonInitialized();
+
 signals:
 
   /// This signal is emitted after python is pre-initialized. Observers can listen