Launching of simulation application

This commit is contained in:
Joppe Blondel
2026-07-31 12:24:52 +02:00
parent 66737e323b
commit 89ac2d8ff8
17 changed files with 555 additions and 36 deletions
+5 -1
View File
@@ -16,7 +16,7 @@ from bedit_gui.commands.rename_component_command import RenameComponentCommand
from bedit_gui.commands.rename_document_command import RenameDocumentCommand
from bedit_gui.commands.simulation_database_command import ChangeSimulationDatabaseCommand
from bedit_gui.commands.component_command import AddEmptyEquationComponent, AddEmptyGraphComponent, DeleteComponent, PasteComponents
from bedit_gui.models import Icon, IconDatabase, SimulationDatabase
from bedit_gui.models import Icon, IconDatabase, Simulation, SimulationDatabase
from bedit_gui.services import document_files
@@ -131,6 +131,10 @@ class Document(QObject):
def simulation_database(self) -> SimulationDatabase:
return self.stored_simulation_database() or SimulationDatabase()
def active_simulation(self) -> Simulation | None:
database = self.simulation_database()
return database.simulations.get(database.active_simulation) if database.active_simulation is not None else None
def change_simulation_database(self, database: SimulationDatabase) -> None:
if database != self.stored_simulation_database():
self.undo_stack.push(ChangeSimulationDatabaseCommand(self, database))