1 # Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # File : salome_notebook.py
23 # Author : Roman NIKOLAEV, Open CASCADE S.A.S.
27 Module salome_notebook gives access to Salome Notebook.
34 def __init__(self, Study):
37 def set(self, variableName, variable):
39 Create (or modify) variable with name "variableName"
40 and value equal "theValue".
42 if type(variable) == float:
43 self.myStudy.SetReal(variableName, variable)
45 elif type(variable) == int:
46 self.myStudy.SetInteger(variableName, variable)
48 elif type(variable) == bool:
49 self.myStudy.SetBoolean(variableName, variable)
51 def get(self, variableName):
53 Return value of the variable with name "variableName".
56 if self.myStudy.IsVariable(variableName):
58 if self.myStudy.IsReal(variableName):
59 aResult = self.myStudy.GetReal(variableName)
61 elif self.myStudy.IsInteger(variableName):
62 aResult = self.myStudy.GetInteger(variableName)
64 elif self.myStudy.IsBoolean(variableName):
65 aResult = self.myStudy.GetBoolean(variableName)
69 def isVariable(self, variableName):
71 Return true if variable with name "variableName"
72 exists in the study, otherwise return false.
74 return self.myStudy.IsVariable(variableName)
76 notebook = NoteBook(salome.myStudy)