~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/base/overlays.py

  • Committer: Matt Giuca
  • Date: 2009-02-24 02:02:03 UTC
  • mto: This revision was merged to the branch mainline in revision 1119.
  • Revision ID: matt.giuca@gmail.com-20090224020203-aqdcjnsj6y7wl32o
Added a new look to the IVLE header bar. Mmmm... Web 2.0.
Added top-level directory image-source, containing SVG and script files for
    generating the images.
ivle/webapp/coremedia/images: Added 'chrome' directory containing the rendered
    images.
Modified ivle/webapp/base/ivle-headings.html and
    ivle/webapp/coremedia/ivle.css to support the new images.
    Note that the H1 and H2 at the top of the page are no longer displayed
    (and their custom styles have been removed). There is a heading image
    instead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
import genshi
24
24
 
25
 
from ivle.webapp.base.xhtml import GenshiLoaderMixin
26
 
 
27
 
 
28
25
class BaseOverlay(object):
29
26
    """Abstract base class for all overlays."""
30
27
    plugin_scripts = {}
35
32
 
36
33
    def render(self, req):
37
34
        raise NotImplementedError()
38
 
 
39
 
 
40
 
class XHTMLOverlay(GenshiLoaderMixin, BaseOverlay):
 
35
        
 
36
class XHTMLOverlay(BaseOverlay):
41
37
    """Abstract base class for XHTML overlays.
42
 
 
 
38
    
43
39
    An overlay which provides a base class for overlays which need to return 
44
40
    XHTML. It is expected that apps which use this overlay will be written using
45
41
    Genshi templates.
46
42
    """
47
 
 
 
43
    
48
44
    template = 'template.html'
49
 
 
 
45
    
50
46
    def render(self, req):
51
47
        """Renders an XML stream from the template for this overlay."""
52
48
        ctx = genshi.template.Context()
53
49
        # This is where the sub-class is actually called
54
50
        self.populate(req, ctx)
55
 
 
 
51
        
56
52
        # Renders out the template.
57
53
        template_path = os.path.join(os.path.dirname(
58
54
                        inspect.getmodule(self).__file__), self.template)
59
 
        tmpl = self._loader.load(template_path)
 
55
        loader = genshi.template.TemplateLoader(".", auto_reload=True)
 
56
        tmpl = loader.load(template_path)
60
57
        return tmpl.generate(ctx)
61
 
 
 
58
        
62
59
    def populate(self, req, ctx):
63
60
        raise NotImplementedError()