Meshroom/meshroom/ui/reconstruction.py
Yann Lanthony 48941a5782 [ui] first basic debugging UI + elementary commands
* nodes as a ListView (right click to delete a node)
* editable attributes 
* undo/redo for adding/removing nodes and attribute edition
2017-09-25 20:18:27 +02:00

32 lines
1.1 KiB
Python

from PySide2 import QtCore
from meshroom.processGraph import graph
from meshroom.ui import commands
class Reconstruction(QtCore.QObject):
def __init__(self, parent=None):
super(Reconstruction, self).__init__(parent)
self._graph = graph.Graph("")
self._undoStack = commands.UndoStack(self)
@QtCore.Slot(str)
def addNode(self, nodeType):
self._undoStack.tryAndPush(commands.AddNodeCommand(self._graph, nodeType))
@QtCore.Slot(graph.Node)
def removeNode(self, node):
self._undoStack.tryAndPush(commands.RemoveNodeCommand(self._graph, node))
@QtCore.Slot(graph.Attribute, "QVariant")
def setAttribute(self, attribute, value):
self._undoStack.tryAndPush(commands.SetAttributeCommand(self._graph, attribute, value))
@QtCore.Slot(str)
def load(self, filepath):
self._graph.load(filepath)
undoStack = QtCore.Property(QtCore.QObject, lambda self: self._undoStack, constant=True)
graph = QtCore.Property(QtCore.QObject, lambda self: self._graph, constant=True)
nodes = QtCore.Property(QtCore.QObject, lambda self: self._graph.nodes, constant=True)