QNodeEditor.clipboard.clipboard.Clipboard#

class QNodeEditor.clipboard.clipboard.Clipboard(scene: NodeScene)#

Bases: object

Class that handles cutting/copying/pasting for node scenes.

This class contains methods that are called when items in a node scene are copied, pasted, or cut.

scene#

Node scene this clipboard manager is for

Type:

NodeScene

Methods

__init__

Create a new clipboard manager.

add_state

Add items to the scene from a state dictionary.

copy

Copy the state of the selected scene items to the clipboard

cut

Copy the state of the selected scene items to the clipboard, then remove them.

get_selected_state

Get the state of the selected scene items as a (JSON-safe) dictionary.

paste

Paste items into the scene from a clipboard state.

__init__(scene: NodeScene)#

Create a new clipboard manager.

Parameters:

scene (NodeScene) – Node scene this clipboard manager is for

add_state(state: dict) None#

Add items to the scene from a state dictionary.

Parameters:

state (dict) – Dictionary containing desired state of items to add

Return type:

None

copy() None#

Copy the state of the selected scene items to the clipboard

Return type:

None

cut() None#

Copy the state of the selected scene items to the clipboard, then remove them.

Return type:

None

get_selected_state(remove_after: bool = False) dict#

Get the state of the selected scene items as a (JSON-safe) dictionary.

Parameters:

remove_after (bool) – Whether to remove the selected items after getting their state

Returns:

JSON-safe dictionary representing selected scene items state

Return type:

dict

paste() None#

Paste items into the scene from a clipboard state.

Return type:

None