Procházet zdrojové kódy

Merge topic 'ctkSimplePythonShell'

* ctkSimplePythonShell:
  Event loop now terminate when SimplePythonShell is closed
  BUG: AbtractPythonManager - Ensure the interpreter context is properly cleanup
  STYLE: Remove extra debut statement in ctkPyhtonShell
Jean-Christophe Fillion-Robin před 14 roky
rodič
revize
e5da418035

+ 1 - 1
Applications/ctkSimplePythonShell/ctkSimplePythonShellMain.cpp

@@ -14,7 +14,7 @@ int main(int argc, char** argv)
   ctkSimplePythonManager pythonManager;
   
   ctkPythonShell shell(&pythonManager);
-  shell.setAttribute(Qt::WA_QuitOnClose, false);
+  shell.setAttribute(Qt::WA_QuitOnClose, true);
   shell.resize(600, 280);
   shell.show();
   

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

@@ -84,6 +84,8 @@ ctkAbstractPythonManager::ctkAbstractPythonManager(QObject* _parent) : Superclas
 //-----------------------------------------------------------------------------
 ctkAbstractPythonManager::~ctkAbstractPythonManager()
 {
+  PyThreadState* state = PyThreadState_Get();
+  Py_EndInterpreter(state);
   PythonQt::cleanup();
 }
 

+ 0 - 1
Libs/Scripting/Python/Widgets/ctkPythonShell.cpp

@@ -204,7 +204,6 @@ struct ctkPythonShell::pqImplementation
   //----------------------------------------------------------------------------
   void initializeInteractiveConsole()
   {
-    qDebug() << "initializeInteractiveConsole";
     // set up the code.InteractiveConsole instance that we'll use.
     const char* code =
       "import code\n"