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
This commit is contained in:
Goffi 2020-04-19 16:53:44 +02:00
commit 47ec15cc46
2 changed files with 203 additions and 3 deletions

View file

@ -1009,3 +1009,18 @@ doc=Generate a preview of an image in cache
doc_param_0=image_path: path of the original image
doc_param_1=%(doc_profile_key)s
doc_return=path to the preview in cache
[imageConvert]
async=
type=method
category=core
sig_in=ssss
sig_out=s
doc=Convert an image to an other format
doc_param_0=source: path of the image to convert
doc_param_1=dest: path to the location where the new image must be stored.
Empty string to generate a file in cache, unique to the source
doc_param_3=extra: serialised extra
doc_param_4=profile_key: either profile_key or empty string to use common cache
this parameter is used only when dest is empty
doc_return=path to the new converted image

View file

@ -408,6 +408,12 @@ class DbusObject(dbus.service.Object):
def imageCheck(self, arg_0):
return self._callback("imageCheck", str(arg_0))
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='ssss', out_signature='s',
async_callbacks=('callback', 'errback'))
def imageConvert(self, source, dest, arg_2, extra, callback=None, errback=None):
return self._callback("imageConvert", str(source), str(dest), str(arg_2), str(extra), callback=callback, errback=errback)
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='ss', out_signature='s',
async_callbacks=('callback', 'errback'))