1. James Tocknell
  2. shinypress3


James Tocknell  committed 2a62564 Merge


  • Participants
  • Parent commits 51ab306, a4f9c62
  • Branches default

Comments (0)

Files changed (2)

File docs/fake/shinypress/theme.py

View file
+# -*- coding: utf-8 -*-
 class Theme(object):
     Describes how the handlers should render their content.
         Load a theme specification from a JSON file.
         :param f: file object
+        :rtype: Theme
     def get_block_size(self, template, block):
         Get the size of the given block in the named template.
         :param template: name of the template
+        :type template: unicode
         :param block: name of the block
+        :type block: unicode
         :rtype: (width, height) tuple
+        :raise KeyError: if the template or block don't exist
+    def do_something_with_fonts(self, template, kind):
+        """
+        Gives you details for fonts, or gives you colours, or something?
+        Or maybe you just get some arbitrary "attribute" things?
+        :param template: name of the template
+        :type template: unicode
+        :param kind: the kind of text you're rendering ("title", "body", etc.)
+        :type kind: unicode
+        :rtype: dictionary of things?
+        """
+        pass
+    def render(self, ctx, template, blocks):
+        """
+        Render the specified template onto the given Cairo context. The
+        ``blocks`` dictionary maps block names to a function which will draw
+        that block. The function will be given a single argument, the Cairo
+        context, and should draw in the area (0, 0) → (width, height)
+        :param ctx: cairo context to render on
+        :param template: name of the template to render
+        :type template: unicode
+        :param blocks: functions for drawing the blocks in the template
+        :type blocks: dict of callable objects
+        :raise KeyError: if the template or block don't exist
+        """
+        pass

File docs/layout.rst

View file
     for handler in handlers:
         slide_layouts = handler.layout(theme)
         for template, blocks in slide_layouts:
-            theme.render(template, blocks)
+            theme.render(ctx, template, blocks)