comparison cagou/core/image.py @ 491:203755bbe0fe

massive refactoring from camelCase -> snake_case. See backend commit log for more details
author Goffi <goffi@goffi.org>
date Sat, 08 Apr 2023 13:44:32 +0200
parents 3c9ba4a694ef
children
comparison
equal deleted inserted replaced
490:962d17c4078c 491:203755bbe0fe
34 34
35 def __init__(self, **kwargs): 35 def __init__(self, **kwargs):
36 self.register_event_type('on_error') 36 self.register_event_type('on_error')
37 super().__init__(**kwargs) 37 super().__init__(**kwargs)
38 38
39 def _imageConvertCb(self, path): 39 def _image_convert_cb(self, path):
40 self.source = path 40 self.source = path
41 41
42 def texture_update(self, *largs): 42 def texture_update(self, *largs):
43 if self.source: 43 if self.source:
44 if mimetypes.guess_type(self.source, strict=False)[0] == 'image/svg+xml': 44 if mimetypes.guess_type(self.source, strict=False)[0] == 'image/svg+xml':
45 log.debug(f"Converting SVG image at {self.source} to PNG") 45 log.debug(f"Converting SVG image at {self.source} to PNG")
46 G.host.bridge.imageConvert( 46 G.host.bridge.image_convert(
47 self.source, 47 self.source,
48 "", 48 "",
49 data_format.serialise(self.SVG_CONVERT_EXTRA), 49 data_format.serialise(self.SVG_CONVERT_EXTRA),
50 "", 50 "",
51 callback=self._imageConvertCb, 51 callback=self._image_convert_cb,
52 errback=partial( 52 errback=partial(
53 G.host.errback, 53 G.host.errback,
54 message=f"Can't load image at {self.source}: {{msg}}" 54 message=f"Can't load image at {self.source}: {{msg}}"
55 ) 55 )
56 ) 56 )