gws.lib.style.icon

Source code: gws.lib.style.icon

Module Contents

exception gws.lib.style.icon.Error

Bases: gws.Error

GWS error.

class gws.lib.style.icon.ParsedIcon(*args, **kwargs)

Bases: gws.Data

Svg data.

svg: gws.XmlElement

Structure and attributes of the svg.

gws.lib.style.icon.to_data_url(icon: ParsedIcon) str

Converts a svg to url.

Parameters:

icon – Svg object to convert.

Returns:

The url, or an empty string if icon is not a svg.

gws.lib.style.icon.parse(val: str, opts) ParsedIcon | None

Parses an url or directory path to a svg.

Parameters:
  • val – An url or directory path containing a svg.

  • opts – Url or directory path options.

Returns:

The svg, if the url is trusted, or if the path is in a trusted directory.