_base_nyx_command
_base_nyx_command
¶
Attributes¶
LOGGER = logging.getLogger(__name__)
module-attribute
¶
Classes¶
NyxCommand(stage, text, parent=None)
¶
Bases: QUndoCommand
Base undo command bound to a stage.
The stage is held weakly because it owns the undo stack that owns this command.
Commands change nodes of the stage: they list them in target_nodes, so the stage
can refuse to change nodes that belong to a reference node.
Attributes:
| Name | Type | Description |
|---|---|---|
MODIFIES_STRUCTURE |
bool
|
the command adds, removes or redefines components or nodes, which the nodes may not allow. |
Initialize NyxCommand.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
Stage
|
stage the command operates on. |
required |
text
|
str
|
undo stack text. |
required |
parent
|
QUndoCommand | None
|
parent command. |
None
|
Source code in src/nyx/core/commands/_base_nyx_command.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
Attributes¶
MODIFIES_STRUCTURE = False
class-attribute
instance-attribute
¶
stage
property
¶
Stage: stage the command operates on.
Functions¶
modifies_structure()
¶
bool: the command adds, removes or redefines components or nodes.
Source code in src/nyx/core/commands/_base_nyx_command.py
57 58 59 | |
target_nodes()
¶
Get the nodes the command changes.
Returns:
| Type | Description |
|---|---|
Iterable[Node | None]
|
nodes changed by the command. Override in subclasses. |
Source code in src/nyx/core/commands/_base_nyx_command.py
61 62 63 64 65 66 67 68 | |
validate()
¶
Check the command can be executed.
Raises:
| Type | Description |
|---|---|
NyxCommandValidationError
|
if the command arguments are invalid. |
Source code in src/nyx/core/commands/_base_nyx_command.py
50 51 52 53 54 55 | |
validate_not_locked()
¶
Check the nodes the command changes can be changed.
Raises:
| Type | Description |
|---|---|
NyxCommandValidationError
|
if a node belongs to a reference node, or the command changes the structure of a node that doesn't allow it. |
Source code in src/nyx/core/commands/_base_nyx_command.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |