Back to index

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

List of all members.

Public Member Functions

def __init__
def GetAvailable
def SelectAll
def DeselectAll
def __iter__
def __len__
def __setitem__
def __getitem__
def SetData
def GetData
def ConvertValue
def GetElement
def Clear
def __repr__
def __call__
def __getattr__

Public Attributes

 SMProperty
 Proxy

Properties

 Available
 Name

Private Attributes

 __arrays

Detailed Description

This property provides a simpler interface for selecting arrays.
Simply assign a list of arrays that should be loaded by the reader.
Use the Available property to get a list of available arrays.

Definition at line 883 of file paravisSM.py.


Constructor & Destructor Documentation

def paravisSM.ArrayListProperty.__init__ (   self,
  proxy,
  smproperty 
)
Default constructor. Stores a reference to the proxy.

Reimplemented from paravisSM.Property.

Definition at line 888 of file paravisSM.py.

00888 
00889     def __init__(self, proxy, smproperty):
00890         VectorProperty.__init__(self, proxy, smproperty)
00891         self.__arrays = []


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.ArrayListProperty.__getitem__ (   self,
  idx 
)
Returns the range [min, max) of elements. Raises an IndexError
exception if an argument is out of bounds.

Reimplemented from paravisSM.VectorProperty.

Definition at line 933 of file paravisSM.py.

00933 
00934     def __getitem__(self, idx):
00935       """Returns the range [min, max) of elements. Raises an IndexError
00936       exception if an argument is out of bounds."""
00937       self.GetData()
00938       if isinstance(idx, slice):
00939           indices = idx.indices(len(self))
00940           retVal = []
00941           for i in range(*indices):
00942               retVal.append(self.__arrays[i])
00943           return retVal
00944       elif idx >= len(self) or idx < 0:
00945           raise IndexError
00946       return self.__arrays[idx]

Here is the call graph for this function:

Implementation of the sequence API

Reimplemented from paravisSM.VectorProperty.

Definition at line 911 of file paravisSM.py.

00911 
00912     def __iter__(self):
00913         """Implementation of the sequence API"""
00914         return GenericIterator(self)

Here is the caller graph for this function:

Returns the number of elements.

Reimplemented from paravisSM.VectorProperty.

Definition at line 915 of file paravisSM.py.

00915 
00916     def __len__(self):
00917         """Returns the number of elements."""
00918         return len(self.GetData())

Here is the call graph for this function:

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.ArrayListProperty.__setitem__ (   self,
  idx,
  value 
)
Given a list or tuple of values, sets a slice of values [min, max)

Reimplemented from paravisSM.VectorProperty.

Definition at line 919 of file paravisSM.py.

00919 
00920     def __setitem__(self, idx, value):
00921       """Given a list or tuple of values, sets a slice of values [min, max)"""
00922       self.GetData()
00923       if isinstance(idx, slice):
00924           indices = idx.indices(len(self))
00925           for i, j in zip(range(*indices), value):
00926               self.__arrays[i] = j
00927           self.SetData(self.__arrays)
00928       elif idx >= len(self) or idx < 0:
00929           raise IndexError
00930       else:
00931           self.__arrays[idx] = self.ConvertValue(value)
00932           self.SetData(self.__arrays)

Here is the call graph for this function:

def paravisSM.VectorProperty.Clear (   self) [inherited]

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 
) [inherited]

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:

Definition at line 907 of file paravisSM.py.

00907 
00908     def DeselectAll(self):
00909         "Deselects all arrays."
00910         self.SetData([])

Here is the call graph for this function:

Definition at line 892 of file paravisSM.py.

00892 
00893     def GetAvailable(self):
00894         "Returns the list of available arrays"
00895         dm = self.GetDomain("array_list")
00896         retVal = []
00897         for i in range(dm.GetNumberOfStrings()):
00898             retVal.append(dm.GetString(i))
00899         return retVal

Reimplemented from paravisSM.VectorProperty.

Definition at line 975 of file paravisSM.py.

00975 
00976     def GetData(self):
00977         "Returns all elements as a list."
00978         property = self.SMProperty
00979         nElems = property.GetNumberOfElements()
00980         if nElems%2 != 0:
00981             raise ValueError, "The SMProperty with XML label '%s' has a size that is not a multiple of 2." % property.GetXMLLabel()
00982         self.__arrays = []
00983         for i in range(0, nElems, 2):
00984             if self.GetElement(i+1) != '0':
00985                 self.__arrays.append(self.GetElement(i))
00986         return list(self.__arrays)

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.VectorProperty.GetElement (   self,
  index 
) [inherited]

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:

Definition at line 903 of file paravisSM.py.

00903 
00904     def SelectAll(self):
00905         "Selects all arrays."
00906         self.SetData(self.Available)

Here is the call graph for this function:

def paravisSM.ArrayListProperty.SetData (   self,
  values 
)
Allows setting of all values at once. Requires a single value,
a tuple or list.

Reimplemented from paravisSM.VectorProperty.

Definition at line 947 of file paravisSM.py.

00947 
00948     def SetData(self, values):
00949         """Allows setting of all values at once. Requires a single value,
00950         a tuple or list."""
00951         # Clean up first
00952         iup = self.SMProperty.GetImmediateUpdate()
00953         self.SMProperty.SetImmediateUpdate(False)
00954         # Clean up first
00955         self.SMProperty.SetNumberOfElements(0)
00956         if not isinstance(values, tuple) and \
00957            not isinstance(values, list):
00958             values = (values,)
00959         fullvalues = []
00960         for i in range(len(values)):
00961             val = self.ConvertValue(values[i])
00962             fullvalues.append(val)
00963             fullvalues.append('1')
00964         for array in self.Available:
00965             if not values.__contains__(array):
00966                 fullvalues.append(array)
00967                 fullvalues.append('0')
00968         i = 0
00969         for value in fullvalues:
00970             self.SMProperty.SetElement(i, value)
00971             i += 1
00972 
00973         self._UpdateProperty()
00974         self.SMProperty.SetImmediateUpdate(iup)

Here is the call graph for this function:


Member Data Documentation

Definition at line 890 of file paravisSM.py.

Definition at line 543 of file paravisSM.py.

Definition at line 542 of file paravisSM.py.


Property Documentation

Initial value:
property(GetAvailable, None, None, \
        "This read-only property contains the list of items that can be read by a reader.")

Definition at line 900 of file paravisSM.py.

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: