Version: 9.12.0
studyedit.StudyEditor Class Reference

This class provides utility methods to complement Study and StudyBuilder classes. More...

Public Member Functions

def study (self)
 
def builder (self)
 
def lcc (self)
 
def findOrCreateComponent (self, moduleName, componentName=None, icon=None, containerName=_DEFAULT_CONTAINER)
 Find a component corresponding to the Salome module moduleName in the study. More...
 
def loadComponentEngine (self, sComponent, containerName=_DEFAULT_CONTAINER)
 Load the engine corresponding to sComponent in the container containerName, associate the engine with the component and load the CORBA objects of this component in the study. More...
 
def getOrLoadObject (self, item)
 Get the CORBA object associated with the SObject item, eventually by first loading it with the corresponding engine. More...
 
def findOrCreateItem (self, fatherItem, name, fileType=None, fileName=None, comment=None, icon=None, IOR=None, typeId=None)
 Find an object under fatherItem in the study with the given attributes. More...
 
def findItem (self, fatherItem, name=None, fileType=None, fileName=None, comment=None, icon=None, IOR=None, typeId=None)
 Find an item with given attributes under fatherItem in the study. More...
 
def createItem (self, fatherItem, name, fileType=None, fileName=None, comment=None, icon=None, IOR=None, typeId=None)
 Create a new object named name under fatherItem in the study, with the given attributes. More...
 
def setItem (self, item, name=None, fileType=None, fileName=None, comment=None, icon=None, IOR=None, typeId=None)
 Modify the attributes of an item in the study. More...
 
def removeItem (self, item, withChildren=False)
 Remove the given item from the study. More...
 
def setItemAtTag (self, fatherItem, tag, name=None, fileType=None, fileName=None, comment=None, icon=None, IOR=None, typeId=None)
 Find an item tagged tag under fatherItem in the study tree or create it if there is none, then set its attributes. More...
 
def getName (self, sObject)
 Return the name of the object sObject. More...
 
def setName (self, sObject, name)
 Set the name of the object sObject. More...
 
def getComment (self, sObject)
 Return the comment of the object sObject. More...
 
def setComment (self, sObject, comment)
 Set the comment of the object sObject. More...
 
def getAttributeValue (self, sObject, attributeName, default=None)
 Return the value of the attribute named attributeName on the object sObject, or default if the attribute doesn't exist. More...
 
def setAttributeValue (self, sObject, attributeName, attributeValue)
 Set the value of the attribute named attributeName on the object sObject to the value attributeValue. More...
 
def getTypeId (self, sObject)
 Return the value of the attribute "AttributeLocalID" of the object sObject, or None if it is not set. More...
 
def setTypeId (self, sObject, value)
 Set the attribute "AttributeLocalID" of the object sObject to the value value. More...
 
def getFileType (self, sObject)
 Return the value of the attribute "AttributeFileType" of the object sObject, or an empty string if it is not set. More...
 
def setFileType (self, sObject, value)
 Set the attribute "AttributeFileType" of the object sObject to the value value. More...
 
def getFileName (self, sObject)
 Return the value of the attribute "AttributeExternalFileDef" of the object sObject, or an empty string if it is not set. More...
 
def setFileName (self, sObject, value)
 Set the attribute "AttributeExternalFileDef" of the object sObject to the value value. More...
 
def getIcon (self, sObject)
 Return the value of the attribute "AttributePixMap" of the object sObject, or an empty string if it is not set. More...
 
def setIcon (self, sObject, value)
 Set the attribute "AttributePixMap" of the object sObject to the value value. More...
 

Detailed Description

This class provides utility methods to complement Study and StudyBuilder classes.

Those methods may be moved in those classes in the future. The preferred way to get a StudyEditor object is through the method getStudyEditor which allows to reuse existing instance or through the global module attribute EDITOR.

Parameters
lccThis instance attribute provides access to the SALOME life cycle CORBA service.
studyThis instance attribute provides access to the Study object. It can be used to access the study but the attribute itself cannot be modified.
builderThis instance attribute provides access to the StudyBuilder object. It can be used to edit the study but the attribute itself cannot be modified.

