2 # -*- coding: iso-8859-1 -*-
3 # Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
5 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License, or (at your option) any later version.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 ###############################################
26 ############### IMPORTANT NOTE ################
27 ###############################################
28 # The salomeConsole.py script is obsolete. #
29 # Please consider the new salome launcher. #
30 ###############################################
37 #-------------------------------
38 # Python completion and others if you want
39 # You should have set PYTHONSTARTUP env variable
40 # or import user should try to import $HOME/.pythonrc.py
41 #-------------------------------
44 #-------------------------------
45 # Get major CORBA objects
46 #-------------------------------
47 from omniORB import CORBA
53 def getRunningSession():
54 omniorbUserPath = os.getenv("OMNIORB_USER_PATH")
55 files = glob.glob(os.path.join(omniorbUserPath,".omniORB_"+salome_utils.getUserName()+"_*[!last].cfg"))
61 print "You have %d sessions running" % len(files)
64 rep= raw_input("Do you want to connect to this session [y|n]")
70 os.environ['OMNIORB_CONFIG']=filename
72 rep= raw_input("Do you want to try a local session on port 2810 ? [y|n]")
74 # Try a local session running on port 2810
75 sys.argv=sys.argv+['-ORBInitRef','NameService=corbaname::localhost:2810']
80 class client(orbmodule.client):
81 def initNS(self,args):
82 # Obtain a reference to the root naming context
83 obj = self.orb.resolve_initial_references("NameService")
85 self.rootContext = obj._narrow(CosNaming.NamingContext)
87 except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
88 print "It's not a valid naming service"
89 self.rootContext = None
99 print "Naming Service address: ",clt.orb.object_to_string(clt.rootContext)
103 session_server = clt.Resolve('/Kernel/Session')
105 session=clt.waitNS("/Kernel/Session")
106 catalog=clt.waitNS("/Kernel/ModulCatalog")
107 studyMgr=clt.waitNS("/myStudyManager")
110 from salome import lcc