OpenSlides/openslides/agenda/projector.py

55 lines
1.5 KiB
Python
Raw Normal View History

from typing import Generator, Type
from ..core.exceptions import ProjectorException
from ..utils.projector import ProjectorElement
2015-06-24 23:36:36 +02:00
from .models import Item
class ItemListSlide(ProjectorElement):
"""
Slide definitions for Item model.
This is only for item list slides.
Set 'id' to None to get a list slide of all root items. Set 'id' to an
integer to get a list slide of the children of the metioned item.
Additionally set 'tree' to True to get also children of children.
2015-06-24 23:36:36 +02:00
"""
name = 'agenda/item-list'
def check_data(self):
pk = self.config_entry.get('id')
2015-09-08 14:14:11 +02:00
if pk is not None:
# Children slide.
if not Item.objects.filter(pk=pk).exists():
raise ProjectorException('Item does not exist.')
2015-06-24 23:36:36 +02:00
class ListOfSpeakersSlide(ProjectorElement):
2015-06-24 23:36:36 +02:00
"""
Slide definitions for Item model.
This is only for list of speakers slide. You have to set 'id'.
2015-06-24 23:36:36 +02:00
"""
name = 'agenda/list-of-speakers'
2015-06-24 23:36:36 +02:00
def check_data(self):
if not Item.objects.filter(pk=self.config_entry.get('id')).exists():
raise ProjectorException('Item does not exist.')
2015-06-24 23:36:36 +02:00
2016-10-05 18:25:50 +02:00
def update_data(self):
return {'agenda_item_id': self.config_entry.get('id')}
2016-09-12 11:05:34 +02:00
class CurrentListOfSpeakersSlide(ProjectorElement):
2016-09-12 11:05:34 +02:00
"""
Slide for the current list of speakers.
2016-10-05 18:25:50 +02:00
"""
name = 'agenda/current-list-of-speakers'
def get_projector_elements() -> Generator[Type[ProjectorElement], None, None]:
yield ItemListSlide
yield ListOfSpeakersSlide
yield CurrentListOfSpeakersSlide