Back to index

salome-paravis  6.5.0
Public Member Functions | Public Attributes | Properties
paravisSM.VectorProperty Class Reference
Inheritance diagram for paravisSM.VectorProperty:
Inheritance graph
[legend]
Collaboration diagram for paravisSM.VectorProperty:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def ConvertValue
def __len__
def __iter__
def __setitem__
def GetElement
def __getitem__
def GetData
def SetData
def Clear
def __repr__
def __call__
def __getattr__

Public Attributes

 SMProperty
 Proxy

Properties

 Name

Detailed Description

A VectorProperty provides access to one or more values. You can use
a slice to get one or more property values:
> val = property[2]
or
> vals = property[0:5:2]
You can use a slice to set one or more property values:
> property[2] = val
or
> property[1:3] = (1,2)

Definition at line 610 of file paravisSM.py.


Member Function Documentation

def paravisSM.Property.__call__ (   self) [inherited]
Forces a property update using InvokeCommand.

Definition at line 563 of file paravisSM.py.

00563 
00564     def __call__(self):
00565         """Forces a property update using InvokeCommand."""
00566         if type(self) is Property:
00567             self.Proxy.SMProxy.InvokeCommand(self._FindPropertyName())
00568         else:
00569             raise RuntimeError, "Cannot invoke this property"

Here is the call graph for this function:

def paravisSM.Property.__getattr__ (   self,
  name 
) [inherited]

Reimplemented in paravisSM.ProxyProperty.

Definition at line 585 of file paravisSM.py.

00585 
00586     def __getattr__(self, name):
00587         "Unknown attribute requests get forwarded to SMProperty."
00588         return getattr(self.SMProperty, name)

def paravisSM.VectorProperty.__getitem__ (   self,
  idx 
)
Returns the range [min, max) of elements. Raises an IndexError
exception if an argument is out of bounds.

Reimplemented in paravisSM.ArrayListProperty, and paravisSM.ArraySelectionProperty.

Definition at line 648 of file paravisSM.py.

00648 
00649     def __getitem__(self, idx):
00650         """Returns the range [min, max) of elements. Raises an IndexError
00651         exception if an argument is out of bounds."""
00652         ls = len(self)
00653         if isinstance(idx, slice):
00654             indices = idx.indices(ls)
00655             retVal = []
00656             for i in range(*indices):
00657                retVal.append(self.GetElement(i))
00658             return retVal
00659         elif idx >= ls:
00660             raise IndexError
00661         elif idx < 0:
00662             idx = ls + idx
00663             if idx < 0:
00664                 raise IndexError
00665 
00666         return self.GetElement(idx)

Here is the call graph for this function:

Implementation of the sequence API

Reimplemented in paravisSM.ArrayListProperty.

Definition at line 628 of file paravisSM.py.

00628 
00629     def __iter__(self):
00630         """Implementation of the sequence API"""
00631         return GenericIterator(self)

Here is the caller graph for this function:

Returns the number of elements.

Reimplemented in paravisSM.ArrayListProperty, and paravisSM.ArraySelectionProperty.

Definition at line 624 of file paravisSM.py.

00624 
00625     def __len__(self):
00626         """Returns the number of elements."""
00627         return self.SMProperty.GetNumberOfElements()

def paravisSM.Property.__repr__ (   self) [inherited]
Returns a string representation containing property name
and value

Definition at line 545 of file paravisSM.py.

00545 
00546     def __repr__(self):
00547         """Returns a string representation containing property name
00548         and value"""
00549         if not type(self) is Property:
00550             if self.GetData() is not None:
00551                 repr = self.GetData().__repr__()
00552             else:
00553                 repr = "None"
00554         else:
00555             repr = "Property name= "
00556             name = self.Proxy.GetPropertyName(self.SMProperty)
00557             if name:
00558                 repr += name
00559             else:
00560                 repr += "Unknown"
00561 
00562         return repr

Here is the call graph for this function:

def paravisSM.VectorProperty.__setitem__ (   self,
  idx,
  value 
)
Given a list or tuple of values, sets a slice of values [min, max)

Reimplemented in paravisSM.ArrayListProperty, and paravisSM.ArraySelectionProperty.

Definition at line 632 of file paravisSM.py.

00632 
00633     def __setitem__(self, idx, value):
00634         """Given a list or tuple of values, sets a slice of values [min, max)"""
00635         if isinstance(idx, slice):
00636             indices = idx.indices(len(self))
00637             for i, j in zip(range(*indices), value):
00638                 self.SMProperty.SetElement(i, self.ConvertValue(j))
00639             self._UpdateProperty()
00640         elif idx >= len(self) or idx < 0:
00641             raise IndexError
00642         else:
00643             self.SMProperty.SetElement(idx, self.ConvertValue(value))
00644             self._UpdateProperty()

Here is the call graph for this function:

Definition at line 692 of file paravisSM.py.

00692 
00693     def Clear(self):
00694         "Removes all elements."
00695         self.SMProperty().SetNumberOfElements(0)
00696         self._UpdateProperty()

Here is the call graph for this function:

def paravisSM.VectorProperty.ConvertValue (   self,
  value 
)

Reimplemented in paravisSM.EnumerationProperty.

Definition at line 621 of file paravisSM.py.

00621 
00622     def ConvertValue(self, value):
00623         return value

Here is the caller graph for this function:

Reimplemented in paravisSM.ArrayListProperty.

Definition at line 667 of file paravisSM.py.

00667 
00668     def GetData(self):
00669         "Returns all elements as either a list or a single value."
00670         property = self.SMProperty
00671         if property.GetRepeatable() or \
00672            property.GetNumberOfElements() > 1:
00673             return self[0:len(self)]
00674         elif property.GetNumberOfElements() == 1:
00675             return self.GetElement(0)

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.VectorProperty.GetElement (   self,
  index 
)

Reimplemented in paravisSM.EnumerationProperty.

Definition at line 645 of file paravisSM.py.

00645 
00646     def GetElement(self, index):
00647         return self.SMProperty.GetElement(index)

Here is the caller graph for this function:

def paravisSM.VectorProperty.SetData (   self,
  values 
)
Allows setting of all values at once. Requires a single value or
a iterable object.

Reimplemented in paravisSM.ArrayListProperty, paravisSM.ArraySelectionProperty, and paravisSM.ColorArrayProperty.

Definition at line 676 of file paravisSM.py.

00676 
00677     def SetData(self, values):
00678         """Allows setting of all values at once. Requires a single value or
00679         a iterable object."""
00680         if not hasattr(values, "__iter__"):
00681             values = (values,)
00682         if not self.GetRepeatable() and len(values) != self.GetNumberOfElements():
00683             raise RuntimeError("This property requires %d values." % self.GetNumberOfElements())
00684         if self.GetRepeatable():
00685             # Clean up first
00686             self.SMProperty.SetNumberOfElements(0)
00687         idx = 0
00688         for val in values:
00689             self.SMProperty.SetElement(idx, self.ConvertValue(val))
00690             idx += 1
00691         self._UpdateProperty()

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 543 of file paravisSM.py.

Definition at line 542 of file paravisSM.py.


Property Documentation

paravisSM.Property.Name [static, inherited]
Initial value:
property(_FindPropertyName, None, None,
           "Returns the name for the property")

Definition at line 589 of file paravisSM.py.


The documentation for this class was generated from the following file: