Peter Ward avatar Peter Ward committed 0cd3e37 Merge

merged

Comments (0)

Files changed (3)

 templates are given in the ``templates`` attribute, then the handler should
 raise a ``NotImplemented`` exception. Handlers may warn if some templates that
 the handler can use are not given. Handlers should specify what templates can be
-used as a list of strings in ``Handler.templates``.
+used as a list of strings in ``Handler.templates``. If the handler cannot render
+for any reason, it should raise a ``Handler.CannotRender`` exception.
 
 .. automodule:: shinypress.handler
     :members:

shinypress/songs/__init__.py

+"""
+Module for managing songs
+"""
+
+from warnings import warn, Warning
+
+import ..handler.Handler as BaseHandler
+from ..handler import CannotRender
+
+class Song(BaseHandler):
+    """
+    A representation of a song.
+    """
+    templates = [
+            ("song-single",) # A single slide with a title, main text and info box
+            (
+                "title-text", # Slide with title and main text
+                "text", # Slide with only main text
+                "song-final", # Slide with main text and info box
+            ),
+        ]
+    blocks = ["title", "main text", "info box"]
+    def __init__(self, song_dict):
+        """
+        Create song from dict conforming to song json format.
+        :param song_dict: dict conforming to song json format
+        """
+        pass
+
+    def layout(self, theme):
+        try:
+            return self.single_render(theme)
+        except KeyError as e:
+            warn(
+
+
+    def json_repr(self):
+        """
+        Returns json format for song.
+
+        :rtype: dict conforming to song json format
+        """
+        pass
+

shinypress/songs/utils.py

+# -*- coding: utf-8 -*-
+
+from ..text.mulitple import GreedyDualSize
+
+def layout_songfile(
+        song_name, ext='song', search_dirs=tuple(),
+):
+    """
+    Lays out ``song_name.ext`` using ``layout_strategy``. Uses the first file
+    with the name ``song_name.ext`` in the paths given in ``search_dirs``.
+
+    :param song_name: string
+    :param ext: string
+    :param search_dirs: list of paths
+    :rtype: list of PangoLayout objects
+    """
+    pass
+
+def old_to_new(path_to_song):
+    """
+    Converts old song format to new json format.
+
+    :param path_to_song: string
+    :rtype: dict conforming to song json format
+    """
+    pass
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.