Salome HOME
[EDF17049] : Porting to Python3
[modules/kernel.git] / src / KERNEL_PY / salome_notebook.py
index 727d01df7a780b19bf68efa8e9204ea5b1f823cd..92857da24fe50af1bdf6240e32032d57d24825e0 100644 (file)
@@ -69,24 +69,27 @@ class PseudoStudyForNoteBook(object):
 
 class NoteBook:
     
-    def __init__(self, Study):
-        self.myStudy = Study
+    def __init__(self, theIsEnablePublish = True):
+        if theIsEnablePublish:
+            self.myStudy = salome.myStudy
+        else:
+            self.myStudy = PseudoStudyForNoteBook()
     
     def set(self, variableName, variable):
         """
         Create (or modify) variable with name "variableName" 
         and value equal "theValue".
         """
-        if type(variable) == float:
+        if isinstance(variable, float):
             self.myStudy.SetReal(variableName, variable)
             
-        elif type(variable) == int:
+        elif isinstance(variable, int):
             self.myStudy.SetInteger(variableName, variable)
             
-        elif type(variable) == bool:
+        elif isinstance(variable, bool):
             self.myStudy.SetBoolean(variableName, variable)
             
-        elif type(variable) == str:
+        elif isinstance(variable, str):
             self.myStudy.SetString(variableName, variable)
             
     def get(self, variableName):
@@ -171,9 +174,8 @@ class NoteBook:
     pass
 
 def checkThisNoteBook(**kwargs):
-    study = PseudoStudyForNoteBook(**kwargs)
-    note_book = NoteBook(study)
+    note_book = NoteBook( False )
     note_book.check()
     return
 
-notebook = NoteBook(salome.myStudy)
+notebook = NoteBook()