Mercurial > libervia-backend
comparison sat_frontends/bridge/dbus_bridge.py @ 3259:f300d78f08f3
core: image convertion + SVG support:
/!\ new optional dependency: CairoSVG (with installed `[SVG]` extra)
- new `convert` method in `tools.image` to save an image in an other format, with support
for SVG (when CairoSVG is available)
- new `imageConvert` method is available for frontends
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 19 Apr 2020 16:53:44 +0200 |
parents | 6cf4bd6972c2 |
children | be6d91572633 |
comparison
equal
deleted
inserted
replaced
3258:7aa01e262e05 | 3259:f300d78f08f3 |
---|---|
504 if callback is not None: | 504 if callback is not None: |
505 kwargs['timeout'] = const_TIMEOUT | 505 kwargs['timeout'] = const_TIMEOUT |
506 kwargs['reply_handler'] = callback | 506 kwargs['reply_handler'] = callback |
507 kwargs['error_handler'] = error_handler | 507 kwargs['error_handler'] = error_handler |
508 return str(self.db_core_iface.imageCheck(arg_0, **kwargs)) | 508 return str(self.db_core_iface.imageCheck(arg_0, **kwargs)) |
509 | |
510 def imageConvert(self, source, dest, arg_2, extra, callback=None, errback=None): | |
511 if callback is None: | |
512 error_handler = None | |
513 else: | |
514 if errback is None: | |
515 errback = log.error | |
516 error_handler = lambda err:errback(dbus_to_bridge_exception(err)) | |
517 return str(self.db_core_iface.imageConvert(source, dest, arg_2, extra, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) | |
509 | 518 |
510 def imageGeneratePreview(self, image_path, profile_key, callback=None, errback=None): | 519 def imageGeneratePreview(self, image_path, profile_key, callback=None, errback=None): |
511 if callback is None: | 520 if callback is None: |
512 error_handler = None | 521 error_handler = None |
513 else: | 522 else: |
1195 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) | 1204 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) |
1196 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) | 1205 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) |
1197 self.db_core_iface.imageCheck(arg_0, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) | 1206 self.db_core_iface.imageCheck(arg_0, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) |
1198 return fut | 1207 return fut |
1199 | 1208 |
1209 def imageConvert(self, source, dest, arg_2, extra): | |
1210 loop = asyncio.get_running_loop() | |
1211 fut = loop.create_future() | |
1212 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) | |
1213 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) | |
1214 self.db_core_iface.imageConvert(source, dest, arg_2, extra, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) | |
1215 return fut | |
1216 | |
1200 def imageGeneratePreview(self, image_path, profile_key): | 1217 def imageGeneratePreview(self, image_path, profile_key): |
1201 loop = asyncio.get_running_loop() | 1218 loop = asyncio.get_running_loop() |
1202 fut = loop.create_future() | 1219 fut = loop.create_future() |
1203 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) | 1220 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) |
1204 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) | 1221 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) |