# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# 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
# File : batchmode_salome.py
# Module : SALOME
-#import salome_shared_modules
-#
+
from omniORB import CORBA
from LifeCycleCORBA import *
import SALOME
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
#--------------------------------------------------------------------------
#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
#--------------------------------------------------------------------------
aStudyPersist = PersistentPresentation(myStudy, aRoot, 1)
if not myStudyManager.CanCopy(theSO):
- raise RuntimeError, "<CanCopy> for "+theInfo+" returns false"
+ raise RuntimeError("<CanCopy> for "+theInfo+" returns false")
if not myStudyManager.Copy(theSO):
- raise RuntimeError, "<Copy> for "+theInfo+" returns false"
+ raise RuntimeError("<Copy> for "+theInfo+" returns false")
if not myStudyManager.CanPaste(theSO):
- raise RuntimeError, "<CanPaste> for "+theInfo+" returns false"
+ raise RuntimeError("<CanPaste> 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, "<Paste> for "+theInfo+" returns None object"
+ raise RuntimeError("<Paste> for "+theInfo+" returns None object")
aNewTree = GetTree(aRoot)
aLen = len(aTree)
for a in range(0,aLen):
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):
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)
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)
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)
myStudyName = myStudy._get_Name()
myStudyId = myStudy._get_StudyId()
-#print myStudyId
+# print(myStudyId)