2012-02-03 20:49:16 +01:00
|
|
|
from django.db import models
|
|
|
|
|
2012-02-15 12:04:11 +01:00
|
|
|
from system import config
|
2012-02-03 23:12:28 +01:00
|
|
|
|
2012-02-06 22:22:16 +01:00
|
|
|
SLIDE = {}
|
2012-02-03 23:12:28 +01:00
|
|
|
|
2012-02-06 22:22:16 +01:00
|
|
|
class Slide(object):
|
2012-02-03 23:12:28 +01:00
|
|
|
|
2012-02-06 22:08:08 +01:00
|
|
|
def slide(self):
|
2012-02-03 23:12:28 +01:00
|
|
|
"""
|
2012-02-06 22:08:08 +01:00
|
|
|
Return a map with all Data for a Slide
|
2012-02-03 23:12:28 +01:00
|
|
|
"""
|
|
|
|
return {
|
2012-02-06 22:22:16 +01:00
|
|
|
'slide': self,
|
2012-02-03 23:12:28 +01:00
|
|
|
'title': 'dummy-title',
|
2012-02-15 12:36:50 +01:00
|
|
|
'template': 'projector/default.html',
|
2012-02-03 23:12:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@property
|
2012-02-06 22:22:16 +01:00
|
|
|
def sid(self):
|
2012-02-03 23:12:28 +01:00
|
|
|
"""
|
2012-02-06 22:22:16 +01:00
|
|
|
Return the sid from this Slide
|
2012-02-03 23:12:28 +01:00
|
|
|
"""
|
2012-02-06 22:22:16 +01:00
|
|
|
for key, value in SLIDE.iteritems():
|
2012-02-03 23:12:28 +01:00
|
|
|
if type(self) == value:
|
|
|
|
return "%s %d" % (key, self.id)
|
|
|
|
return None
|
|
|
|
|
|
|
|
@property
|
|
|
|
def active(self):
|
|
|
|
"""
|
2012-02-06 22:22:16 +01:00
|
|
|
Return True, if the the slide is the active one.
|
2012-02-03 23:12:28 +01:00
|
|
|
"""
|
2012-02-06 22:22:16 +01:00
|
|
|
from projector.api import get_active_slide
|
|
|
|
return True if get_active_slide(only_sid=True) == self.sid else False
|
2012-02-03 23:12:28 +01:00
|
|
|
|
|
|
|
def set_active(self):
|
|
|
|
"""
|
|
|
|
Appoint this item as the active one.
|
|
|
|
"""
|
2012-02-15 12:04:11 +01:00
|
|
|
config["presentation"] = "%s %d" % (self.prefix, self.id)
|