-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#ifndef DISABLE_PYCONSOLE
#include <PyConsole_Interp.h> // this include must be first (see PyInterp_base.h)!
- #include <PyConsole_Console.h>
#endif
#include "SalomeApp_DoubleSpinBox.h"
value = 0;
if( SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() ) )
{
- if( SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) )
- {
- _PTR(Study) studyDS = study->studyDS();
+ _PTR(Study) studyDS = SalomeApp_Application::getStudy();
- std::string aName = name.toStdString();
- if( studyDS->IsVariable( aName ) )
+ std::string aName = name.toStdString();
+ if( studyDS->IsVariable( aName ) )
+ {
+ if( studyDS->IsReal( aName ) || studyDS->IsInteger( aName ) || studyDS->IsString( aName ) )
{
- if( studyDS->IsReal( aName ) || studyDS->IsInteger( aName ) || studyDS->IsString( aName ) )
+ if( studyDS->IsString( aName ) )
{
- if( studyDS->IsString( aName ) )
- {
#ifndef DISABLE_PYCONSOLE
- PyConsole_Console* pyConsole = app->pythonConsole();
- PyConsole_Interp* pyInterp = pyConsole->getInterp();
- PyLockWrapper aLock; // Acquire GIL
- std::string command;
- command = "import salome_notebook ; ";
- command += "salome_notebook.notebook.setAsReal(\"";
- command += aName;
- command += "\")";
- bool aResult;
- aResult = pyInterp->run(command.c_str());
- if(aResult)
- {
- return IncorrectType;
- }
+ PyConsole_Interp* pyInterp = app->getPyInterp();
+ PyLockWrapper aLock; // Acquire GIL
+ std::string command;
+ command = "import salome_notebook ; ";
+ command += "salome_notebook.notebook.setAsReal(\"";
+ command += aName;
+ command += "\")";
+ bool aResult;
+ aResult = pyInterp->run(command.c_str());
+ if(aResult)
+ {
+ return IncorrectType;
+ }
#endif
- }
- value = studyDS->GetReal( aName );
- return Found;
}
- return IncorrectType;
+ value = studyDS->GetReal( aName );
+ return Found;
}
+ return IncorrectType;
}
}
return NotFound;