~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 04:44:52 UTC
  • mto: This revision was merged to the branch mainline in revision 1119.
  • Revision ID: matt.giuca@gmail.com-20090224044452-km2gcpvsqsoud0up
image-source/title.svg: Shrunk title to 42px (not 50px). This allows us to
    shrink the whole top bar.
ivle/webapp/coremedia/images/chrome/title.png: Updated from SVG.
ivle/webapp/coremedia/ivle.css: Shrunk header bar to 4em from 5.3em.

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()