Esempio n. 1
0
async def notify_project_closed(project_id: str) -> None:

    proj_list = ShowMainScreen.Data.WhatEnum.ProjectsList

    await notif.broadcast_event(ProjectClosed())
    glob.MAIN_SCREEN = ShowMainScreen.Data(proj_list)
    await notif.broadcast_event(ShowMainScreen(ShowMainScreen.Data(proj_list, project_id)))
Esempio n. 2
0
async def notify_scene_closed(scene_id: str) -> None:

    await notif.broadcast_event(SceneClosed())
    glob.MAIN_SCREEN = ShowMainScreen.Data(
        ShowMainScreen.Data.WhatEnum.ScenesList)
    await notif.broadcast_event(
        ShowMainScreen(data=ShowMainScreen.Data(
            ShowMainScreen.Data.WhatEnum.ScenesList, scene_id)))
Esempio n. 3
0
async def notify_scene_closed(scene_id: str) -> None:

    assert get_scene_state().data.state == SceneState.Data.StateEnum.Stopped

    await notif.broadcast_event(SceneClosed())
    glob.MAIN_SCREEN = ShowMainScreen.Data(ShowMainScreen.Data.WhatEnum.ScenesList)
    await notif.broadcast_event(
        ShowMainScreen(data=ShowMainScreen.Data(ShowMainScreen.Data.WhatEnum.ScenesList, scene_id))
    )
Esempio n. 4
0
async def notify_project_closed(project_id: str,
                                show_mainscreen_after_that: bool = True
                                ) -> None:

    proj_list = ShowMainScreen.Data.WhatEnum.ProjectsList

    await notif.broadcast_event(ProjectClosed())
    if show_mainscreen_after_that:  # mainscreen is not shown when running a temporary package
        glob.MAIN_SCREEN = ShowMainScreen.Data(proj_list)
        await notif.broadcast_event(
            ShowMainScreen(ShowMainScreen.Data(proj_list, project_id)))
Esempio n. 5
0
from arcor2.cached import UpdateableCachedProject, UpdateableCachedScene
from arcor2.data import events
from arcor2.logging import get_aiologger
from arcor2.object_types.abstract import Generic
from arcor2_arserver.object_types.data import ObjectTypeDict
from arcor2_arserver_data.events.common import ShowMainScreen

logger = get_aiologger("ARServer")
VERBOSE: bool = False

PORT: int = int(os.getenv("ARCOR2_SERVER_PORT", 6789))

SCENE: Optional[UpdateableCachedScene] = None
PROJECT: Optional[UpdateableCachedProject] = None

MAIN_SCREEN: Optional[ShowMainScreen.Data] = ShowMainScreen.Data(
    ShowMainScreen.Data.WhatEnum.ScenesList)

INTERFACES: Set[WsClient] = set()

OBJECT_TYPES: ObjectTypeDict = {}

SCENE_OBJECT_INSTANCES: Dict[str, Generic] = {}

RUNNING_ACTION: Optional[
    str] = None  # ID of an action that is being executed during project editing
RUNNING_ACTION_PARAMS: Optional[List[Any]] = None

PACKAGE_STATE = events.PackageState.Data()
PACKAGE_INFO: Optional[events.PackageInfo.Data] = None

# there might be some long-running action being executed when ui connects, so let's them know