Package mrv :: Module dgfe :: Class _IOShell
[hide private]
[frames] | no frames]

Class _IOShell

source code

object --+        
         |        
     tuple --+    
             |    
dge._PlugShell --+
                 |
                _IOShell

This callable class, when called, will create a IOShell using the actual facade node, not the one given as input. This allows it to have the facade system handle the plugshell, or simply satisfy the original request
Nested Classes [hide private]
  __metaclass__
Metaclass wrapping all unfacade attributes on the plugshell trying to get an input connection
Instance Methods [hide private]
 
__init__(self, *args)
Initialize this instance - we can be in creator mode or in shell mode.
source code
 
__call__(self, *args)
This equals a constructor call to the shell class on the wrapped node.
source code

Inherited from tuple: __add__, __contains__, __eq__, __ge__, __getattribute__, __getitem__, __getnewargs__, __getslice__, __gt__, __hash__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __rmul__, __sizeof__, count, index

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

    Helpers
 
_getoiplug(self)
Returns: oiplug suitable for this shell or None
source code
 
_getOriginalShell(self)
Returns: instance of the original shell class that was replaced by our instance
source code
 
_getTopFacadeNodeShell(self)
Recursive method to find the first facade parent having an OI shell
source code
 
_getShells(self, shelltype)
Returns: list of ( outside ) shells, depending on the shelltype and availability.
source code
    Object Overrides

Inherited from dge._PlugShell: __getattr__, __repr__, __str__

    Values
 
get(self, *args, **kwargs)
apply to the input shell
source code
 
set(self, *args, **kwargs)
Set the given value to be used in our plug :param ignore_connection: if True, the plug can be destination of a connection and will still get its value set - usually it would be overwritten by the value form the connection.
source code

Inherited from dge._PlugShell: compatabilityRate

    Connections
 
connect(self, *args, **kwargs)
Connect this plug to otherplugshell such that otherplugshell is an input plug for our output
source code
 
connections(self, *args, **kwargs)
Returns: get all input and or output connections from this shell or to this shell as edges ( sourceshell, destinationshell )
source code
 
disconnect(self, *args, **kwargs)
Remove the connection to otherplugshell if we are connected to it.
source code
 
input(self, *args, **kwargs)
Returns: the connected input plug or None if there is no such connection
source code
 
iterShells(self, *args, **kwargs)
Iterate plugs and their connections starting at this plug :return: generator for plug shells :note: supports all options of iterShells, this method allows syntax like: node.outAttribute.iterShells( )
source code
 
outputs(self, *args, **kwargs)
Returns: a list of plugs being the destination of the connection
source code

Inherited from dge._PlugShell: isConnected

    Caching
 
cache(self, *args, **kwargs)
Returns: the cached value or raise
source code
 
clearCache(self, *args, **kwargs)
Clear caches of all output plugs as well
source code
 
hasCache(self, *args, **kwargs)
Returns: True if currently store a cached value
source code
 
setCache(self, *args, **kwargs)
Set the given value to be stored in our cache :raise: TypeError if the value is not compatible to our defined type
source code

Inherited from dge._PlugShell (private): _cachename

    Name Overrides

Inherited from dge._PlugShell: __rshift__

Static Methods [hide private]
    Object Overrides

Inherited from dge._PlugShell: __new__

