From ae8dcc68a6da097847e6978db484f45b92ceb11d Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 18 Oct 2012 05:48:20 +0000 Subject: [PATCH] Initial integration of SimanIO support and SIMAN study interfaces --- bin/launchConfigureParser.py | 52 ++++++++++++++++++++++++++++++++++ bin/runSalome.py | 54 +++++++++++++++++++++++++++++++++++- 2 files changed, 105 insertions(+), 1 deletion(-) diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 5ffb99b98..a11848a78 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -66,6 +66,10 @@ valgrind_session_nam = "valgrind_session" 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 ( section) # which are stored in opts with key _ (eg SMESH_plugins) @@ -756,6 +760,40 @@ def CreateOptionParser (theAdditionalOptions=[]): 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="", + 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="", + 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="", + 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 @@ -785,6 +823,10 @@ def CreateOptionParser (theAdditionalOptions=[]): 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", @@ -1092,6 +1134,16 @@ def get_env(theAdditionalOptions=[], appname=salomeappname, cfgname=salomecfgnam 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 values to args for add_opt in theAdditionalOptions: diff --git a/bin/runSalome.py b/bin/runSalome.py index c4b62a01c..9de65c8f6 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -142,7 +142,35 @@ def get_cata_path(list_modules,modules_root_dir): 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): @@ -275,6 +303,9 @@ class SessionServer(Server): 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']: @@ -666,6 +697,27 @@ def startSalome(args, modules_list, modules_root_dir): 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 -- 2.39.2