// File: SalomeApp_DoubleSpinBox.cxx
// Author: Oleg UVAROV
+#include <PyConsole_Interp.h> // this include must be first (see PyInterp_base.h)!
+#include <PyConsole_Console.h>
+
#include "SalomeApp_DoubleSpinBox.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Study.h"
#include <QKeyEvent>
#include <QLineEdit>
+#include <string>
+
/*!
\class SalomeApp_DoubleSpinBox
*/
std::string aName = name.toStdString();
if( studyDS->IsVariable( aName ) )
{
- if( studyDS->IsReal( aName ) || studyDS->IsInteger( aName ) )
+ if( studyDS->IsReal( aName ) || studyDS->IsInteger( aName ) || 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.setAsReal(\"";
+ command += aName;
+ command += "\")";
+ bool aResult;
+ aResult = pyInterp->run(command.c_str());
+ if(aResult)
+ {
+ return IncorrectType;
+ }
+ }
value = studyDS->GetReal( aName );
return Found;
}
// File: SalomeApp_IntSpinBox.cxx
// Author: Oleg UVAROV
+#include <PyConsole_Interp.h> //this include must be first (see PyInterp_base.h)!
+#include <PyConsole_Console.h>
+
#include "SalomeApp_IntSpinBox.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Study.h"
#include <QKeyEvent>
#include <QLineEdit>
+#include <string>
+
/*!
\class SalomeApp_IntSpinBox
*/
std::string aName = name.toStdString();
if( studyDS->IsVariable( aName ) )
{
- if( studyDS->IsInteger( aName ) )
+ if( studyDS->IsInteger( aName ) || 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;
}
// Author : Roman NIKOLAEV, Open CASCADE S.A.S.
// Module : GUI
+#include <PyConsole_Interp.h> // this include must be first (see PyInterp_base.h)!
+#include <PyConsole_Console.h>
+
#include "SalomeApp_NoteBookDlg.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Study.h"
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
-#include <PyConsole_Console.h>
-
#include <SALOMEDS_Tool.hxx>
#include <QWidget>
if(!aValue.isEmpty() &&
(IsRealValue(aValue) ||
IsIntegerValue(aValue) ||
- IsBooleanValue(aValue)))
+ IsBooleanValue(aValue) ||
+ IsValidStringValue(aValue)))
aResult = true;
return aResult;
return aResult;
}
+//============================================================================
+/*! Function : IsValidStringValue
+ * Purpose : Return true if theValue string is valid, otherwise return
+ * false
+ * The string are always valid for the moment
+ * The whole notebook is verified on apply
+ */
+//============================================================================
+bool NoteBook_TableRow::IsValidStringValue(const QString theValue)
+{
+ return true;
+}
///////////////////////////////////////////////////////////////////////////
// NoteBook_Table class //
aResult = QString::number(theStudy->GetInteger(theVarName));
else if( theStudy->IsBoolean(theVarName) )
aResult = theStudy->GetBoolean(theVarName) ? QString("True") : QString("False");
+ else if( theStudy->IsString(theVarName) )
+ aResult = theStudy->GetString(theVarName).c_str();
return aResult;
}
if( !myRows[i]->CheckName() || !IsUniqueName( myRows[i] ) || !myRows[i]->CheckValue() )
return false;
- return true;
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+ PyConsole_Console* pyConsole = app->pythonConsole();
+ PyConsole_Interp* pyInterp = pyConsole->getInterp();
+ PyLockWrapper aLock = pyInterp->GetLockWrapper();
+ string command = "import salome_notebook ; ";
+ command += "salome_notebook.checkThisNoteBook(";
+ for( int i = 0, n = aLastRowIsEmpty ? aNumRows - 1 : aNumRows; i < n; i++ )
+ {
+ command += myRows[i]->GetName().toStdString();
+ command += "=\"";
+ command += myRows[i]->GetValue().toStdString();
+ command += "\",";
+ }
+ command += ")";
+ bool aResult = pyInterp->run(command.c_str());
+ aResult = !aResult;
+ return aResult;
}
//============================================================================
else if( NoteBook_TableRow::IsBooleanValue(aValue,&aBVal) )
myStudy->SetBoolean(string(aName.toLatin1().constData()),aBVal);
+
+ else if( NoteBook_TableRow::IsValidStringValue(aValue) )
+ myStudy->SetString(string(aName.toLatin1().constData()),aValue.toStdString());
}
}
myTable->ResetMaps();