Try change set to record result
This commit is contained in:
@@ -2,6 +2,8 @@ from .project import have_project, create_project, delete_project
|
||||
from .project import is_project_open, open_project, close_project
|
||||
from .project import copy_project
|
||||
|
||||
from .change_set import ChangeSet
|
||||
|
||||
from .operation import execute_undo as undo
|
||||
from .operation import execute_redo as redo
|
||||
from .operation import have_snapshot, take_snapshot, pick_snapshot
|
||||
|
||||
14
api/change_set.py
Normal file
14
api/change_set.py
Normal file
@@ -0,0 +1,14 @@
|
||||
class ChangeSet:
|
||||
def __init__(self) -> None:
|
||||
self.added : list[dict[str, str]] = {}
|
||||
self.deleted : list[dict[str, str]] = {}
|
||||
self.updated : list[dict[str, str]] = {}
|
||||
|
||||
def add(self, type: str, id: str) -> None:
|
||||
self.added.append({ 'type': type, 'id': id })
|
||||
|
||||
def delete(self, type: str, id: str) -> None:
|
||||
self.deleted.append({ 'type': type, 'id': id })
|
||||
|
||||
def update(self, type: str, id: str, property: str) -> None:
|
||||
self.updated.append({ 'type': type, 'id': id, 'property': property })
|
||||
@@ -1,6 +1,13 @@
|
||||
import api
|
||||
|
||||
|
||||
############################################################
|
||||
# ChangeSet
|
||||
############################################################
|
||||
|
||||
ChangeSet = api.ChangeSet
|
||||
|
||||
|
||||
############################################################
|
||||
# enum
|
||||
############################################################
|
||||
|
||||
Reference in New Issue
Block a user