Simulation settings window
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from copy import deepcopy
|
||||
|
||||
from PySide6.QtGui import QUndoCommand
|
||||
|
||||
from bedit_gui.models import SimulationDatabase
|
||||
|
||||
|
||||
class ChangeSimulationDatabaseCommand(QUndoCommand):
|
||||
def __init__(self, document: object, database: SimulationDatabase) -> None:
|
||||
super().__init__("Edit simulation settings")
|
||||
self.document = document
|
||||
self.old_database = document.stored_simulation_database()
|
||||
self.new_database = deepcopy(database)
|
||||
|
||||
def redo(self) -> None:
|
||||
self.document._set_simulation_database(self.new_database)
|
||||
|
||||
def undo(self) -> None:
|
||||
self.document._set_simulation_database(self.old_database)
|
||||
Reference in New Issue
Block a user