nexxT.services.gui.GraphEditor module
This module provides the graph editor GUI service of the nexxT service.
- class nexxT.services.gui.GraphEditor.BaseGraphScene(parent)[source]
Bases:
QGraphicsSceneBasic graph display and manipulation scene. Generic base class intended to be overwritten.
- class ConnectionItem(portFrom, portTo)[source]
Bases:
QGraphicsPathItemThis item corresponds with a connection between an output and an input port.
- __init__(self, path: PySide6.QtGui.QPainterPath, /, parent: PySide6.QtWidgets.QGraphicsItem | None = None) None[source]
- __init__(self, /, parent: PySide6.QtWidgets.QGraphicsItem | None = None) None
Initialize self. See help(type(self)) for accurate signature.
- hoverEnterEvent(event)[source]
override for hover enter events
- Parameters:
event – the QT event
- Returns:
- KEY_ITEM = 0
- class NodeItem(name)[source]
Bases:
QGraphicsItemGroupAn item which represents a node in the graph. The item group is also used for grouping the port items.
- __init__(self, /, parent: PySide6.QtWidgets.QGraphicsItem | None = None) None[source]
Initialize self. See help(type(self)) for accurate signature.
- addInPortItem(name)[source]
Adds a new input port to the node
- Parameters:
name – the port name
- Returns:
- addOutPortItem(name)[source]
Adds a new output port to the node
- Parameters:
name – the port name
- Returns:
- getInPortItem(name)[source]
Searches for the input port named by name
- Parameters:
name – a string instance
- Returns:
a PortItem instance
- getOutPortItem(name)[source]
Searches for the output port named by name
- Parameters:
name – a string instance
- Returns:
a PortItem instance
- itemChange(change, value)[source]
overwritten from QGraphicsItem
- Parameters:
change – the thing that has changed
value – the new value
- Returns:
- class PortItem(name, nodeItem)[source]
Bases:
objectThis class represents a port in a node.
- scenePosChanged(value)[source]
Slot called on scene position changes, need to synchronize connections.
- Parameters:
value
- Returns:
- STYLE_ROLE_BRUSH = 2
- STYLE_ROLE_HSPACING = 5
- STYLE_ROLE_PEN = 1
- STYLE_ROLE_RRRADIUS = 3
- STYLE_ROLE_SIZE = 0
- STYLE_ROLE_TEXT_BRUSH = 6
- STYLE_ROLE_VSPACING = 4
- __init__(self, sceneRect: PySide6.QtCore.QRectF, /, parent: PySide6.QtCore.QObject | None = None, *, backgroundBrush: PySide6.QtGui.QBrush | None = None, foregroundBrush: PySide6.QtGui.QBrush | None = None, itemIndexMethod: PySide6.QtWidgets.QGraphicsScene.ItemIndexMethod | None = None, bspTreeDepth: int | None = None, palette: PySide6.QtGui.QPalette | None = None, font: PySide6.QtGui.QFont | None = None, stickyFocus: bool | None = None, minimumRenderSize: float | None = None, focusOnTouch: bool | None = None) None[source]
- __init__(self, /, parent: PySide6.QtCore.QObject | None = None, *, backgroundBrush: PySide6.QtGui.QBrush | None = None, foregroundBrush: PySide6.QtGui.QBrush | None = None, itemIndexMethod: PySide6.QtWidgets.QGraphicsScene.ItemIndexMethod | None = None, sceneRect: PySide6.QtCore.QRectF | None = None, bspTreeDepth: int | None = None, palette: PySide6.QtGui.QPalette | None = None, font: PySide6.QtGui.QFont | None = None, stickyFocus: bool | None = None, minimumRenderSize: float | None = None, focusOnTouch: bool | None = None) None
- __init__(self, x: float, y: float, width: float, height: float, /, parent: PySide6.QtCore.QObject | None = None, *, backgroundBrush: PySide6.QtGui.QBrush | None = None, foregroundBrush: PySide6.QtGui.QBrush | None = None, itemIndexMethod: PySide6.QtWidgets.QGraphicsScene.ItemIndexMethod | None = None, sceneRect: PySide6.QtCore.QRectF | None = None, bspTreeDepth: int | None = None, palette: PySide6.QtGui.QPalette | None = None, font: PySide6.QtGui.QFont | None = None, stickyFocus: bool | None = None, minimumRenderSize: float | None = None, focusOnTouch: bool | None = None) None
Initialize self. See help(type(self)) for accurate signature.
- addConnection(nodeFrom, portFrom, nodeTo, portTo)[source]
Add a connection to the graph
- Parameters:
nodeFrom – the start node’s name
portFrom – the start node’s port
nodeTo – the end node’s name
portTo – the end node’s port
- Returns:
- addInPort(node, name)[source]
add an input port to a node
- Parameters:
node – the node name
name – the port name
- Returns:
- addOutPort(node, name)[source]
Adds an output port to a node
- Parameters:
node – the node name
name – the port name
- Returns:
- connectionAddRequest
- static getData(item, role)[source]
returns render-relevant information about the specified item can be overriden in concrete editor instances
- Parameters:
item – an instance of BaseGraphScene.NodeItem, BaseGraphScene.PortItem or BaseGraphScene.ConnectionItem
role – one of STYLE_ROLE_SIZE, STYLE_ROLE_PEN, STYLE_ROLE_BRUSH, STYLE_ROLE_RRRADIUS, STYLE_ROLE_VSPACING, STYLE_ROLE_HSPACING
- Returns:
the expected item related to the role
- graphItemAt(scenePos)[source]
Returns the graph item at the specified scene position
- Parameters:
scenePos – a QPoint instance
- Returns:
a NodeItem, PortItem or ConnectionItem instance
- mouseMoveEvent(event)[source]
Override from QGraphicsScene (used for dragging connections)
- Parameters:
event – the QT event
- Returns:
- mousePressEvent(event)[source]
Override from QGraphicsScene (used for dragging connections)
- Parameters:
event – the QT event
- Returns:
- mouseReleaseEvent(event)[source]
Override from QGraphicsScene (used for dragging connections)
- Parameters:
event – the QT event
- Returns:
- removeConnection(nodeFrom, portFrom, nodeTo, portTo)[source]
Removes a connection from the graph
- Parameters:
nodeFrom – the start node’s name
portFrom – the start node’s port
nodeTo – the end node’s name
portTo – the end node’s port
- Returns:
- removeInPort(node, name)[source]
Remove an input port from a node
- Parameters:
node – the node name
name – the port name
- Returns:
- removeOutPort(node, name)[source]
Remove an output port from a node
- Parameters:
node – the node name
name – the port name
- Returns:
- renameInPort(node, oldName, newName)[source]
Rename an input port from a node
- Parameters:
node – the node name
oldName – the old port name
newName – the new port name
- Returns:
- renameNode(oldName, newName)[source]
Rename a node in the graph
- Parameters:
oldName – the old name
newName – the new name
- Returns:
- renameOutPort(node, oldName, newName)[source]
Rename an output port from a node
- Parameters:
node – the node name
oldName – the old port name
newName – the new port name
- Returns:
- staticMetaObject = PySide6.QtCore.QMetaObject("BaseGraphScene" inherits "QGraphicsScene": Methods: #21 type=Signal, signature=connectionAddRequest(QString,QString,QString,QString), parameters=QString, QString, QString, QString )
- class nexxT.services.gui.GraphEditor.GraphScene(graph, parent)[source]
Bases:
BaseGraphSceneConcrete class interacting with a BaseGraph or FilterGraph instance
- __init__(self, sceneRect: PySide6.QtCore.QRectF, /, parent: PySide6.QtCore.QObject | None = None, *, backgroundBrush: PySide6.QtGui.QBrush | None = None, foregroundBrush: PySide6.QtGui.QBrush | None = None, itemIndexMethod: PySide6.QtWidgets.QGraphicsScene.ItemIndexMethod | None = None, bspTreeDepth: int | None = None, palette: PySide6.QtGui.QPalette | None = None, font: PySide6.QtGui.QFont | None = None, stickyFocus: bool | None = None, minimumRenderSize: float | None = None, focusOnTouch: bool | None = None) None[source]
- __init__(self, /, parent: PySide6.QtCore.QObject | None = None, *, backgroundBrush: PySide6.QtGui.QBrush | None = None, foregroundBrush: PySide6.QtGui.QBrush | None = None, itemIndexMethod: PySide6.QtWidgets.QGraphicsScene.ItemIndexMethod | None = None, sceneRect: PySide6.QtCore.QRectF | None = None, bspTreeDepth: int | None = None, palette: PySide6.QtGui.QPalette | None = None, font: PySide6.QtGui.QFont | None = None, stickyFocus: bool | None = None, minimumRenderSize: float | None = None, focusOnTouch: bool | None = None) None
- __init__(self, x: float, y: float, width: float, height: float, /, parent: PySide6.QtCore.QObject | None = None, *, backgroundBrush: PySide6.QtGui.QBrush | None = None, foregroundBrush: PySide6.QtGui.QBrush | None = None, itemIndexMethod: PySide6.QtWidgets.QGraphicsScene.ItemIndexMethod | None = None, sceneRect: PySide6.QtCore.QRectF | None = None, bspTreeDepth: int | None = None, palette: PySide6.QtGui.QPalette | None = None, font: PySide6.QtGui.QFont | None = None, stickyFocus: bool | None = None, minimumRenderSize: float | None = None, focusOnTouch: bool | None = None) None
Initialize self. See help(type(self)) for accurate signature.
- addFilterFromEntryPoint()[source]
Add a filter from its corresponding entry point (the entry point is deduced from the sender action’s data()).
- Returns:
- getData(item, role)[source]
returns render-relevant information about the specified item can be overriden in concrete editor instances
- Parameters:
item – an instance of BaseGraphScene.NodeItem, BaseGraphScene.PortItem or BaseGraphScene.ConnectionItem
role – one of STYLE_ROLE_SIZE, STYLE_ROLE_PEN, STYLE_ROLE_BRUSH, STYLE_ROLE_RRRADIUS, STYLE_ROLE_VSPACING, STYLE_ROLE_HSPACING
- Returns:
the expected item related to the role
- onAddComposite()[source]
Called when the user wants to add a new composite filter to this graph.
- Returns:
- onAddFilterFromFile()[source]
Called when the user wants to add a new filter from a file (FilterGraph variant). Opens a dialog to select the file.
- Returns:
- onAddFilterFromMod()[source]
Called when the user wants to add a new filter from a python module.
- Returns:
- onSuggestDynamicPorts()[source]
Called when the user wants to add dynamic ports based on the filter’s suggestions.
- Returns:
- staticMetaObject = PySide6.QtCore.QMetaObject("GraphScene" inherits "BaseGraphScene": )
- class nexxT.services.gui.GraphEditor.MyGraphicsPathItem(*args, **kw)[source]
Bases:
QGraphicsPathItem,QObjectLittle subclass for receiving hover events and scene position changes outside the items
- __init__(self, path: PySide6.QtGui.QPainterPath, /, parent: PySide6.QtWidgets.QGraphicsItem | None = None) None[source]
- __init__(self, /, parent: PySide6.QtWidgets.QGraphicsItem | None = None) None
Initialize self. See help(type(self)) for accurate signature.
- hoverEnter
- hoverLeave
- itemChange(change, value)[source]
in case of scene position changes, emit the corresponding signal
- Parameters:
change – what has changed
value – the new value
- Returns:
- scenePosChanged
- staticMetaObject = PySide6.QtCore.QMetaObject("MyGraphicsPathItem" inherits "QObject": Methods: #4 type=Signal, signature=hoverEnter() #5 type=Signal, signature=hoverLeave() #6 type=Signal, signature=scenePosChanged(QPointF), parameters=QPointF )
- class nexxT.services.gui.GraphEditor.MySimpleTextItem(*args, **kw)[source]
Bases:
QGraphicsSimpleTextItemQGraphicsSimpleTextItem with a background brush
- __init__(self, text: str, /, parent: PySide6.QtWidgets.QGraphicsItem | None = None) None[source]
- __init__(self, /, parent: PySide6.QtWidgets.QGraphicsItem | None = None) None
Initialize self. See help(type(self)) for accurate signature.
- class nexxT.services.gui.GraphEditor.PortSelectorDialog(parent, inputPorts, outputPorts, graph, nodeName)[source]
Bases:
QDialogDialog for selecting the ports which shall be created.
- __init__(parent, inputPorts, outputPorts, graph, nodeName)[source]
Constructor
- Parameters:
parent – this dialog’s parent widget
inputPorts – the list of input port names
outputPorts – the list of output port names
graph – the corresponding BaseGraph instance
nodeName – the name of the corresponding node
- static getSelectedPorts(parent, inputPorts, outputPorts, graph, nodeName)[source]
Convenience function for executing the dialog.
- Parameters:
parent – this dialog’s parent widget
inputPorts – the list of input port names
outputPorts – the list of output port names
graph – the corresponding BaseGraph instance
nodeName – the name of the corresponding node
- staticMetaObject = PySide6.QtCore.QMetaObject("PortSelectorDialog" inherits "QDialog": )