Salome HOME
updated copyright message
[modules/gui.git] / src / SalomeApp / SalomeApp_DoubleSpinBox.cxx
index 5274494994295f72def591034ff1e459f65d9fd3..955116ae4b0a4f60a8bf1d24ae818bea1611f099 100644 (file)
@@ -1,4 +1,4 @@
-// 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
@@ -23,7 +23,6 @@
 
 #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"
@@ -426,39 +425,35 @@ SalomeApp_DoubleSpinBox::SearchState SalomeApp_DoubleSpinBox::findVariable( cons
   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;