[ui] homogenize PySide imports

This commit is contained in:
Yann Lanthony 2017-10-13 12:12:00 +02:00
parent d4509ec20e
commit 7ddf86e6bc

View file

@ -1,32 +1,32 @@
from PySide2 import QtCore
from PySide2.QtCore import QObject, Slot, Property, Signal
from meshroom.core import graph
from meshroom.ui import commands
class Reconstruction(QtCore.QObject):
class Reconstruction(QObject):
def __init__(self, parent=None):
super(Reconstruction, self).__init__(parent)
self._graph = graph.Graph("")
self._undoStack = commands.UndoStack(self)
@QtCore.Slot(str)
@Slot(str)
def addNode(self, nodeType):
self._undoStack.tryAndPush(commands.AddNodeCommand(self._graph, nodeType))
@QtCore.Slot(graph.Node)
@Slot(graph.Node)
def removeNode(self, node):
self._undoStack.tryAndPush(commands.RemoveNodeCommand(self._graph, node))
@QtCore.Slot(graph.Attribute, "QVariant")
@Slot(graph.Attribute, "QVariant")
def setAttribute(self, attribute, value):
self._undoStack.tryAndPush(commands.SetAttributeCommand(self._graph, attribute, value))
@QtCore.Slot(str)
@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)
undoStack = Property(QObject, lambda self: self._undoStack, constant=True)
graph = Property(graph.Graph, lambda self: self._graph, constant=True)
nodes = Property(QObject, lambda self: self._graph.nodes, constant=True)