Coverage for gws-app/gws/plugin/legend/static/__init__.py: 0%

15 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-04-17 01:37 +0200

1"""Static legend.""" 

2 

3import gws 

4import gws.lib.image 

5import gws.lib.mime 

6import gws.base.legend 

7 

8 

9gws.ext.new.legend('static') 

10 

11 

12class Config(gws.base.legend.Config): 

13 """Static legend.""" 

14 

15 path: gws.FilePath 

16 """path to the image file""" 

17 

18 

19class Object(gws.base.legend.Object): 

20 path: str 

21 

22 def configure(self): 

23 self.path = self.cfg('path') 

24 

25 def render(self, args=None): 

26 img = gws.lib.image.from_path(self.path) 

27 return gws.LegendRenderOutput(image=img, size=img.size(), mime=gws.lib.mime.for_path(self.path))