Mercurial > libervia-backend
diff 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 |
line wrap: on
line diff
--- a/sat_frontends/bridge/dbus_bridge.py Sun Apr 19 16:40:34 2020 +0200 +++ b/sat_frontends/bridge/dbus_bridge.py Sun Apr 19 16:53:44 2020 +0200 @@ -507,6 +507,15 @@ kwargs['error_handler'] = error_handler return str(self.db_core_iface.imageCheck(arg_0, **kwargs)) + def imageConvert(self, source, dest, arg_2, extra, callback=None, errback=None): + if callback is None: + error_handler = None + else: + if errback is None: + errback = log.error + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return str(self.db_core_iface.imageConvert(source, dest, arg_2, extra, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) + def imageGeneratePreview(self, image_path, profile_key, callback=None, errback=None): if callback is None: error_handler = None @@ -1197,6 +1206,14 @@ self.db_core_iface.imageCheck(arg_0, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut + def imageConvert(self, source, dest, arg_2, extra): + loop = asyncio.get_running_loop() + fut = loop.create_future() + reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.imageConvert(source, dest, arg_2, extra, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) + return fut + def imageGeneratePreview(self, image_path, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future()