]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Initial integration of SimanIO support and SIMAN study interfaces
authormpv <mpv@opencascade.com>
Thu, 18 Oct 2012 05:48:20 +0000 (05:48 +0000)
committermpv <mpv@opencascade.com>
Thu, 18 Oct 2012 05:48:20 +0000 (05:48 +0000)
bin/launchConfigureParser.py
bin/runSalome.py

index 5ffb99b98d8c3404b5f9bddab247f750adc1c74c..a11848a78e57f653c043b73f2a67a9142d08fa9b 100755 (executable)
@@ -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 (<module_name> section)
 # which are stored in opts with key <module_name>_<parameter> (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="<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
@@ -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 <theAdditionalOptions> values to args
     for add_opt in theAdditionalOptions:
index c4b62a01c765399918c2503f85b958a71a437979..9de65c8f6367043ae40d3e53a0e0f1f8ee5d24e4 100755 (executable)
@@ -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