Class Variables [hide private]
  __unfacade__ = ['get', 'clearCache']
  __facade__ = ['set', 'hasCache', 'setCache', 'cache', 'connect...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args)
(Constructor)

source code 
Initialize this instance - we can be in creator mode or in shell mode. ShellMode: we behave like a shell but apply customizations, true if 3 args ( node, plug, origshellcls ) CreatorMode: we only create shells of our type in ShellMode, true if 2 args
Parameters:
  • args -
    • origshellcls[0] = the shell class used on the manipulated node before we , must always be set as last arg
    • facadenode[1] = the facadenode we are connected to
Overrides: object.__init__

To Do: optimize by creating the unfacade methods exactly as we need them and bind the respective instance methods - currently this is solved with a simple if conditiion.

__call__(self, *args)
(Call operator)

source code 
This equals a constructor call to the shell class on the wrapped node. Simply return an ordinary shell at its base, but we catch some callbacks This applies to everything but connection handling

Note: the shells we create are default ones with some extra handlers for exceptions

_getoiplug(self)

source code 
Returns:
oiplug suitable for this shell or None

_getOriginalShell(self)

source code 
Returns:
instance of the original shell class that was replaced by our instance

_getTopFacadeNodeShell(self)

source code 
Recursive method to find the first facade parent having an OI shell
Returns:
topmost facade node shell or None if we are not a managed plug

_getShells(self, shelltype)

source code 
Parameters:
  • shelltype - "input" - outside input shell "output" - output shells, and the default shell
Returns:
list of ( outside ) shells, depending on the shelltype and availability. If no outside shell is avaiable, return the actual shell only As facade nodes can be nested, we have to check each level of nesting for connections into the outside world - if available, we use these, otherwise we stay 'inside'

cache(self, *args, **kwargs)

source code 
Returns:
the cached value or raise
Raises:
  • ValueError
Overrides: dge._PlugShell.cache
(inherited documentation)

clearCache(self, *args, **kwargs)

source code 
Clear caches of all output plugs as well
Overrides: dge._PlugShell.clearCache

connect(self, *args, **kwargs)

source code 
Connect this plug to otherplugshell such that otherplugshell is an input plug for our output
Parameters:
Returns:
self on success, allows chained connections
Raises:
Overrides: dge._PlugShell.connect
(inherited documentation)

connections(self, *args, **kwargs)

source code 
Parameters:
  • predicate - return true for each destination shell that you can except in the returned edge or the sourceshell where your shell is the destination.
Returns:
get all input and or output connections from this shell or to this shell as edges ( sourceshell, destinationshell )
Overrides: dge._PlugShell.connections
(inherited documentation)

disconnect(self, *args, **kwargs)

source code 
Remove the connection to otherplugshell if we are connected to it. :note: does not raise if no connection is present
Overrides: dge._PlugShell.disconnect
(inherited documentation)

get(self, *args, **kwargs)

source code 
apply to the input shell
Parameters:
  • mode - optional arbitary value specifying the mode of the get attempt
Returns:
value of the plug
Overrides: dge._PlugShell.get

hasCache(self, *args, **kwargs)

source code 
Returns:
True if currently store a cached value
Overrides: dge._PlugShell.hasCache
(inherited documentation)

input(self, *args, **kwargs)

source code 
Parameters:
  • predicate - plug will only be returned if predicate is true for it
Returns:
the connected input plug or None if there is no such connection
Overrides: dge._PlugShell.input
(inherited documentation)

iterShells(self, *args, **kwargs)

source code 
Iterate plugs and their connections starting at this plug :return: generator for plug shells :note: supports all options of iterShells, this method allows syntax like: node.outAttribute.iterShells( )
Overrides: dge._PlugShell.iterShells
(inherited documentation)

outputs(self, *args, **kwargs)

source code 
Parameters:
  • predicate - plug will only be returned if predicate is true for it - shells will be passed in
Returns:
a list of plugs being the destination of the connection
Overrides: dge._PlugShell.outputs
(inherited documentation)

set(self, *args, **kwargs)

source code 
Set the given value to be used in our plug :param ignore_connection: if True, the plug can be destination of a connection and will still get its value set - usually it would be overwritten by the value form the connection. The set value will be cleared if something upstream in it's connection chain changes. :raise AssertionError: the respective attribute must be cached, otherwise the value will be lost
Overrides: dge._PlugShell.set
(inherited documentation)

setCache(self, *args, **kwargs)

source code 
Set the given value to be stored in our cache :raise: TypeError if the value is not compatible to our defined type
Overrides: dge._PlugShell.setCache
(inherited documentation)

Class Variable Details [hide private]

__facade__

Value:
['set',
 'hasCache',
 'setCache',
 'cache',
 'connect',
 'disconnect',
 'input',
 'connections',
...