navigate.model.features.feature_container.TreeNode
- class navigate.model.features.feature_container.TreeNode(feature_name, func_dict, *, node_type='one-step', device_related=False, need_response=False)
Bases:
object
TreeNode class for representing a node in a control sequence tree.
This class represents a node in a control sequence tree used for controlling the behavior of a microscope or similar device. Each node has a name, associated functions, and properties that define its behavior in the control sequence.
Notes:
This class is used to represent nodes in a control sequence tree where each node corresponds to a feature or action in the control sequence.
The node_funcs attribute contains a dictionary of functions associated with this node, which are executed in response to specific signals or events.
The node_type attribute specifies whether the node is a ‘one-step’ node or a ‘multi-step’ node.
The device_related attribute indicates whether the node is related to device control.
The need_response attribute indicates whether a response is expected from this node when it is executed.
- __init__(feature_name, func_dict, *, node_type='one-step', device_related=False, need_response=False)
Initialize the TreeNode object.
Parameters:
- feature_namestr
The name or identifier of the feature associated with this node.
- func_dictdict
A dictionary containing functions associated with this node. The dictionary should include keys for different signals or events and corresponding function references to be executed when those signals are received.
- node_typestr, optional
The type of the node, which can be ‘one-step’ or ‘multi-step’. Default is ‘one-step’.
- device_relatedbool, optional
A boolean indicating whether the node is related to device control. Default is False.
- need_responsebool, optional
A boolean indicating whether a response is needed from this node. Default is False.
Methods
__init__
(feature_name, func_dict, *[, ...])Initialize the TreeNode object.
set_property
(**kwargs)Set the properties of the TreeNode object using keyword arguments.
Attributes
The name or identifier of the feature associated with this node.
A dictionary containing functions associated with this node.
The type of the node, which can be 'one-step' or 'multi-step'.
A boolean indicating whether the node is related to device control.
A boolean indicating whether a response is needed from this node.
A boolean indicating whether the node has been initialized.
- set_property(**kwargs)
Set the properties of the TreeNode object using keyword arguments.
This method allows setting or updating the properties of the TreeNode object using keyword arguments. The method iterates through the provided keyword- argument pairs and updates the corresponding attributes of the TreeNode object.
Parameters:
- **kwargsdict
Keyword arguments with attribute names as keys and values to set as values.
- device_related
A boolean indicating whether the node is related to device control.
- Type:
bool
- is_initialized
A boolean indicating whether the node has been initialized.
- Type:
bool
- need_response
A boolean indicating whether a response is needed from this node.
- Type:
bool
- node_funcs
A dictionary containing functions associated with this node.
- Type:
dict
- node_name
The name or identifier of the feature associated with this node.
- Type:
str
- node_type
The type of the node, which can be ‘one-step’ or ‘multi-step’.
- Type:
str