PyFlow.Packages.PyFlowBase.Pins package¶
Submodules¶
PyFlow.Packages.PyFlowBase.Pins.AnyPin module¶
-
class
PyFlow.Packages.PyFlowBase.Pins.AnyPin.
AnyPin
(name, owningNode, direction, **kwargs)¶ Bases:
PyFlow.Core.PinBase.PinBase
Abstract Pin – “AnyPin”
This Pin Type is an abstraction of Pins, it is a Pin that will act as any other defined Pin. This type of Pin allow to create abstract Nodes that can operate in more than one dataType.
By default AnyPin non Initialized will be marked as error, as PyFlow can’t know what is inside. This Error can be avoided by enabling
PyFlow.Core.Common.PinOptions.AllowAny
. Thats how NonTyped Lists are made.By default
PyFlow.Core.Common.PinOptions.ChangeTypeOnConnection
is enabled, and that means that it will change its internal dataType to the new dataType provided by connection or user Initialization. If disabled, pin will not allow changes.Is important to define a bunch of allowedDataTypes on pin creation, this will restrict what pins can be connected and what no, so even being a AnyPin, it can be defined to allow for example only [“FloatPin”,”IntPin”] so only those could be connected.
Parameters: - self.singleInit – can be set to True, so once initialized, it will never be able to change dataType
- self.checkForErrors – can be set To False so it will never try to find errors
- Signals:
- typeChanged : Fired when dataType has change
-
__init__
(name, owningNode, direction, **kwargs)¶ Parameters: - name (string) – Pin name
- owningNode (
PyFlow.Core.NodeBase.NodeBase
) – Owning Node - direction (
PyFlow.Core.Common.PinDirection
) – PinDirection , can be input or output
-
aboutToConnect
(other)¶ Function called before real connection but after
PyFlow.Core.Common.canConnectPins()
returns TrueWe traverse connected and constrained Pins here to search if we can change Pin dataType, and if we can we traverse again changing all the necessary datatypes in connected Graph Pins.
Parameters: other ( PyFlow.Core.PinBase.PinBase
) – Pin that will be connected to this Pin.
-
allowedDataTypes
(checked=[], dataTypes=[], selfCheck=True, defaults=False)¶ Recursive Function to intersect allowedDatatypes of all connected pins.
Parameters: - checked (list, optional) – Already visited Pins, defaults to []
- dataTypes (list, optional) – Intersected dataTypes, defaults to []
- selfCheck (bool, optional) – Define if check Pin itself or no, this is useful when trying to override a connection that is in fact the only connection that make hole graphed nodes not be able to change Type, defaults to True
- defaults (bool, optional) – Define if we are intersecting current allowedDataTypes, or default (as in definition of node) allowedDataTypes, defaults to False
Returns: List containing all the intersected dataTypes
Return type:
-
checkFree
(checked=[], selfCheck=True)¶ Recursive Function to find if all connected Pins are of type
AnyPin
and canChange On connection, so basically it checks if a Pin is free to change its dataType to another oneParameters: Returns: True if Pin can change current dataType
Return type:
-
static
color
()¶ Defines pin color
Can be used by gui wrapper class.
Returns: Rgba tuple Return type: typle(0, 0, 0, 255)
-
deserialize
(jsonData)¶ Reconstruct Pin from saved jsonData
Parameters: jsonData (dict) – Input Json Saved data
-
disableOptions
(*options)¶ Same as
enableOptions()
but inverse
-
enableOptions
(*options)¶ Enables flags on pin instance
Example:
>>> self.pinInstance.enableOptions(PinOptions.RenamingEnabled)
You can also pass array/set of flags
>>> self.pinInstance.enableOptions({PinOptions.RenamingEnabled, PinOptions.Dynamic})
This is equivalent of
>>> self.pinInstance.enableOptions(PinOptions.RenamingEnabled | PinOptions.Dynamic)
-
initType
(dataType, initializing=False)¶ Same as
AnyPin.aboutToConnect()
but instead of using another Pin using a dataType nameParameters: - dataType (string) – New DataType we want the pin to became
- initializing (bool, optional) – If initializing AnyPin can have same strength as other types, if not, “AnyPin” Pin will always be weaker than other dataType, if, defaults to False
Returns: True if it can change to the asked dataType
Return type:
-
static
internalDataStructure
()¶ Static hint of what real python type is this pin
Return type: object Raises: NotImplementedError – If not implemented
-
pinConnected
(other)¶ Pin Connection been Made
We update Error here to search for nonInitialized Pins in current Node, and in connected Nodes if initializing
Parameters: other ( PyFlow.Core.PinBase.PinBase
) – Pin that has been connected to this Pin.
-
static
pinDataTypeHint
()¶ Hint of what data type is this pin, as well as default value for this data type.
Used to easily find pin classes by type id.
Return type: tuple(str, object) Raises: NotImplementedError – If not implemented
-
pinDisconnected
(other)¶ Pin has been disconnected
We update error here and checkFor errors in owning Node
Parameters: other ( PyFlow.Core.PinBase.PinBase
) – Pin that has been disconnected to this Pin.
-
static
processData
(data)¶ Defines how data is processed
Returns: Processed data Return type: object Raises: NotImplementedError – If not implemented
-
serialize
()¶ Stores The data to Json
Appends current value and currentDataType to default
PyFlow.Core.PinBase.PinBase.serialize()
method :returns: json data :rtype: dict
-
setType
(dataType)¶ Here is where
AnyPin
heredates all the properties from other defined dataTypes and act like thoseParameters: dataType (string) – New DataType Returns: True if success setting dataType Return type: bool
-
setTypeFromData
(data)¶ Initialize DataType from actual data
Iterates all defined Pin and compares type(data) with Pin.internalDataStructure() to find a valid DataType
Parameters: data – Actual data to search Pin/dataType from
-
static
supportedDataTypes
()¶ Tuple with all the Defined value Pin Classes
-
updateError
(traversed=[], updateNeis=False)¶ Check is Pin dataType is “AnyPin” and if it is, checks if it can change Type on connection, and if it can, marked as error. Is a iterative Function that traverses connected and constrained Pins
Parameters:
-
updateOnConnectionCallback
(pin, dataType, init=False, other=None)¶ Method Called in traverse function
PyFlow.Core.Common.traverseConstrainedPins()
This Function is called for all the connected Pins to the initial Pin calling it. Here we traverse all pins and call
AnyPin.setType()
for all of them. We also intersect all the connected pins allowedDataTypes. :param pin: Pin to perform operations on :type pin:AnyPin
:param dataType: New DataType to apply :type dataType: string :param init: If initializing AnyPin can have same strength as other types, if not, “AnyPin” Pin will always be weaker than other dataType, if, defaults to False :type init: bool, optional :param other: other Pin to heredate stuff from him, defaults to None :type other:PyFlow.Core.PinBase.PinBase
, optional
PyFlow.Packages.PyFlowBase.Pins.BoolPin module¶
-
class
PyFlow.Packages.PyFlowBase.Pins.BoolPin.
BoolPin
(name, parent, direction, **kwargs)¶ Bases:
PyFlow.Core.PinBase.PinBase
doc string for BoolPin
-
__init__
(name, parent, direction, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
static
color
()¶ Defines pin color
Can be used by gui wrapper class.
Returns: Rgba tuple Return type: typle(0, 0, 0, 255)
-
static
internalDataStructure
()¶ Static hint of what real python type is this pin
Return type: object Raises: NotImplementedError – If not implemented
-
static
pinDataTypeHint
()¶ Hint of what data type is this pin, as well as default value for this data type.
Used to easily find pin classes by type id.
Return type: tuple(str, object) Raises: NotImplementedError – If not implemented
-
static
processData
(data)¶ Defines how data is processed
Returns: Processed data Return type: object Raises: NotImplementedError – If not implemented
-
static
supportedDataTypes
()¶ List of supported data types
List of data types that can be casted to this type. For example - int can support float, or vector3 can support vector4 etc.
Return type: list(object) Raises: NotImplementedError – If not implemented
-
PyFlow.Packages.PyFlowBase.Pins.ExecPin module¶
-
class
PyFlow.Packages.PyFlowBase.Pins.ExecPin.
ExecPin
(name, parent, direction, **kwargs)¶ Bases:
PyFlow.Core.PinBase.PinBase
-
__init__
(name, parent, direction, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
call
(*args, **kwargs)¶ How to execute. What this should do is execute call on another pin, by using this we can evaluate nodes from left to right and define control flow
-
static
color
()¶ Defines pin color
Can be used by gui wrapper class.
Returns: Rgba tuple Return type: typle(0, 0, 0, 255)
-
static
internalDataStructure
()¶ Static hint of what real python type is this pin
Return type: object Raises: NotImplementedError – If not implemented
-
static
pinDataTypeHint
()¶ Hint of what data type is this pin, as well as default value for this data type.
Used to easily find pin classes by type id.
Return type: tuple(str, object) Raises: NotImplementedError – If not implemented
-
static
supportedDataTypes
()¶ List of supported data types
List of data types that can be casted to this type. For example - int can support float, or vector3 can support vector4 etc.
Return type: list(object) Raises: NotImplementedError – If not implemented
-
PyFlow.Packages.PyFlowBase.Pins.FloatPin module¶
-
class
PyFlow.Packages.PyFlowBase.Pins.FloatPin.
FloatPin
(name, parent, direction, **kwargs)¶ Bases:
PyFlow.Core.PinBase.PinBase
doc string for FloatPin
-
__init__
(name, parent, direction, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
static
color
()¶ Defines pin color
Can be used by gui wrapper class.
Returns: Rgba tuple Return type: typle(0, 0, 0, 255)
-
static
internalDataStructure
()¶ Static hint of what real python type is this pin
Return type: object Raises: NotImplementedError – If not implemented
-
static
pinDataTypeHint
()¶ data type index and default value
-
static
processData
(data)¶ Defines how data is processed
Returns: Processed data Return type: object Raises: NotImplementedError – If not implemented
-
static
supportedDataTypes
()¶ List of supported data types
List of data types that can be casted to this type. For example - int can support float, or vector3 can support vector4 etc.
Return type: list(object) Raises: NotImplementedError – If not implemented
-
PyFlow.Packages.PyFlowBase.Pins.IntPin module¶
-
class
PyFlow.Packages.PyFlowBase.Pins.IntPin.
IntPin
(name, parent, direction, **kwargs)¶ Bases:
PyFlow.Core.PinBase.PinBase
doc string for IntPin
-
__init__
(name, parent, direction, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
static
color
()¶ Defines pin color
Can be used by gui wrapper class.
Returns: Rgba tuple Return type: typle(0, 0, 0, 255)
-
static
internalDataStructure
()¶ Static hint of what real python type is this pin
Return type: object Raises: NotImplementedError – If not implemented
-
static
pinDataTypeHint
()¶ Hint of what data type is this pin, as well as default value for this data type.
Used to easily find pin classes by type id.
Return type: tuple(str, object) Raises: NotImplementedError – If not implemented
-
static
processData
(data)¶ Defines how data is processed
Returns: Processed data Return type: object Raises: NotImplementedError – If not implemented
-
static
supportedDataTypes
()¶ List of supported data types
List of data types that can be casted to this type. For example - int can support float, or vector3 can support vector4 etc.
Return type: list(object) Raises: NotImplementedError – If not implemented
-
PyFlow.Packages.PyFlowBase.Pins.StringPin module¶
-
class
PyFlow.Packages.PyFlowBase.Pins.StringPin.
StringPin
(name, parent, direction, **kwargs)¶ Bases:
PyFlow.Core.PinBase.PinBase
doc string for StringPin
-
__init__
(name, parent, direction, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
static
color
()¶ Defines pin color
Can be used by gui wrapper class.
Returns: Rgba tuple Return type: typle(0, 0, 0, 255)
-
static
internalDataStructure
()¶ Static hint of what real python type is this pin
Return type: object Raises: NotImplementedError – If not implemented
-
static
pinDataTypeHint
()¶ Hint of what data type is this pin, as well as default value for this data type.
Used to easily find pin classes by type id.
Return type: tuple(str, object) Raises: NotImplementedError – If not implemented
-
static
processData
(data)¶ Defines how data is processed
Returns: Processed data Return type: object Raises: NotImplementedError – If not implemented
-
static
supportedDataTypes
()¶ List of supported data types
List of data types that can be casted to this type. For example - int can support float, or vector3 can support vector4 etc.
Return type: list(object) Raises: NotImplementedError – If not implemented
-