Salome HOME
multi-study removal
authorPaul RASCLE <paul.rascle@edf.fr>
Mon, 3 Jun 2019 13:05:00 +0000 (15:05 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Mon, 3 Jun 2019 13:05:00 +0000 (15:05 +0200)
src/HYDROGUI/HYDROSOLVERGUI.py
src/HYDROTools/interpolS.py
src/salome_hydro/assignStrickler_gui.py
src/salome_hydro/interpolz_gui.py
src/salome_hydro/run_study/genjobwindow.py
src/salome_hydro/study.py

index 1e62aff348163ed0c9dab04a2a511d44ee9b0096..db1f814b63855ceaca15890c956d8cd5e39bea5d 100755 (executable)
@@ -237,23 +237,23 @@ __objectid__ = 0
 ###
 # get active study ID
 ###
-def _getStudyId():
-    return sgPyQt.getStudyId()
+#def _getStudyId():
+    #return sgPyQt.getStudyId()
 
 ###
 # get active study
 ###
-def _getStudy():
-    studyId = _getStudyId()
-    study = getStudyManager().GetStudyByID(studyId)
-    return study
+#def _getStudy():
+    #studyId = _getStudyId()
+    #study = getStudyManager().GetStudyByID(studyId)
+    #return study
 
 ###
 # returns True if object has children
 ###
 def _hasChildren(sobj):
     if sobj:
-        study = _getStudy()
+        study = salome.myStudy
         iter  = study.NewChildIterator(sobj)
         while iter.More():
             name = iter.Value().GetName()
@@ -275,12 +275,13 @@ def _getContext():
 # set and return current GUI context
 # study ID is passed as parameter
 ###
-def _setContext(studyID):
+def _setContext():
     global __study2context__, __current_context__
-    if studyID not in __study2context__:
-        __study2context__[studyID] = GUIcontext()
-        pass
-    __current_context__ = __study2context__[studyID]
+    #if studyID not in __study2context__:
+        #__study2context__[studyID] = GUIcontext()
+        #pass
+    #__current_context__ = __study2context__[studyID]
+    __current_context__ = GUIcontext()
     return __current_context__
 
 ###
@@ -298,7 +299,7 @@ def _incObjToMap(m, id):
 # called when module is activated
 # returns True if activating is successfull and False otherwise
 def activate():
-    ctx = _setContext(_getStudyId())
+    ctx = _setContext()
     return True
 
 # called when module is deactivated
@@ -307,15 +308,15 @@ def deactivate():
 
 # called when active study is changed
 # active study ID is passed as parameter
-def activeStudyChanged(studyID):
-    ctx = _setContext(_getStudyId())
+def activeStudyChanged():
+    ctx = _setContext()
     pass
 
 # called when popup menu is invoked
 # popup menu and menu context are passed as parameters
 def createPopupMenu(popup, context):
     ed = getStudyEditor()
-    _setContext(ed.studyId)
+    _setContext()
     if salome.sg.SelectedCount() == 1:
         # one object is selected
         sobj = ed.study.FindObjectID(salome.sg.getSelected(0))
index c116ebde6ab03f8527e972c81f4e91491d2bf9b0..1b910242410ec88a6e8ce95d30f6f235773ac222 100644 (file)
@@ -16,7 +16,7 @@ import HYDROPy
 # Get current study id
 salome.salome_init()
 theStudy = salome.myStudy
-theStudyId = salome.myStudy._get_StudyId()
+#theStudyId = salome.myStudy._get_StudyId()
 
 """Bad parameters exception"""
 class BadParamsError(ValueError):
@@ -32,7 +32,7 @@ med_field_name: field name
 """
 def assignStrickler(case_name, med_file_name, output_file_name, med_field_name='FRICTION'):
   # Check calculation case
-  doc = HYDROPy.HYDROData_Document.Document( theStudyId )
+  doc = HYDROPy.HYDROData_Document.Document()
   case = doc.FindObjectByName(case_name)
   if case is None:
     raise BadParamsError("Calculation case '%s' not found" % case_name)
index 5d01d1d6fc14995fced557a19346bb6069d14094..b06343de49ccd8435d3524cf69aa19b9f4fcd5b3 100644 (file)
@@ -23,8 +23,8 @@ salome_gui = libSALOME_Swig.SALOMEGUI_Swig()
 
 def get_selected_calc_case():
     ind = SalomePyQt.SalomePyQt.getObjectBrowser().selectionModel().selectedIndexes()
-    aStudyId = salome.myStudyId
-    doc = HYDROPy.HYDROData_Document.Document( aStudyId )
+    #aStudyId = salome.myStudyId
+    doc = HYDROPy.HYDROData_Document.Document()
     for i in ind:
         if i.column()==0:
             name = str(i.data())
index 87907c86812a22eea79a5776e38d904dfad97855..cc1156e65e8116451dc736384c69f0f5546d9286 100644 (file)
@@ -11,7 +11,7 @@ salome.salome_init()
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 #import MEDLoader
 import HYDROPy
@@ -53,8 +53,8 @@ def get_med_groups( file_path ):
     return groups
 
 def get_hydro_regions( calc_case_name ):
-    aStudyId = salome.myStudyId
-    doc = HYDROPy.HYDROData_Document.Document( aStudyId )
+    #aStudyId = salome.myStudyId
+    doc = HYDROPy.HYDROData_Document.Document()
     case = doc.FindObjectByName( calc_case_name )
     if isinstance(case, HYDROPy.HYDROData_CalculationCase):
       regions = case.GetRegions()
@@ -74,8 +74,8 @@ def get_hydro_regions( calc_case_name ):
 
 def get_selected_calc_case():
     ind = SalomePyQt.SalomePyQt.getObjectBrowser().selectionModel().selectedIndexes()
-    aStudyId = salome.myStudyId
-    doc = HYDROPy.HYDROData_Document.Document( aStudyId )
+    #aStudyId = salome.myStudyId
+    doc = HYDROPy.HYDROData_Document.Document()
     for i in ind:
         if i.column()==0:
             name = str(i.data())
@@ -86,8 +86,8 @@ def get_selected_calc_case():
 
 def get_selected_bathy():
     ind = SalomePyQt.SalomePyQt.getObjectBrowser().selectionModel().selectedIndexes()
-    aStudyId = salome.myStudyId
-    doc = HYDROPy.HYDROData_Document.Document( aStudyId )
+    #aStudyId = salome.myStudyId
+    doc = HYDROPy.HYDROData_Document.Document()
     for i in ind:
         if i.column()==0:
             name = str(i.data())
index 685a9a1750bd2ab0986bc1b3f2f46d1221835cc4..305676fee121ec6d2dbff1ceeb751b373f0f2549 100644 (file)
@@ -20,7 +20,7 @@ from PyQt5.QtWidgets import QDialog , QFileDialog
 
 import salome
 from salome.hydro.run_study.genjob import generate_job
-from genjobwindow_ui import Ui_GenJobDialog
+from .genjobwindow_ui import Ui_GenJobDialog
 
 
 class GenJobDialog(QDialog, Ui_GenJobDialog):
index dd066ee917baa32b40580cb4e063b3b80b0ff3d9..efa22149667481ca36ea5dd2eedfaa82da3e2afd 100644 (file)
@@ -73,7 +73,7 @@ class HydroStudyEditor:
     it is :const:`None`, the edited study will be the current study.
     """
     def __init__(self, studyId = None):
-        self.editor = getStudyEditor(studyId)
+        self.editor = getStudyEditor()
         self.hydroComp = None
 
     def find_or_create_hydro_component(self):