Single omc session

This commit is contained in:
Joppe Blondel
2026-08-19 11:19:36 +02:00
parent 16d9cc7651
commit 6ebeb2607b
8 changed files with 113 additions and 18 deletions
@@ -13,6 +13,7 @@ from bedit_gui.services.application_logging import get_logger
from bedit_gui.simulation_models import CompiledModel, SimulationRoot
from bedit_gui.views.dialogs.simulation_settings_dialog import SimulationSettingsDialog
from bedit_gui.views.simulation_window import SimulationWindow
from bedit_simulation import OpenModelicaRunner
logger = get_logger(__name__)
@@ -20,9 +21,10 @@ logger = get_logger(__name__)
class SimulationFileController(QObject):
runtime_changed = Signal()
def __init__(self, window: SimulationWindow) -> None:
def __init__(self, window: SimulationWindow, runner: OpenModelicaRunner | None = None) -> None:
super().__init__(window)
self.window = window
self.runner = runner
self.root: SimulationRoot | None = None
self.compiled_model: CompiledModel | None = None
self.path: Path | None = None
@@ -147,14 +149,14 @@ class SimulationFileController(QObject):
def _compile_with_wait_cursor(self, path: Path, *, component: str | None, simulation: str | None) -> tuple[SimulationRoot, CompiledModel]:
QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor)
try:
return load_and_compile_bedit(path, component_selector=component, simulation_selector=simulation)
return load_and_compile_bedit(path, component_selector=component, simulation_selector=simulation, runner=self.runner)
finally:
QApplication.restoreOverrideCursor()
def _recompile_with_wait_cursor(self, root: SimulationRoot) -> CompiledModel:
QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor)
try:
return compile_simulation_root(root)
return compile_simulation_root(root, runner=self.runner)
finally:
QApplication.restoreOverrideCursor()