Package schrodinger :: Package tasks :: Module mappers :: Class Target
[hide private]
[frames] | no frames]

Class Target

       object --+            
                |            
sip.simplewrapper --+        
                    |        
          sip.wrapper --+    
                        |    
     PyQt5.QtCore.QObject --+
                            |
                           Target
Known Subclasses:

Describes a target that maps to a model param.

Instance Methods [hide private]
 
__init__(self, obj=None, getter=object(), setter=object(), signal=object(), slot=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
_getAccess(self, access, access_type)
Returns the way to access the target - either get its value, set its value, or the signal to listen to that signifies a value change.
 
onTargetSignal(self)
We connect this slot to the target's specific signal and emit the generic targetChanged signal with the new value.
 
onModelParamChanged(self, value)
 
slot(self)
 
getValue(self)
The standard method for getting a target's value, regardless of whether this is using a default getter or a custom one.
 
setValue(self, value)
The standard method for setting a target's value, regardless of whether this is using a default setter or a custom one.

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

Inherited from sip.simplewrapper: __new__

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

Static Methods [hide private]
 
_getDefaultAccess(obj, access_type)
Given an object, return the default setter/getter/signal for the object.
Class Variables [hide private]

Inherited from PyQt5.QtCore.QObject: staticMetaObject

Instance Variables [hide private]
 
targetChanged(...)
signal that gets emitted when a change in the target's value is detected.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, obj=None, getter=object(), setter=object(), signal=object(), slot=None)
(Constructor)

 

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

Parameters:
  • obj - this object, if specified, will be used to determine default access for this target.

    For example, passing in a QCheckBox, my_chk, will make the default getter my_chk.isChecked, the default setter my_chk.setChecked, and the default signal my_chk.stateChanged.

    Passing in None will disable default access. In this case only explicitly specified getters, setters, signals, and slots will be used.

  • getter (callable) - a function to get a value from the target. Overrides the default getter in obj, if specified. Passing in None will result in the target value always returning None.
  • setter (callable) - a function that sets the value on the target. Overrides the default setter in obj, if specified. Passing in None will result in the target value never being changed.
  • signal (QtCore.pyqtSignal) - the signal that indicates a change in target value. This will override the default signal in obj, if specified. The target signal is forwarded to targetChanged, to provide a common interface. Pass in None to disable monitoring of target changes.
  • slot (callable) - a function that will get called whenever the corresponding model param is changed. Will get called regardless of whether a setter or obj is specified. By default there is no slot set.
Overrides: object.__init__

_getAccess(self, access, access_type)

 

Returns the way to access the target - either get its value, set its value, or the signal to listen to that signifies a value change. This takes in either a custom setter/getter/signal, DEFAULT, or None.

Parameters:
  • access_type (AccessType) - which type of access to return

_getDefaultAccess(obj, access_type)
Static Method

 

Given an object, return the default setter/getter/signal for the object.
For example,

    self._getDefaultAccess(my_line_edit, AccessType.setter)

will return the function my_line_edit.setText, since that is the default
setter for a QLineEdit. Information about default access for each object
type is found in the DEFAULT_ACCESS_NAMES dictionary. Raises a
ValueError if the default access cannot be found.

@param obj: the target object

@param access_type: which sort of access we are looking for
@type access_type: AccessType

onTargetSignal(self)

 

We connect this slot to the target's specific signal and emit the generic targetChanged signal with the new value. This provides a uniform interface for the mapper to connect to.