mirror of https://gitlab.com/pamhyr/pamhyr2
Network: Fix edge table set node.
parent
ded95ef097
commit
ddf5941288
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue