gws.lib.style.parser

Style parser.

Source code: gws.lib.style.parser

Module Contents

class gws.lib.style.parser.Options(*args, **kwargs)

Bases: gws.Data

Options about an icon object

trusted: bool

Indicates whether icon is created by us or someone else.

strict: bool

Indicates whether Exceptions should be raised.

imageDirs: list[str]

Paths to directories in which parsing is allowed

gws.lib.style.parser.parse_dict(d: dict, opts: Options) dict

Adds a dictionary describing style features to a default dictionary.

Parameters:
  • d – A dictionary with new features.

  • opts – Dictionary options.

Returns:

New dictionary of features.

Raises:

Exception – If an invalid css property or value is used.

gws.lib.style.parser.parse_text(text: str, opts: Options) dict

Parses a text of features to a dict containing the new features.

Parameters:
  • text – Options String formatted like 'a:b;c:d;...'

  • opts – Text options.

Returns:

New dictionary of features.