From: adam Date: Thu, 24 Mar 2011 15:48:27 +0000 (+0000) Subject: First implementation of the --wake-up-session option X-Git-Tag: Start_BR_19998_21191~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cd6b09e92286802094864938f64426938ca2d42f;p=modules%2Fkernel.git First implementation of the --wake-up-session option --- diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index cabc859a4..fc3f11e32 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -62,6 +62,7 @@ gdb_session_nam = "gdb_session" ddd_session_nam = "ddd_session" valgrind_session_nam = "valgrind_session" shutdown_servers_nam = "shutdown_servers" +wake_up_session_nam = "wake_up_session" # values in XML configuration file giving specific module parameters ( section) # which are stored in opts with key _ (eg SMESH_plugins) @@ -707,6 +708,15 @@ def CreateOptionParser (theAdditionalOptions=[]): dest="shutdown_servers", help=help_str) + # wake up session + help_str = "Wake up a previously closed session. " + help_str += "The session object is found in the naming service pointed by the variable OMNIORB_CONFIG. " + help_str += "If this variable is not setted, the last configuration is taken. " + o_wake_up = optparse.Option("--wake-up-session", + action="store_true", + dest="wake_up_session", default=False, + help=help_str) + # All options opt_list = [o_t,o_g, # GUI/Terminal o_d,o_o, # Desktop @@ -733,6 +743,7 @@ def CreateOptionParser (theAdditionalOptions=[]): o_ddd, o_valgrind, o_shutdown, + o_wake_up, ] #std_options = ["gui", "desktop", "log_file", "py_scripts", "resources", @@ -1029,6 +1040,10 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): args[shutdown_servers_nam] = cmd_opts.shutdown_servers pass + # wake up session + if cmd_opts.wake_up_session is not None: + args[wake_up_session_nam] = cmd_opts.wake_up_session + #################################################### # Add values to args for add_opt in theAdditionalOptions: diff --git a/bin/orbmodule.py b/bin/orbmodule.py index 21abd7b14..95b6dd459 100755 --- a/bin/orbmodule.py +++ b/bin/orbmodule.py @@ -61,7 +61,13 @@ class client: if verbose(): print "Launch Naming Service++", # On lance le Naming Server (doit etre dans le PATH) - NamingServer(args).run() + test = True + if args['wake_up_session']: + test = False + pass + if test: + NamingServer(args).run() + pass print "Searching Naming Service ", ncount=0 delta=0.1 diff --git a/bin/runSalome.py b/bin/runSalome.py index ac2b60d59..e6d0a239c 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -412,11 +412,51 @@ def startSalome(args, modules_list, modules_root_dir): if verbose(): print "startSalome ", args + # + # Wake up session option + # + if args['wake_up_session']: + if "OMNIORB_CONFIG" not in os.environ: + from salome_utils import generateFileName + home = os.getenv("HOME") + appli = os.getenv("APPLI") + kwargs={} + if appli is not None: + home = os.path.join(home, appli,"USERS") + kwargs["with_username"] = True + pass + last_running_config = generateFileName(home, prefix="omniORB", + suffix="last", + extension="cfg", + hidden=True, + **kwargs) + os.environ['OMNIORB_CONFIG'] = last_running_config + pass + pass + # # Initialisation ORB and Naming Service # clt=orbmodule.client(args) + + # + # Wake up session option + # + if args['wake_up_session']: + import Engines + import SALOME + import SALOMEDS + import SALOME_ModuleCatalog + import SALOME_Session_idl + session = clt.waitNS("/Kernel/Session",SALOME.Session) + status = session.GetStatSession() + if status.activeGUI: + msg = "Session GUI is already active" + raise Exception(msg) + session.GetInterface() + return clt + # Save Naming service port name into # the file args["ns_port_log_file"] if args.has_key('ns_port_log_file'): @@ -875,7 +915,15 @@ def main(): save_config = True if args.has_key('save_config'): save_config = args['save_config'] - searchFreePort(args, save_config) + # -- + test = True + if args['wake_up_session']: + test = False + pass + if test: + searchFreePort(args, save_config) + pass + # -- #setenv.main() setenv.set_env(args, modules_list, modules_root_dir) clt = useSalome(args, modules_list, modules_root_dir)