From 3f7179a2444834a67596f2a8697576371ae9f25c Mon Sep 17 00:00:00 2001 From: pkv Date: Mon, 23 Nov 2009 08:35:57 +0000 Subject: [PATCH] using new Notebook --- src/SalomeApp/SalomeApp_DoubleSpinBox.cxx | 20 ++++++++++++++------ src/SalomeApp/SalomeApp_IntSpinBox.cxx | 21 ++++++++++++++------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx b/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx index c784b6a26..f63495e23 100644 --- a/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx +++ b/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx @@ -25,6 +25,7 @@ #include "SalomeApp_DoubleSpinBox.h" #include "SalomeApp_Application.h" #include "SalomeApp_Study.h" +#include "SalomeApp_Notebook.h" #include @@ -36,6 +37,7 @@ #include + /*! \class SalomeApp_DoubleSpinBox */ @@ -320,14 +322,19 @@ SalomeApp_DoubleSpinBox::SearchState SalomeApp_DoubleSpinBox::findVariable( cons { if( SalomeApp_Study* study = dynamic_cast( app->activeStudy() ) ) { - _PTR(Study) studyDS = study->studyDS(); - std::string aName = name.toStdString(); - if( studyDS->IsVariable( aName ) ) + // + SalomeApp_Notebook aNotebook( study ); + bool bisParameter=aNotebook.isParameter(name); + // + if (bisParameter) { - if( studyDS->IsReal( aName ) || studyDS->IsInteger( aName ) || studyDS->IsString( aName ) ) + QVariant aVariant=aNotebook.get(name); + QVariant::Type aType=aVariant.type(); + + if(aType==QVariant::Double || aType==QVariant::Int || aType==QVariant::String) { - if( studyDS->IsString( aName ) ) + if(aType==QVariant::String) { PyConsole_Console* pyConsole = app->pythonConsole(); PyConsole_Interp* pyInterp = pyConsole->getInterp(); @@ -344,7 +351,8 @@ SalomeApp_DoubleSpinBox::SearchState SalomeApp_DoubleSpinBox::findVariable( cons return IncorrectType; } } - value = studyDS->GetReal( aName ); + bool bOk; + value = aVariant.toDouble(&bOk); return Found; } return IncorrectType; diff --git a/src/SalomeApp/SalomeApp_IntSpinBox.cxx b/src/SalomeApp/SalomeApp_IntSpinBox.cxx index 27427d2e6..fbae1e297 100644 --- a/src/SalomeApp/SalomeApp_IntSpinBox.cxx +++ b/src/SalomeApp/SalomeApp_IntSpinBox.cxx @@ -25,6 +25,7 @@ #include "SalomeApp_IntSpinBox.h" #include "SalomeApp_Application.h" #include "SalomeApp_Study.h" +#include "SalomeApp_Notebook.h" #include @@ -278,14 +279,19 @@ SalomeApp_IntSpinBox::SearchState SalomeApp_IntSpinBox::findVariable( const QStr { if( SalomeApp_Study* study = dynamic_cast( app->activeStudy() ) ) { - _PTR(Study) studyDS = study->studyDS(); - - std::string aName = name.toStdString(); - if( studyDS->IsVariable( aName ) ) + std::string aName = name.toStdString(); + // + SalomeApp_Notebook aNotebook( study ); + bool bisParameter=aNotebook.isParameter(name); + // + if(bisParameter) { - if( studyDS->IsInteger( aName ) || studyDS->IsString( aName ) ) + QVariant aVariant=aNotebook.get(name); + QVariant::Type aType=aVariant.type(); + + if(aType==QVariant::Int || aType==QVariant::String) { - if( studyDS->IsString( aName ) ) + if(aType==QVariant::String) { PyConsole_Console* pyConsole = app->pythonConsole(); PyConsole_Interp* pyInterp = pyConsole->getInterp(); @@ -302,7 +308,8 @@ SalomeApp_IntSpinBox::SearchState SalomeApp_IntSpinBox::findVariable( const QStr return IncorrectType; } } - value = studyDS->GetInteger( aName ); + bool bOk; + value = aVariant.toInt(&bOk); return Found; } return IncorrectType; -- 2.39.2