The HtmlContext builds all parts necessary for a website. Most of the building is done by the HtmlBuilder instance, stored as self.b. HtmlContext is needed, because not all drawing can be done in HTML. Htmlcontext will decide to include SVG or pixel images for the HTML-representatio
| 31 | HAS_PIL = False |
| 32 | |
| 33 | class HtmlContext(BaseContext): |
| 34 | """The HtmlContext builds all parts necessary for a website. Most of the |
| 35 | building is done by the HtmlBuilder instance, stored as self.b. |
| 36 | |
| 37 | HtmlContext is needed, because not all drawing can be done in HTML. |
| 38 | Htmlcontext will decide to include SVG or pixel images for the |
| 39 | HTML-representation depending on the type of element. |
| 40 | |
| 41 | TODO: Add all methods compatible with DrawBotContext, even if empty |
| 42 | functionality for HTML/CSS. |
| 43 | """ |
| 44 | # Indication to Typesetter that by default tags should be included in |
| 45 | # output. |
| 46 | useTags = True |
| 47 | |
| 48 | # Used by the generic BaseContext.newString( ) |
| 49 | STRING_CLASS = BabelString |
| 50 | EXPORT_TYPES = ('html', 'css', 'js') |
| 51 | |
| 52 | def __init__(self): |
| 53 | super().__init__() |
| 54 | self.b = HtmlBuilder() |
| 55 | self._fill = noColor |
| 56 | self._numberOfPages = 1 |
| 57 | |
| 58 | # Drawing. |
| 59 | |
| 60 | def newDrawing(self, w=None, h=None, doc=None): |
| 61 | """PageBot function. Ignore for now in HTMLContext. |
| 62 | |
| 63 | Clear output canvas, start new export file. |
| 64 | The @doc is the optional Document instance of the calling function. |
| 65 | """ |
| 66 | |
| 67 | def endDrawing(self): |
| 68 | pass |
| 69 | |
| 70 | def saveDrawing(self, path, multiPage=None): |
| 71 | pass |
| 72 | |
| 73 | def getDrawing(self): |
| 74 | pass |
| 75 | |
| 76 | def newPage(self, w=None, h=None, doc=None, **kwargs): |
| 77 | pass |
| 78 | |
| 79 | def pageCount(self): |
| 80 | return self._numberOfPages |
| 81 | |
| 82 | def newPath(self): |
| 83 | return None |
| 84 | |
| 85 | def frameDuration(self, value): |
| 86 | pass |
| 87 | |
| 88 | def _get_width(self): |
| 89 | """Answers the width of the current page.""" |
| 90 | raise NotImplementedError |
no outgoing calls
no test coverage detected