shutdown_servers_nam = "shutdown_servers"
foreground_nam = "foreground"
wake_up_session_nam = "wake_up_session"
+siman_nam = "siman"
+siman_study_nam = "siman_study"
+siman_scenario_nam = "siman_scenario"
+siman_user_nam = "siman_user"
# values in XML configuration file giving specific module parameters (<module_name> section)
# which are stored in opts with key <module_name>_<parameter> (eg SMESH_plugins)
dest="server_launch_mode",
help=help_str)
+ # SIMAN launch mode
+ help_str = "Special mode for interacting with SIMAN."
+ o_siman = optparse.Option("--siman",
+ action="store_true",
+ dest="siman",
+ help=help_str)
+
+ # SIMAN study
+ help_str = "SIMAN study identifier."
+ o_siman_study = optparse.Option("--siman-study",
+ metavar="<id>",
+ type="string",
+ action="store",
+ dest="siman_study",
+ help=help_str)
+
+ # SIMAN scenario
+ help_str = "SIMAN scenario identifier."
+ o_siman_scenario = optparse.Option("--siman-scenario",
+ metavar="<id>",
+ type="string",
+ action="store",
+ dest="siman_scenario",
+ help=help_str)
+
+ # SIMAN user
+ help_str = "SIMAN user identifier."
+ o_siman_user = optparse.Option("--siman-user",
+ metavar="<id>",
+ type="string",
+ action="store",
+ dest="siman_user",
+ help=help_str)
+
# All options
opt_list = [o_t,o_g, # GUI/Terminal
o_d,o_o, # Desktop
o_foreground,
o_wake_up,
o_slm, # Server launch mode
+ o_siman, # Siman launch mode
+ o_siman_study, # Siman study
+ o_siman_scenario,# Siman scenario
+ o_siman_user, # Siman user
]
#std_options = ["gui", "desktop", "log_file", "py_scripts", "resources",
if cmd_opts.wake_up_session is not None:
args[wake_up_session_nam] = cmd_opts.wake_up_session
+ # siman options
+ if cmd_opts.siman is not None:
+ args[siman_nam] = cmd_opts.siman
+ if cmd_opts.siman_study is not None:
+ args[siman_study_nam] = cmd_opts.siman_study
+ if cmd_opts.siman_scenario is not None:
+ args[siman_scenario_nam] = cmd_opts.siman_scenario
+ if cmd_opts.siman_user is not None:
+ args[siman_user_nam] = cmd_opts.siman_user
+
####################################################
# Add <theAdditionalOptions> values to args
for add_opt in theAdditionalOptions:
return cata_path
-
+_siman_name = None
+def simanStudyName(args):
+ global _siman_name
+ if _siman_name is None:
+ # siman session paramenters and checkout processing
+ if 'siman' in args:
+ aSimanStudy=''
+ aSimanScenario=''
+ aSimanUser=''
+ if 'siman_study' in args:
+ aSimanStudy = args['siman_study']
+ else:
+ print "SIMAN study must be defined using parameter --siman-study=XXX"
+ if 'siman_scenario' in args:
+ aSimanScenario = args['siman_scenario']
+ else:
+ print "SIMAN scenario must be defined using parameter --siman-scenario=XXX"
+ if 'siman_user' in args:
+ aSimanUser = args['siman_user']
+ else:
+ print "SIMAN user must be defined using parameter --siman-user=XXX"
+
+ if aSimanStudy != '' and aSimanScenario != '' and aSimanUser != '':
+ _siman_name = aSimanStudy + "_" + aSimanScenario + "_" + aSimanUser
+ else:
+ _siman_name = ""
+ else:
+ _siman_name = ""
+ return _siman_name
class CatalogServer(Server):
def __init__(self,args):
if self.args['study_hdf'] is not None:
self.SCMD2+=['--study-hdf=%s'%self.args['study_hdf']]
pass
+ if simanStudyName(self.args) != "":
+ self.SCMD2+=['--siman-study=%s'%simanStudyName(self.args)]
+ pass
pass
pass
if self.args['noexcepthandler']:
import readline
except ImportError:
pass
+
+ # siman session paramenters and checkout processing
+ if simanStudyName(args) != "":
+ print '**********************************************'
+ print "Siman study name= '" + simanStudyName(args) + "'"
+ import SALOMEDS
+ obj = clt.Resolve('myStudyManager')
+ myStudyManager = obj._narrow(SALOMEDS.StudyManager)
+ aNewStudy = myStudyManager.NewStudy(simanStudyName(args))
+ aSimS = myStudyManager.GetSimanStudy()
+ aSimS._set_StudyId(args['siman_study'])
+ aSimS._set_ScenarioId(args['siman_scenario'])
+ aSimS._set_UserId(args['siman_user'])
+ aSimS.CheckOut(aNewStudy)
+ # if session server is enabled, activate the created study
+ if args["gui"]:
+ print "Activate the SIMAN study in the SALOME GUI"
+ obj = clt.Resolve('/Kernel/Session')
+ mySession = obj._narrow(SALOME.Session)
+ mySession.emitMessage("simanCheckoutDone " + simanStudyName(args));
+ print '**********************************************'
return clt