X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FKERNEL_PY%2Fbatchmode_salome.py;h=8e361316437f00fc4a04e877b8e421222b52b2ea;hb=1e0307934a84d81c7685fb0e9fae0d2a023fb211;hp=d4aeb6c4329fe5cac3ec79f4b5435f9cb7d81d49;hpb=7d2fe213bdf5bf962ce11e253020c9d3e0bc1cce;p=modules%2Fkernel.git diff --git a/src/KERNEL_PY/batchmode_salome.py b/src/KERNEL_PY/batchmode_salome.py index d4aeb6c43..8e3613164 100755 --- a/src/KERNEL_PY/batchmode_salome.py +++ b/src/KERNEL_PY/batchmode_salome.py @@ -1,28 +1,29 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE # -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. # -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. # -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : batchmode_salome.py # Module : SALOME -#import salome_shared_modules -# + from omniORB import CORBA from LifeCycleCORBA import * import SALOME @@ -34,10 +35,10 @@ from SALOME_NamingServicePy import * def ImportComponentGUI(ComponentName): libName = "lib" + ComponentName + "_Swig" command = "from " + libName + " import *" - exec ( command ) + exec (command, globals()) constructor = ComponentName + "GUI_Swig()" command = "gui = " + constructor - exec ( command ) + exec (command, globals()) return gui #-------------------------------------------------------------------------- @@ -51,8 +52,8 @@ def SalomeGUIgetAllSelected(self): #-------------------------------------------------------------------------- def generateName(prefix = None): - import whrandom; - int = whrandom.randint(1,1000); + import random; + int = random.randint(1,1000); if prefix is None: return "Study" + str(int) else : @@ -64,12 +65,12 @@ def generateName(prefix = None): #WITHOUTIHMgetAllSelected = SalomeGUIgetAllSelected #WITHOUTIHMdef getDesktop(self) : -# return SalomePyQt.getDesktop() - #WITHOUTIHMreturn None +# return SalomePyQt.getDesktop() + #WITHOUTIHMreturn None #WITHOUTIHMdef getSelection(self) : -# return SalomePyQt.getSelection() - #WITHOUTIHMreturn None +# return SalomePyQt.getSelection() + #WITHOUTIHMreturn None #-------------------------------------------------------------------------- @@ -180,25 +181,25 @@ def CheckCopyPaste(theSO, theInfo ,theComponentPaste): aStudyPersist = PersistentPresentation(myStudy, aRoot, 1) if not myStudyManager.CanCopy(theSO): - raise RuntimeError, " for "+theInfo+" returns false" + raise RuntimeError(" for "+theInfo+" returns false") if not myStudyManager.Copy(theSO): - raise RuntimeError, " for "+theInfo+" returns false" + raise RuntimeError(" for "+theInfo+" returns false") if not myStudyManager.CanPaste(theSO): - raise RuntimeError, " for "+theInfo+" returns false" + raise RuntimeError(" for "+theInfo+" returns false") # check: before paste study is not changed check if aStudyPersist != PersistentPresentation(myStudy, aRoot, 1): - raise RuntimeError, "Study is changed before Paste calling for "+theInfo + raise RuntimeError("Study is changed before Paste calling for "+theInfo) aSObj = theSO if theComponentPaste: aSObj = theSO.GetFatherComponent() theInfo = theInfo + "(paste for component)" if myStudyManager.Paste(aSObj) == None: - raise RuntimeError, " for "+theInfo+" returns None object" + raise RuntimeError(" for "+theInfo+" returns None object") aNewTree = GetTree(aRoot) aLen = len(aTree) for a in range(0,aLen): @@ -208,7 +209,7 @@ def CheckCopyPaste(theSO, theInfo ,theComponentPaste): if aLen < len(aNewTree): return myStudy.FindObjectID(aNewTree[aLen]) - raise RuntimeError, "After Copy calling the tree is not changed" + raise RuntimeError("After Copy calling the tree is not changed") #-------------------------------------------------------------------------- def FindFileInDataDir(filename): @@ -245,7 +246,7 @@ while 1: pass if orb is None: - print "Warning: ORB has not been initialized !!!" + print("Warning: ORB has not been initialized !!!") # create an LifeCycleCORBA instance lcc = LifeCycleCORBA(orb) @@ -263,7 +264,7 @@ while 1: pass if lcc is None: - print "Warning: LifeCycleCORBA object has not been initialized !!!" + print("Warning: LifeCycleCORBA object has not been initialized !!!") #create a naming service instance naming_service = SALOME_NamingServicePy_i(orb) @@ -286,13 +287,13 @@ while 1: myStudyManager = obj._narrow(SALOMEDS.StudyManager) if myStudyManager is None: - print "Warning: SALOMEDS.StudyManager has not been created !!!" + print("Warning: SALOMEDS.StudyManager has not been created !!!") # create new study aListOfOpenStudies = myStudyManager.GetOpenStudies(); myStudy = None; if len(aListOfOpenStudies) == 0 : - myStudy = myStudyManager.NewStudy("Study1") + myStudy = myStudyManager.NewStudy("étude") else: myStudyName = aListOfOpenStudies[0] myStudy = myStudyManager.GetStudyByName(myStudyName) @@ -300,5 +301,5 @@ else: myStudyName = myStudy._get_Name() myStudyId = myStudy._get_StudyId() -#print myStudyId +# print(myStudyId)