Peter Ward avatar Peter Ward committed a4f9c62

write the render docs, add a do_something_with_fonts method

Comments (0)

Files changed (2)

docs/fake/shinypress/theme.py

+# -*- 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
         """
         pass
 
+    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
     for handler in handlers:
         slide_layouts = handler.layout(theme)
         for template, blocks in slide_layouts:
-            theme.render(template, blocks)
+            theme.render(ctx, template, blocks)
             surf.show_page()
 
 Handlers
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.