X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSalomeApp%2FSalomeApp_IntSpinBox.cxx;h=3f509509551b4a468b7f60d37aae19d2c2d048ee;hb=b6e35aa42d3c67a529d7f9339718dfaed6891323;hp=6ced85db854dcf30dc5d2cf473f6c6c3e9439f4a;hpb=034a705024b224972c148e1e3834c5ee38df184b;p=modules%2Fgui.git diff --git a/src/SalomeApp/SalomeApp_IntSpinBox.cxx b/src/SalomeApp/SalomeApp_IntSpinBox.cxx index 6ced85db8..3f5095095 100644 --- a/src/SalomeApp/SalomeApp_IntSpinBox.cxx +++ b/src/SalomeApp/SalomeApp_IntSpinBox.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,10 @@ // File: SalomeApp_IntSpinBox.cxx // Author: Oleg UVAROV // -#include //this include must be first (see PyInterp_base.h)! -#include + +#ifndef DISABLE_PYCONSOLE + #include //this include must be first (see PyInterp_base.h)! +#endif #include "SalomeApp_IntSpinBox.h" #include "SalomeApp_Application.h" @@ -371,37 +373,35 @@ SalomeApp_IntSpinBox::SearchState SalomeApp_IntSpinBox::findVariable( const QStr value = 0; if( SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ) ) { - if( SalomeApp_Study* study = dynamic_cast( 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->IsInteger( aName ) || studyDS->IsString( aName ) ) { - if( studyDS->IsInteger( aName ) || studyDS->IsString( aName ) ) + if( studyDS->IsString( aName ) ) { - if( studyDS->IsString( aName ) ) - { - PyConsole_Console* pyConsole = app->pythonConsole(); - PyConsole_Interp* pyInterp = pyConsole->getInterp(); - PyLockWrapper aLock = pyInterp->GetLockWrapper(); - std::string command; - command = "import salome_notebook ; "; - command += "salome_notebook.notebook.setAsInteger(\""; - command += aName; - command += "\")"; - bool aResult; - aResult = pyInterp->run(command.c_str()); - if(aResult) - { - return IncorrectType; - } - } - value = studyDS->GetInteger( aName ); - return Found; +#ifndef DISABLE_PYCONSOLE + PyConsole_Interp* pyInterp = app->getPyInterp(); + PyLockWrapper aLock; // Acquire GIL + std::string command; + command = "import salome_notebook ; "; + command += "salome_notebook.notebook.setAsInteger(\""; + command += aName; + command += "\")"; + bool aResult; + aResult = pyInterp->run(command.c_str()); + if(aResult) + { + return IncorrectType; + } +#endif } - return IncorrectType; + value = studyDS->GetInteger( aName ); + return Found; } + return IncorrectType; } } return NotFound; @@ -451,7 +451,7 @@ bool SalomeApp_IntSpinBox::isAcceptNames() const */ void SalomeApp_IntSpinBox::setShowTipOnValidate( const bool flag ) { - myShowTip = myShowTip; + myShowTip = flag; } /*!