Coverage for gws-app/gws/plugin/legend/html/__init__.py: 0%
16 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-17 01:37 +0200
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-17 01:37 +0200
1"""HTML legend."""
3import gws
4import gws.base.legend
5import gws.lib.image
6import gws.lib.mime
8gws.ext.new.legend('html')
11class Config(gws.base.legend.Config):
12 """HTML-based legend."""
14 template: gws.ext.config.template
15 """template for an HTML legend"""
18class Object(gws.base.legend.Object):
19 template: gws.Template
21 def configure(self):
22 self.template = self.create_child(gws.ext.object.template, self.cfg('template'))
24 def render(self, args=None):
25 # @TODO return html legends as html
26 res = self.template.render(gws.TemplateRenderInput(
27 args=args,
28 mimeOut=gws.lib.mime.PNG))
29 img = gws.lib.image.from_path(res.contentPath)
30 return gws.LegendRenderOutput(image=img, size=img.size())