Member Function Documentation

◆ builder()

◆ createItem()

def studyedit.StudyEditor.createItem (   self,
  fatherItem,
  name,
  fileType = None,
  fileName = None,
  comment = None,
  icon = None,
  IOR = None,
  typeId = None 
)

Create a new object named name under fatherItem in the study, with the given attributes.

If an object named name already exists under the father object, the new object is created with a new name name_X where X is the first available index.

param fatherItem (SObject) item under which the new item will be added.

Returns
new SObject created in the study.

See setItem() for the description of the other parameters.

References studyedit.StudyEditor.builder(), KERNEL_PY.kernel.studyedit.StudyEditor.builder(), studyedit.StudyEditor.setItem(), KERNEL_PY.kernel.studyedit.StudyEditor.setItem(), studyedit.StudyEditor.study(), and KERNEL_PY.kernel.studyedit.StudyEditor.study().

Referenced by studyedit.StudyEditor.findOrCreateItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.findOrCreateItem().

◆ findItem()

def studyedit.StudyEditor.findItem (   self,
  fatherItem,
  name = None,
  fileType = None,
  fileName = None,
  comment = None,
  icon = None,
  IOR = None,
  typeId = None 
)

◆ findOrCreateComponent()

def studyedit.StudyEditor.findOrCreateComponent (   self,
  moduleName,
  componentName = None,
  icon = None,
  containerName = _DEFAULT_CONTAINER 
)

Find a component corresponding to the Salome module moduleName in the study.

If none is found, create a new component and associate it with the corresponding engine (i.e. the engine named moduleName). Note that in Salome 5, the module name and engine name must be identical (every module must provide an engine with the same name). In Salome 6 it will be possible to define a different name for the engine.

Parameters
moduleName(string) name of the module corresponding to the component (the module name is the string value in the attribute "AttributeComment" of the component)
componentName(string) name of the new component if created. If None, use moduleName instead.
icon(string) icon for the new component (attribute "AttributePixMap").
containerName(string) name of the container in which the engine should be loaded.
Returns
the SComponent found or created.

References studyedit.StudyEditor.builder(), KERNEL_PY.kernel.studyedit.StudyEditor.builder(), studyedit.StudyEditor.lcc(), KERNEL_PY.kernel.studyedit.StudyEditor.lcc(), LifeCycleCORBA_SWIGTest.LifeCycleCORBA_SWIGTest.lcc, SALOME_StudyEditor.setIcon(), studyedit.StudyEditor.setIcon(), KERNEL_PY.kernel.studyedit.StudyEditor.setIcon(), KERNEL_PY.salome_ComponentGUI.SetName(), studyedit.StudyEditor.study(), and KERNEL_PY.kernel.studyedit.StudyEditor.study().

◆ findOrCreateItem()

def studyedit.StudyEditor.findOrCreateItem (   self,
  fatherItem,
  name,
  fileType = None,
  fileName = None,
  comment = None,
  icon = None,
  IOR = None,
  typeId = None 
)

Find an object under fatherItem in the study with the given attributes.

Return the first one found if at least one exists, otherwise create a new one with the given attributes and return it.

See setItem() for the description of the parameters.

References studyedit.StudyEditor.createItem(), KERNEL_PY.kernel.studyedit.StudyEditor.createItem(), studyedit.StudyEditor.findItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.findItem().

◆ getAttributeValue()

def studyedit.StudyEditor.getAttributeValue (   self,
  sObject,
  attributeName,
  default = None 
)

◆ getComment()

def studyedit.StudyEditor.getComment (   self,
  sObject 
)

Return the comment of the object sObject.

Referenced by studyedit.StudyEditor.findItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.findItem().

◆ getFileName()

def studyedit.StudyEditor.getFileName (   self,
  sObject 
)

Return the value of the attribute "AttributeExternalFileDef" of the object sObject, or an empty string if it is not set.

