Source

vanhoek / vanhoek / backends / backend_base.py

import abc
import cairo

class BackendBase(object):
    __metaclass__ = abc.ABCMeta

    interactor = None

    @abc.abstractproperty
    def surface(self):
        pass

    @abc.abstractmethod
    def draw(self, slide, i):
        if self.interactor is not None: self.interactor.wait(i)
        surface = self.surface
        context = cairo.Context(surface)
        slide.render(context)
        return surface