2012-04-25 22:29:19 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
openslides.projector.models
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Models for the projector app.
|
|
|
|
|
|
|
|
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
|
|
|
|
:license: GNU GPL, see LICENSE for more details.
|
|
|
|
"""
|
2012-04-18 18:55:33 +02:00
|
|
|
|
2012-02-03 20:49:16 +01:00
|
|
|
from django.db import models
|
2012-04-16 16:35:30 +02:00
|
|
|
from django.dispatch import receiver
|
|
|
|
|
|
|
|
from openslides.config.signals import default_config_value
|
2012-03-12 18:22:18 +01:00
|
|
|
|
|
|
|
from api import register_slidemodel
|
|
|
|
from projector import SlideMixin
|
2012-02-03 20:49:16 +01:00
|
|
|
|
2012-04-14 12:52:56 +02:00
|
|
|
from config.models import config
|
2012-04-14 14:31:09 +02:00
|
|
|
from utils.translation_ext import ugettext as _
|
2012-03-12 18:22:18 +01:00
|
|
|
|
2012-04-14 12:52:56 +02:00
|
|
|
|
2012-03-12 18:22:18 +01:00
|
|
|
class ProjectorSlide(models.Model, SlideMixin):
|
|
|
|
prefix = 'ProjectorSlide'
|
|
|
|
|
|
|
|
title = models.CharField(max_length=100, verbose_name=_("Title"))
|
|
|
|
text = models.TextField(null=True, blank=True, verbose_name=_("Text"))
|
2012-04-23 22:07:52 +02:00
|
|
|
#weight = models.IntegerField(default=0, verbose_name=_("Weight"))
|
2012-03-12 18:22:18 +01:00
|
|
|
|
2012-04-14 11:37:12 +02:00
|
|
|
def slide(self):
|
|
|
|
return {
|
|
|
|
'slide': self,
|
|
|
|
'title': self.title,
|
|
|
|
'template': 'projector/ProjectorSlide.html',
|
|
|
|
}
|
|
|
|
|
2012-03-12 18:22:18 +01:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.title
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
permissions = (
|
2012-04-14 09:28:28 +02:00
|
|
|
('can_manage_projector', _("Can manage the projector", fixstr=True)),
|
|
|
|
('can_see_projector', _("Can see projector", fixstr=True)),
|
2012-03-12 18:22:18 +01:00
|
|
|
)
|
|
|
|
|
2012-04-14 09:47:34 +02:00
|
|
|
|
2012-04-16 16:35:30 +02:00
|
|
|
class ProjectorOverlay(models.Model):
|
2012-04-14 09:47:34 +02:00
|
|
|
active = models.BooleanField(verbose_name=_('Active'))
|
|
|
|
def_name = models.CharField(max_length=64)
|
2012-04-16 16:35:30 +02:00
|
|
|
sid = models.CharField(max_length=64, null=True, blank=True)
|
2012-04-14 09:47:34 +02:00
|
|
|
|
|
|
|
def __unicode__(self):
|
2012-04-16 16:35:30 +02:00
|
|
|
if self.sid:
|
|
|
|
return "%s on %s" % (self.def_name, self.sid)
|
2012-04-14 09:47:34 +02:00
|
|
|
return self.def_name
|
|
|
|
|
|
|
|
|
2012-04-23 22:17:45 +02:00
|
|
|
register_slidemodel(ProjectorSlide, model_name='customslide')
|
2012-03-18 17:11:58 +01:00
|
|
|
|
2012-04-16 16:35:30 +02:00
|
|
|
|
2012-04-18 18:35:02 +02:00
|
|
|
@receiver(default_config_value, dispatch_uid="projector_default_config")
|
2012-04-16 16:35:30 +02:00
|
|
|
def default_config(sender, key, **kwargs):
|
|
|
|
return {
|
|
|
|
'projector_message': '',
|
2012-04-18 18:55:33 +02:00
|
|
|
'countdown_time': 60,
|
2012-04-25 17:17:24 +02:00
|
|
|
'countdown_start_stamp': 0,
|
|
|
|
'countdown_pause_stamp': 0,
|
|
|
|
'countdown_state': 'inactive',
|
2012-04-18 18:55:33 +02:00
|
|
|
'bigger': 100,
|
|
|
|
'up': 0,
|
2012-04-16 16:35:30 +02:00
|
|
|
}.get(key)
|