OpenSlides/openslides/core/projector.py

69 lines
1.6 KiB
Python
Raw Normal View History

2018-12-23 11:05:38 +01:00
from typing import Any, Dict
2019-02-14 16:02:18 +01:00
from ..utils.projector import (
ProjectorAllDataProvider,
2019-02-14 16:02:18 +01:00
get_config,
get_model,
2019-02-14 16:02:18 +01:00
register_projector_slide,
)
async def countdown_slide(
all_data_provider: ProjectorAllDataProvider,
element: Dict[str, Any],
projector_id: int,
2019-02-21 14:40:07 +01:00
) -> Dict[str, Any]:
"""
2018-12-23 11:05:38 +01:00
Countdown slide.
2019-01-06 16:22:33 +01:00
2018-12-23 11:05:38 +01:00
Returns the full_data of the countdown element.
element = {
2018-12-23 11:05:38 +01:00
name: 'core/countdown',
id: 5, # Countdown ID
}
"""
countdown = await get_model(all_data_provider, "core/countdown", element.get("id"))
2019-02-14 16:02:18 +01:00
return {
"description": countdown["description"],
"running": countdown["running"],
"countdown_time": countdown["countdown_time"],
"warning_time": await get_config(
all_data_provider, "agenda_countdown_warning_time"
),
2019-02-14 16:02:18 +01:00
}
2018-12-23 11:05:38 +01:00
async def message_slide(
all_data_provider: ProjectorAllDataProvider,
element: Dict[str, Any],
projector_id: int,
2019-02-21 14:40:07 +01:00
) -> Dict[str, Any]:
"""
2018-12-23 11:05:38 +01:00
Message slide.
2019-01-06 16:22:33 +01:00
2018-12-23 11:05:38 +01:00
Returns the full_data of the message element.
element = {
2018-12-23 11:05:38 +01:00
name: 'core/projector-message',
id: 5, # ProjectorMessage ID
}
"""
return await get_model(
all_data_provider, "core/projector-message", element.get("id")
)
async def clock_slide(
all_data_provider: ProjectorAllDataProvider,
element: Dict[str, Any],
projector_id: int,
2019-02-21 14:40:07 +01:00
) -> Dict[str, Any]:
return {}
def register_projector_slides() -> None:
register_projector_slide("core/countdown", countdown_slide)
register_projector_slide("core/projector-message", message_slide)
register_projector_slide("core/clock", clock_slide)