References studyedit.StudyEditor.getAttributeValue(), and KERNEL_PY.kernel.studyedit.StudyEditor.getAttributeValue().

Referenced by SALOME_PyNode.BigObjectOnDiskSequence.__getitem__(), studyedit.StudyEditor.findItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.findItem().

◆ getFileType()

def studyedit.StudyEditor.getFileType (   self,
  sObject 
)

Return the value of the attribute "AttributeFileType" of the object sObject, or an empty string if it is not set.

References studyedit.StudyEditor.getAttributeValue(), and KERNEL_PY.kernel.studyedit.StudyEditor.getAttributeValue().

Referenced by studyedit.StudyEditor.findItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.findItem().

◆ getIcon()

def studyedit.StudyEditor.getIcon (   self,
  sObject 
)

Return the value of the attribute "AttributePixMap" of the object sObject, or an empty string if it is not set.

References studyedit.StudyEditor.builder(), and KERNEL_PY.kernel.studyedit.StudyEditor.builder().

Referenced by studyedit.StudyEditor.findItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.findItem().

◆ getName()

def studyedit.StudyEditor.getName (   self,
  sObject 
)

Return the name of the object sObject.

Referenced by studyedit.StudyEditor.findItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.findItem().

◆ getOrLoadObject()

def studyedit.StudyEditor.getOrLoadObject (   self,
  item 
)

Get the CORBA object associated with the SObject item, eventually by first loading it with the corresponding engine.

References studyedit.StudyEditor.loadComponentEngine(), and KERNEL_PY.kernel.studyedit.StudyEditor.loadComponentEngine().

◆ getTypeId()

def studyedit.StudyEditor.getTypeId (   self,
  sObject 
)

Return the value of the attribute "AttributeLocalID" of the object sObject, or None if it is not set.

References studyedit.StudyEditor.getAttributeValue(), and KERNEL_PY.kernel.studyedit.StudyEditor.getAttributeValue().

Referenced by studyedit.StudyEditor.findItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.findItem().

◆ lcc()

◆ loadComponentEngine()

def studyedit.StudyEditor.loadComponentEngine (   self,
  sComponent,
  containerName = _DEFAULT_CONTAINER 
)

Load the engine corresponding to sComponent in the container containerName, associate the engine with the component and load the CORBA objects of this component in the study.

References studyedit.StudyEditor.builder(), KERNEL_PY.kernel.studyedit.StudyEditor.builder(), studyedit.StudyEditor.lcc(), KERNEL_PY.kernel.studyedit.StudyEditor.lcc(), and LifeCycleCORBA_SWIGTest.LifeCycleCORBA_SWIGTest.lcc.

Referenced by studyedit.StudyEditor.getOrLoadObject(), and KERNEL_PY.kernel.studyedit.StudyEditor.getOrLoadObject().

◆ removeItem()

def studyedit.StudyEditor.removeItem (   self,
  item,
  withChildren = False 
)

Remove the given item from the study.

Note that the items are never really deleted. They just don't appear in the study anymore.

Parameters
item(SObject) the item to be removed
withChildren(boolean) if True, also remove the children of item
Returns
True if the item was removed successfully, or False if an error happened.

References studyedit.StudyEditor.builder(), and KERNEL_PY.kernel.studyedit.StudyEditor.builder().

◆ setAttributeValue()

def studyedit.StudyEditor.setAttributeValue (   self,
  sObject,
  attributeName,
  attributeValue 
)

◆ setComment()

def studyedit.StudyEditor.setComment (   self,
  sObject,
  comment 
)

◆ setFileName()

def studyedit.StudyEditor.setFileName (   self,
  sObject,
  value 
)

Set the attribute "AttributeExternalFileDef" of the object sObject to the value value.

References studyedit.StudyEditor.setAttributeValue(), and KERNEL_PY.kernel.studyedit.StudyEditor.setAttributeValue().

Referenced by studyedit.StudyEditor.setItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.setItem().

◆ setFileType()

