Пример #1
0
def define_layout_and_callbacks(
    scenario=None,
    agent_ref=None,
    agent_study=None,
    user_timestep=None,
    window=None,
    page=None,
    config=None,
    activate_simulation=False,
):
    ##create layout
    layout(
        app,
        scenario,
        agent_ref,
        agent_study,
        user_timestep,
        window,
        page,
        activate_simulation,
    )

    ##create callbaks
    register_callbacks_main(app)
    register_callbacks_episodes(app)
    register_callbacks_overview(app)
    register_callbacks_macro(app)
    register_callbacks_micro(app)
    if activate_simulation:
        assistant = Assist()
        register_callbacks_simulation(app, assistant)
        assistant.register_callbacks(app)
    if config is not None:
        for key, value in config.items():
            app.server.config[key] = value
Пример #2
0
from grid2viz.src.overview.overview_clbk import (
    register_callbacks_overview, )  # as overview_clbk
from grid2viz.src.macro.macro_clbk import register_callbacks_macro  # as macro_clbk
from grid2viz.src.micro.micro_clbk import register_callbacks_micro  # as micro_clbk
"""
End Warning
"""

app.config.suppress_callback_exceptions = True

app.title = "Grid2Viz"
app.server.secret_key = "Grid2Viz"

##create layout
layout(app)

##create callbaks
register_callbacks_main(app)
register_callbacks_episodes(app)
register_callbacks_overview(app)
register_callbacks_macro(app)
register_callbacks_micro(app)


def app_run(port=8050, debug=False):
    app.run_server(port=port, debug=debug)


if __name__ == "__main__":
    app_run()