Back to index

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

List of all members.

Public Member Functions

def __init__
def GetAvailable
def __iter__
def __len__
def remove
def __setitem__
def __delitem__
def __getitem__
def __getattr__
def index
def append
def GetData
def SetData
def Clear
def __repr__
def __call__

Public Attributes

 SMProperty
 Proxy

Properties

 Available
 Name

Detailed Description

A ProxyProperty provides access to one or more proxies. You can use
a slice to get one or more property values:
> proxy = property[2]
or
> proxies = property[0:5:2]
You can use a slice to set one or more property values:
> property[2] = proxy
or
> property[1:3] = (proxy1, proxy2)
You can also append and delete:
> property.append(proxy)
and
> del property[1:2]

You can also remove all elements with Clear().

Note that some properties expect only 1 proxy and will complain if
you set the number of values to be something else.

Definition at line 987 of file paravisSM.py.


Constructor & Destructor Documentation

def paravisSM.ProxyProperty.__init__ (   self,
  proxy,
  smproperty 
)
Default constructor.  Stores a reference to the proxy.  Also looks
at domains to find valid values.

Reimplemented from paravisSM.Property.

Definition at line 1007 of file paravisSM.py.

01007 
01008     def __init__(self, proxy, smproperty):
01009         """Default constructor.  Stores a reference to the proxy.  Also looks
01010         at domains to find valid values."""
01011         Property.__init__(self, proxy, smproperty)
01012         # Check to see if there is a proxy list domain and, if so,
01013         # initialize ourself. (Should this go in ProxyProperty?)
01014         listdomain = self.GetDomain('proxy_list')
01015         if listdomain:
01016             if listdomain.GetClassName() != 'vtkSMProxyListDomain':
01017                 raise ValueError, "Found a 'proxy_list' domain on an InputProperty that is not a ProxyListDomain."
01018             pm = ProxyManager()
01019             group = "pq_helper_proxies." + proxy.GetGlobalIDAsString()
01020             if listdomain.GetNumberOfProxies() == 0:
01021                 for i in xrange(listdomain.GetNumberOfProxyTypes()):
01022                     igroup = listdomain.GetProxyGroup(i)
01023                     name = listdomain.GetProxyName(i)
01024                     iproxy = CreateProxy(igroup, name)
01025                     listdomain.AddProxy(iproxy)
01026                     pm.RegisterProxy(group, proxy.GetPropertyName(smproperty), iproxy)
01027                 listdomain.SetDefaultValues(self.SMProperty)

Here is the call graph for this function:


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.ProxyProperty.__delitem__ (   self,
  idx 
)
Removes the element idx

Definition at line 1071 of file paravisSM.py.

01071 
01072     def __delitem__(self,idx):
01073       """Removes the element idx"""
01074       if isinstance(idx, slice):
01075         indices = idx.indices(len(self))
01076         # Collect the elements to delete to a new list first.
01077         # Otherwise indices are screwed up during the actual
01078         # remove loop.
01079         toremove = []
01080         for i in range(*indices):
01081           toremove.append(self[i])
01082         for i in toremove:
01083           self.SMProperty.RemoveProxy(i.SMProxy)
01084         self._UpdateProperty()
01085       elif idx >= len(self) or idx < 0:
01086         raise IndexError
01087       else:
01088         self.SMProperty.RemoveProxy(self[idx].SMProxy)
01089         self._UpdateProperty()

Here is the call graph for this function:

def paravisSM.ProxyProperty.__getattr__ (   self,
  name 
)

Reimplemented from paravisSM.Property.

Definition at line 1103 of file paravisSM.py.

01103 
01104     def __getattr__(self, name):
01105         "Unknown attribute requests get forwarded to SMProperty."
01106         return getattr(self.SMProperty, name)

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

Reimplemented in paravisSM.InputProperty.

Definition at line 1090 of file paravisSM.py.

01090 
01091     def __getitem__(self, idx):
01092       """Returns the range [min, max) of elements. Raises an IndexError
01093       exception if an argument is out of bounds."""
01094       if isinstance(idx, slice):
01095         indices = idx.indices(len(self))
01096         retVal = []
01097         for i in range(*indices):
01098           retVal.append(_getPyProxy(self.SMProperty.GetProxy(i)))
01099         return retVal
01100       elif idx >= len(self) or idx < 0:
01101         raise IndexError
01102       return _getPyProxy(self.SMProperty.GetProxy(idx))

Here is the call graph for this function:

Implementation of the sequence API

Definition at line 1045 of file paravisSM.py.

01045 
01046     def __iter__(self):
01047         """Implementation of the sequence API"""
01048         return GenericIterator(self)