def studyedit.StudyEditor.setFileType (   self,
  sObject,
  value 
)

Set the attribute "AttributeFileType" of the object sObject to the value value.

References studyedit.StudyEditor.setAttributeValue(), and KERNEL_PY.kernel.studyedit.StudyEditor.setAttributeValue().

Referenced by studyedit.StudyEditor.setItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.setItem().

◆ setIcon()

def studyedit.StudyEditor.setIcon (   self,
  sObject,
  value 
)

◆ setItem()

def studyedit.StudyEditor.setItem (   self,
  item,
  name = None,
  fileType = None,
  fileName = None,
  comment = None,
  icon = None,
  IOR = None,
  typeId = None 
)

Modify the attributes of an item in the study.

Unspecified attributes (i.e. those set to None) are left unchanged.

Parameters
item(SObject) item to modify.
name(string or unicode) item name (attribute AttributeName).
fileType(string or unicode) item file type (attribute AttributeFileType).
fileName(string or unicode) item file name (attribute AttributeExternalFileDef).
comment(string or unicode) item comment (attribute AttributeComment). Note that this attribute will appear in the Value column in the object browser.
icon(string or unicode) item icon name (attribute AttributePixMap).
IOR(string) IOR of a CORBA object associated with the item (attribute AttributeIOR).
typeId(integer) item type (attribute AttributeLocalID).

References studyedit.StudyEditor.builder(), KERNEL_PY.kernel.studyedit.StudyEditor.builder(), studyedit.StudyEditor.setComment(), KERNEL_PY.kernel.studyedit.StudyEditor.setComment(), studyedit.StudyEditor.setFileName(), KERNEL_PY.kernel.studyedit.StudyEditor.setFileName(), studyedit.StudyEditor.setFileType(), KERNEL_PY.kernel.studyedit.StudyEditor.setFileType(), SALOME_StudyEditor.setIcon(), studyedit.StudyEditor.setIcon(), KERNEL_PY.kernel.studyedit.StudyEditor.setIcon(), SALOMEDSImpl_GenericVariable.setName(), SALOME_StudyEditor.setName(), studyedit.StudyEditor.setName(), KERNEL_PY.kernel.studyedit.StudyEditor.setName(), KERNEL_PY.kernel.testdata.TestData.setName(), studyedit.StudyEditor.setTypeId(), and KERNEL_PY.kernel.studyedit.StudyEditor.setTypeId().

Referenced by studyedit.StudyEditor.createItem(), KERNEL_PY.kernel.studyedit.StudyEditor.createItem(), studyedit.StudyEditor.setItemAtTag(), and KERNEL_PY.kernel.studyedit.StudyEditor.setItemAtTag().

◆ setItemAtTag()

def studyedit.StudyEditor.setItemAtTag (   self,
  fatherItem,
  tag,
  name = None,
  fileType = None,
  fileName = None,
  comment = None,
  icon = None,
  IOR = None,
  typeId = None 
)

Find an item tagged tag under fatherItem in the study tree or create it if there is none, then set its attributes.

Parameters
fatherItem(SObject) item under which the tagged item will be looked for and eventually created.
taginteger) tag of the item to look for.
Returns
the SObject at tag if found or created successfully, or None if an error happened.

See setItem() for the description of the other parameters.

References studyedit.StudyEditor.builder(), KERNEL_PY.kernel.studyedit.StudyEditor.builder(), studyedit.StudyEditor.setItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.setItem().

◆ setName()

def studyedit.StudyEditor.setName (   self,
  sObject,
  name 
)

◆ setTypeId()

def studyedit.StudyEditor.setTypeId (   self,
  sObject,
  value 
)

Set the attribute "AttributeLocalID" of the object sObject to the value value.

References studyedit.StudyEditor.setAttributeValue(), and KERNEL_PY.kernel.studyedit.StudyEditor.setAttributeValue().

Referenced by studyedit.StudyEditor.setItem(), and KERNEL_PY.kernel.studyedit.StudyEditor.setItem().

◆ study()