예제 #1
0
from django.utils.feedgenerator import rfc3339_date

from panoptes.analysis.panels.events.models import LocationCalendar
from panoptes.analysis.panels.events.rrule import RepeatRule
from panoptes.core.utils.registry import create_registry

from gdata.calendar.client import CalendarClient, CalendarEventQuery

import datetime

EventRegistry = create_registry('slug')

class BaseEvent(object):
	"""A single Google Calendar event."""

	def __init__(self, location, title, repeat_rule):
		"""Create a new representation of a Google Calendar event.

		Arguments:
		title -- a string with the event's title
		repeat_rule -- a Recurrence object containing a possible repeat rule

		"""

		self.title = title
		self.location = location
		self.repeat_rule = RepeatRule(repeat_rule, location)

	def verbose_start(self):
		"""A verbose, readable rendition of the event's start."""
예제 #2
0
from django import forms

from panoptes.core.utils.registry import create_registry

ChartRegistry = create_registry('slug')

class BaseChart(object):
	"""Abstract base class for a chart.

	A child chart must define a string value for the `slug` attribute, and can
	optionally define values for the `js` and `css` attributes, which should be
	structured in the same way as the attributes of a Django Media class.
	"""

	__metaclass__ = ChartRegistry

	slug = None
	template = None

	def __init__(self, sessions):
		"""
		Create a chart for the data contained in the FilteredSessions instance
		`sessions`.
		"""
		self.sessions = sessions

	def provide_render_args(self):
		"""Allow a chart to return render arguments.."""
		return {}
예제 #3
0
from django.utils.feedgenerator import rfc3339_date

from panoptes.analysis.panels.events.models import LocationCalendar
from panoptes.analysis.panels.events.rrule import RepeatRule
from panoptes.core.utils.registry import create_registry

from gdata.calendar.client import CalendarClient, CalendarEventQuery

import datetime

EventRegistry = create_registry('slug')


class BaseEvent(object):
    """A single Google Calendar event."""
    def __init__(self, location, title, repeat_rule):
        """Create a new representation of a Google Calendar event.

		Arguments:
		title -- a string with the event's title
		repeat_rule -- a Recurrence object containing a possible repeat rule

		"""

        self.title = title
        self.location = location
        self.repeat_rule = RepeatRule(repeat_rule, location)

    def verbose_start(self):
        """A verbose, readable rendition of the event's start."""
        raise NotImplementedError
예제 #4
0
from django import forms

from panoptes.core.utils.registry import create_registry

ChartRegistry = create_registry('slug')


class BaseChart(object):
    """Abstract base class for a chart.

	A child chart must define a string value for the `slug` attribute, and can
	optionally define values for the `js` and `css` attributes, which should be
	structured in the same way as the attributes of a Django Media class.
	"""

    __metaclass__ = ChartRegistry

    slug = None
    template = None

    def __init__(self, sessions):
        """
		Create a chart for the data contained in the FilteredSessions instance
		`sessions`.
		"""
        self.sessions = sessions

    def provide_render_args(self):
        """Allow a chart to return render arguments.."""
        return {}
예제 #5
0
from django import forms
from django.template.loader import render_to_string

from panoptes.core.utils.registry import create_registry

PanelRegistry = create_registry('slug')

def create_panel(index, slug, sessions, options):
	"""Return an instance of the panel defined by the slug.

	Arguments:
	index -- the 0-indexed order of the panel
	slug -- a string that should match the `slug` attribute of a panel
	sessions -- a FilteredSessions instance
	options -- a dict that will be used as kwargs for the panel's `init` call

	Returns: an instance of a panel

	"""
	Panel = PanelRegistry.get_registry_item(slug)
	return Panel(index, sessions, **options)

class BasePanel(object):
	"""An abstract base for an analysis panel."""

	__metaclass__ = PanelRegistry

	slug = None
	template = None
예제 #6
0
from django import forms

from panoptes.analysis.axes.x.workstations import Axis as Workstations
from panoptes.analysis.exceptions import InvalidAxisPair
from panoptes.core.models import LayoutRow
from panoptes.core.utils.registry import create_registry

MapRegistry = create_registry('slug')

class BaseMap(object):
	"""An abstract base class for a location map."""

	__metaclass__ = MapRegistry

	slug = None
	template = None

	def __init__(self, sessions):
		"""Create the location map.

		Arguments:
		sessions -- a FilteredSessions instance

		"""
		self.location = sessions.location
		self.sessions = sessions

	def provide_render_args(self):
		"""Provide the location and special row object for rendering."""