Here is the caller graph for this function:

Returns the number of elements.

Definition at line 1049 of file paravisSM.py.

01049 
01050     def __len__(self):
01051         """Returns the number of elements."""
01052         return self.SMProperty.GetNumberOfProxies()

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

Reimplemented in paravisSM.InputProperty.

Definition at line 1058 of file paravisSM.py.

01058 
01059     def __setitem__(self, idx, value):
01060       """Given a list or tuple of values, sets a slice of values [min, max)"""
01061       if isinstance(idx, slice):
01062         indices = idx.indices(len(self))
01063         for i, j in zip(range(*indices), value):
01064           self.SMProperty.SetProxy(i, j.SMProxy)
01065         self._UpdateProperty()
01066       elif idx >= len(self) or idx < 0:
01067         raise IndexError
01068       else:
01069         self.SMProperty.SetProxy(idx, value.SMProxy)
01070         self._UpdateProperty()

Here is the call graph for this function:

def paravisSM.ProxyProperty.append (   self,
  proxy 
)

Reimplemented in paravisSM.InputProperty.

Definition at line 1116 of file paravisSM.py.

01116 
01117     def append(self, proxy):
01118         "Appends the given proxy to the property values."
01119         self.SMProperty.AddProxy(proxy.SMProxy)
01120         self._UpdateProperty()

Here is the call graph for this function:

Definition at line 1153 of file paravisSM.py.

01153 
01154     def Clear(self):
01155         "Removes all elements."
01156         self.SMProperty.RemoveAllProxies()
01157         self._UpdateProperty()

Here is the call graph for this function:

If this proxy has a list domain, then this function returns the
strings you can use to select from the domain.  If there is no such
list domain, the returned list is empty.

Definition at line 1028 of file paravisSM.py.

01028 
01029     def GetAvailable(self):
01030         """If this proxy has a list domain, then this function returns the
01031         strings you can use to select from the domain.  If there is no such
01032         list domain, the returned list is empty."""
01033         listdomain = self.GetDomain('proxy_list')
01034         retval = []
01035         if listdomain:
01036             for i in xrange(listdomain.GetNumberOfProxies()):
01037                 proxy = listdomain.GetProxy(i)
01038                 retval.append(proxy.GetXMLLabel())
01039         return retval

Reimplemented in paravisSM.InputProperty.

Definition at line 1121 of file paravisSM.py.

01121 
01122     def GetData(self):
01123         "Returns all elements as either a list or a single value."
01124         property = self.SMProperty
01125         if property.GetRepeatable() or property.GetNumberOfProxies() > 1:
01126             return self[0:len(self)]
01127         else:
01128             if property.GetNumberOfProxies() > 0:
01129                 return _getPyProxy(property.GetProxy(0))
01130         return None

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.ProxyProperty.index (   self,
  proxy 
)

Definition at line 1107 of file paravisSM.py.

01107 
01108     def index(self, proxy):
01109         idx = 0
01110         for px in self:
01111             ## VSV: ==
01112             if proxy.IsSame(px):
01113                 return idx
01114             idx += 1
01115         raise ValueError("proxy is not in the list.")

def paravisSM.ProxyProperty.remove (   self,
  proxy 
)
Removes the first occurence of the proxy from the property.

Definition at line 1053 of file paravisSM.py.

01053 
01054     def remove(self, proxy):
01055         """Removes the first occurence of the proxy from the property."""
01056         self.SMProperty.RemoveProxy(proxy.SMProxy)
01057         self._UpdateProperty()
        

Here is the call graph for this function:

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

Reimplemented in paravisSM.InputProperty.

Definition at line 1131 of file paravisSM.py.

01131 
01132     def SetData(self, values):
01133         """Allows setting of all values at once. Requires a single value,
01134         a tuple or list."""
01135         if isinstance(values, str):
01136             position = -1
01137             try:
01138                 position = self.Available.index(values)
01139             except:
01140                 raise ValueError, values + " is not a valid object in the domain."
01141             values = self.GetDomain('proxy_list').GetProxy(position)
01142         if not isinstance(values, tuple) and \
01143            not isinstance(values, list):
01144             values = (values,)
01145         self.SMProperty.RemoveAllProxies()
01146         for value in values:
01147             if isinstance(value, Proxy):
01148                 value_proxy = value.SMProxy
01149             else:
01150                 value_proxy = value
01151             self.SMProperty.AddProxy(value_proxy)
01152         self._UpdateProperty()

Here is the call 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

Initial value:
property(GetAvailable, None, None,
                         """This read only property is a list of strings you canuse to select from the list domain.  If there is nosuch list domain, the array is empty.""")

Definition at line 1040 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: