]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
using new Notebook
authorpkv <pkv@opencascade.com>
Mon, 23 Nov 2009 08:35:57 +0000 (08:35 +0000)
committerpkv <pkv@opencascade.com>
Mon, 23 Nov 2009 08:35:57 +0000 (08:35 +0000)
src/SalomeApp/SalomeApp_DoubleSpinBox.cxx
src/SalomeApp/SalomeApp_IntSpinBox.cxx

index c784b6a260d2084d7f109ca3326b2f60dddcda4d..f63495e2363e08918857749a645ceab1c90521a6 100644 (file)
@@ -25,6 +25,7 @@
 #include "SalomeApp_DoubleSpinBox.h"
 #include "SalomeApp_Application.h"
 #include "SalomeApp_Study.h"
+#include "SalomeApp_Notebook.h"
 
 #include <SUIT_Session.h>
 
@@ -36,6 +37,7 @@
 
 #include <string>
 
+
 /*!
   \class SalomeApp_DoubleSpinBox
 */
@@ -320,14 +322,19 @@ SalomeApp_DoubleSpinBox::SearchState SalomeApp_DoubleSpinBox::findVariable( cons
   {
     if( SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( 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;
index 27427d2e68d48b83bc94b26ce9ec2c929e56b6d8..fbae1e297ee3bcc82c11307d0cc2c50fd6e29bd7 100644 (file)
@@ -25,6 +25,7 @@
 #include "SalomeApp_IntSpinBox.h"
 #include "SalomeApp_Application.h"
 #include "SalomeApp_Study.h"
+#include "SalomeApp_Notebook.h"
 
 #include <SUIT_Session.h>
 
@@ -278,14 +279,19 @@ SalomeApp_IntSpinBox::SearchState SalomeApp_IntSpinBox::findVariable( const QStr
   {
     if( SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( 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;