Package schrodinger :: Package tasks :: Module parameters :: Class AbstractParam
[hide private]
[frames] | no frames]

Class AbstractParam

       object --+                
                |                
sip.simplewrapper --+            
                    |            
          sip.wrapper --+        
                        |        
     PyQt4.QtCore.QObject --+    
                            |    
            Qt.QtCore.QObject --+
                                |
                               AbstractParam
Known Subclasses:


Base class for all Param classes. A Param is a descriptor for storing data,
which means that a single Param instance will manage the data values for
multiple instances of the class that owns it.

class Owner(object):
    data_x = IntParam()
    data_y = IntParam()

An instance of the Owner class can be created normally, and params can be
accessed as normal attributes:

owner_instance = Owner()
owner_instance.data_x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be
serialized and deserialized to and from JSON.

WARNING: as descriptors, instances of this class will not behave normally
if used as class variables.

Nested Classes [hide private]
  NO_VALUE
NO_VALUE()
Instance Methods [hide private]
 
valueChanged(...)
 
__init__(self, default_value=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__get__(self, owner_instance, owner_class)
Returns the value of this param for the specific owner instance.
 
__set__(self, owner_instance, value)
Set the value of this param for the specific owner instance.
 
_defaultValue(self, owner_instance=None)
Returns the default value for this param.
 
_getValue(self, owner_instance)
Gets the current value of this param for the specified instance.
 
_setValue(self, owner_instance, value)
Sets a new value for this param for the specified instance.
 
_propagateSignal(self, owner_instance=None)
Emits the appropriate signals indicating this param has changed.

Inherited from Qt.QtCore.QObject: connect, emit

Inherited from PyQt4.QtCore.QObject: __getattr__, blockSignals, childEvent, children, connectNotify, customEvent, deleteLater, destroyed, disconnect, disconnectNotify, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChildren, inherits, installEventFilter, isWidgetType, killTimer, metaObject, moveToThread, objectName, parent, property, pyqtConfigure, receivers, removeEventFilter, sender, senderSignalIndex, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent, tr, trUtf8

Inherited from sip.simplewrapper: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  DataClass = None
hash(x)

Inherited from PyQt4.QtCore.QObject: staticMetaObject

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, default_value=None)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__get__(self, owner_instance, owner_class)

 

Returns the value of this param for the specific owner instance. If the value has not been set, the default value will be returned.

Parameters:
  • owner_instance (object) - the instance on which this param is an attribute. The value returned will correspond to this instance.
  • owner_class (type) - the class of the onwer.

__set__(self, owner_instance, value)

 

Set the value of this param for the specific owner instance.

Parameters:
  • owner_instance (object) - the instance on which this param is an attribute. The value returned will correspond to this instance.
  • value (self.DataClass) - the value to set this param to

_defaultValue(self, owner_instance=None)

 

Returns the default value for this param. This is method is called when this param's value is requested from an instance on which a value has not already been set. Override this method to modify the default value.

Parameters:
  • owner_instance (object) - the instance on which this param is an attribute

_getValue(self, owner_instance)

 

Gets the current value of this param for the specified instance.

Parameters:
  • owner_instance (object) - the instance on which this param is an attribute

_setValue(self, owner_instance, value)

 

Sets a new value for this param for the specified instance.

Parameters:
  • owner_instance (object) - the instance on which this param is an attribute
  • value (self.DataClass) - the new value to set for this param

_propagateSignal(self, owner_instance=None)

 

Emits the appropriate signals indicating this param has changed. A
valueChanged signal is always emitted from this param. In addition, a
signal on the owner instance wil also be emitted, if it exists. For
example:

class Owner(object):
    data_x = IntParam()
    data_y = IntParam()

o = Owner()
o.data_xChanged.connect(slot_func)
o.data_x = 3

This will result in the slot_func being called.

The signals are propogated up the chain of owner instances, so changes
to nested params will signal that the parent params have changed as
well.

@param owner_instance: the instance on which this param is an attribute
@type owner_instance: object