###
# 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()
# 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__
###
# 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
# 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))
# 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):
"""
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)
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())
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
#import MEDLoader
import HYDROPy
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()
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())
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())
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):
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):