From: Paul RASCLE Date: Mon, 3 Jun 2019 13:05:00 +0000 (+0200) Subject: multi-study removal X-Git-Tag: SH_V2_2_0~27^2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b9c18d877c0220362150b7f811af4560d6ae5622;p=modules%2Fhydrosolver.git multi-study removal --- diff --git a/src/HYDROGUI/HYDROSOLVERGUI.py b/src/HYDROGUI/HYDROSOLVERGUI.py index 1e62aff..db1f814 100755 --- a/src/HYDROGUI/HYDROSOLVERGUI.py +++ b/src/HYDROGUI/HYDROSOLVERGUI.py @@ -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)) diff --git a/src/HYDROTools/interpolS.py b/src/HYDROTools/interpolS.py index c116ebd..1b91024 100644 --- a/src/HYDROTools/interpolS.py +++ b/src/HYDROTools/interpolS.py @@ -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) diff --git a/src/salome_hydro/assignStrickler_gui.py b/src/salome_hydro/assignStrickler_gui.py index 5d01d1d..b06343d 100644 --- a/src/salome_hydro/assignStrickler_gui.py +++ b/src/salome_hydro/assignStrickler_gui.py @@ -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()) diff --git a/src/salome_hydro/interpolz_gui.py b/src/salome_hydro/interpolz_gui.py index 87907c8..cc1156e 100644 --- a/src/salome_hydro/interpolz_gui.py +++ b/src/salome_hydro/interpolz_gui.py @@ -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()) diff --git a/src/salome_hydro/run_study/genjobwindow.py b/src/salome_hydro/run_study/genjobwindow.py index 685a9a1..305676f 100644 --- a/src/salome_hydro/run_study/genjobwindow.py +++ b/src/salome_hydro/run_study/genjobwindow.py @@ -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): diff --git a/src/salome_hydro/study.py b/src/salome_hydro/study.py index dd066ee..efa2214 100644 --- a/src/salome_hydro/study.py +++ b/src/salome_hydro/study.py @@ -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):