# run python scripts, passed as command line arguments
toimport = []
- if args.has_key('pyscript'):
- if args.has_key('gui') and args.has_key('session_gui'):
- if not args['gui'] or not args['session_gui']:
+ if args.has_key('gui') and args.has_key('session_gui'):
+ if not args['gui'] or not args['session_gui']:
+ if args.has_key('study_hdf'):
+ toopen = args['study_hdf']
+ if toopen:
+ import salome
+ salome.salome_init(toopen)
+ if args.has_key('pyscript'):
toimport = args['pyscript']
-
from salomeContextUtils import formatScriptsAndArgs
command = formatScriptsAndArgs(toimport)
if command:
0 : create a new study (default).
n (>0) : try connection to study with Id = n, or create a new one
if study not found.
+ n (str): try open study with the given file name.
"""
global salome_study_initial
global myStudyManager, myStudyId, myStudy, myStudyName
if verbose(): print "studyManager found"
# get active study Id, ref and name
+ myStudy = None
myStudyId = getActiveStudy(theStudyId)
if myStudyId == None :
- myStudyId = createNewStudy()
+ import types
+ if theStudyId and type(theStudyId) == types.StringType:
+ myStudy = myStudyManager.Open(theStudyId)
+ myStudyId = myStudy._get_StudyId()
+ else:
+ myStudyId = createNewStudy()
if verbose(): print "myStudyId",myStudyId
- myStudy = myStudyManager.GetStudyByID(myStudyId)
+
+ if myStudy == None:
+ myStudy = myStudyManager.GetStudyByID(myStudyId)
myStudyName = myStudy._get_Name()
return myStudyManager, myStudyId, myStudy, myStudyName