Connect actions of top-level sim components
This commit is contained in:
34
src/primaite/simulator/sim_container.py
Normal file
34
src/primaite/simulator/sim_container.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from primaite.simulator.core import Action, ActionManager, AllowAllValidator, SimComponent
|
||||
from primaite.simulator.domain.controller import DomainController
|
||||
|
||||
|
||||
class __TempNetwork:
|
||||
"""TODO."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class SimulationContainer(SimComponent):
|
||||
"""TODO."""
|
||||
|
||||
network: __TempNetwork
|
||||
domain: DomainController
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.action_manager = ActionManager()
|
||||
# pass through network actions to the network objects
|
||||
self.action_manager.add_action(
|
||||
"network",
|
||||
Action(
|
||||
func=lambda request, context: self.network.apply_action(request, context), validator=AllowAllValidator()
|
||||
),
|
||||
)
|
||||
# pass through domain actions to the domain object
|
||||
self.action_manager.add_action(
|
||||
"domain",
|
||||
Action(
|
||||
func=lambda request, context: self.domain.apply_action(request, context), validator=AllowAllValidator()
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user