(self, dimensions, html_file, css_file=None, template_params={})
| 85 | return template_params |
| 86 | |
| 87 | def render_image(self, dimensions, html_file, css_file=None, template_params={}): |
| 88 | # load the base plugin and current plugin css files |
| 89 | css_files = [os.path.join(BASE_PLUGIN_RENDER_DIR, "plugin.css")] |
| 90 | if css_file: |
| 91 | plugin_css = os.path.join(self.render_dir, css_file) |
| 92 | css_files.append(plugin_css) |
| 93 | |
| 94 | template_params["style_sheets"] = css_files |
| 95 | template_params["width"] = dimensions[0] |
| 96 | template_params["height"] = dimensions[1] |
| 97 | template_params["font_faces"] = get_fonts() |
| 98 | template_params["static_dir"] = STATIC_DIR |
| 99 | |
| 100 | # load and render the given html template |
| 101 | template = self.env.get_template(html_file) |
| 102 | rendered_html = template.render(template_params) |
| 103 | |
| 104 | return take_screenshot_html(rendered_html, dimensions) |
no test coverage detected