Network: Fix edge table set node.

mesh
Pierre-Antoine Rouby 2023-06-09 09:46:50 +02:00
parent ded95ef097
commit ddf5941288
2 changed files with 18 additions and 1 deletions

View File

@ -143,7 +143,8 @@ class GraphTableModel(QAbstractTableModel):
self.headers[index.column()] == "node2"):
node = self.graph.node(value)
self._undo.push(
SetCommand(
SetNodeCommand(
self.graph,
self.rows[index.row()],
self.headers[index.column()],
node

View File

@ -94,6 +94,22 @@ class SetCommand(QUndoCommand):
def redo(self):
self._el[self._column] = self._new
class SetNodeCommand(QUndoCommand):
def __init__(self, graph, element, column, new_value):
QUndoCommand.__init__(self)
self._el = element
self._column = column
self._old = graph.node(self._el[self._column])
self._new = new_value
def undo(self):
self._el[self._column] = self._old
def redo(self):
self._el[self._column] = self._new
class EnableEdgeCommand(QUndoCommand):
def __init__(self, edge, enable):
QUndoCommand.__init__(self)