Working on undo redo

This commit is contained in:
Kodjo Sossouvi
2025-07-25 17:22:18 +02:00
parent fb82365980
commit 72f5f30da6
6 changed files with 86 additions and 34 deletions

View File

@@ -1,6 +1,23 @@
from components.BaseCommandManager import BaseCommandManager
from components.undo_redo.components.UndoRedo import CommandHistory
from components.workflows.constants import Routes, ROUTE_ROOT
class AddConnectorCommand(CommandHistory):
def __init__(self, owner, connector):
super().__init__("Add connector", "Add connector", owner)
self.connector = connector
def undo(self):
del self.owner.get_state().components[self.connector.id]
self.owner.get_db().save_state(self.owner.get_key(), self.owner.get_state()) # update db
return self.owner.refresh_designer(True)
def redo(self, oob=True):
self.owner.get_state().components[self.connector.id] = self.connector
self.owner.get_db().save_state(self.owner.get_key(), self.owner.get_state()) # update db
return self.owner.refresh_designer(oob)
class WorkflowsCommandManager(BaseCommandManager):
def __init__(self, owner):