svgen package#

Subpackages#

Submodules#

svgen.app module#

svgen - This package’s command-line entry-point application.

svgen.app.add_app_args(parser: ArgumentParser) None[source]#

Add application-specific arguments to the command-line parser.

svgen.app.entry(args: Namespace) int[source]#

Execute the requested task.

svgen.app.generate(config: Config, output: Path, cwd: Path, scripts: Iterable[Path], images: bool = True) None[source]#

Generate a single SVG document.

svgen.app.initialize_config(config: Config, default_height: int, default_width: int) None[source]#

Set initial values for SVG document configurations.

svgen.display module#

A module for working with common display assets.

class svgen.display.AspectRatio(width: int, height: int, final: bool = False)[source]#

Bases: NamedTuple

A class to storge a width and height ratio.

property args: List[str]#

Get inkscape command-line arguments.

as_str(delim: str = ':') str[source]#

Get this aspect ratio as a string.

static create(wxh: str, delim: str = ':') AspectRatio[source]#

Create an aspect ration from a string.

final: bool#

Alias for field number 2

height: int#

Alias for field number 1

property landscape: bool#

Determine if this ratio is landscape.

property over_height: float#

Express this ratio as one of width over height.

property portrait: bool#

Determine if this ratio is portrait.

rotate() AspectRatio[source]#

Get this aspect ratio rotated.

property square: bool#

Determine if this is a square aspect ratio.

width: int#

Alias for field number 0

svgen.display.common_sizes(ratio: str | AspectRatio | ViewBox) Iterator[AspectRatio][source]#

Iterate over common sizes for a given aspect ratio.

svgen.entry module#

This package’s command-line entry-point (boilerplate).

svgen.entry.main(argv: List[str] = None) int[source]#

Program entry-point.

svgen.inkscape module#

A module for generating image outputs from SVG via Inkscape.

inkscape/inkscape

class svgen.inkscape.InkscapeTask(name: str, *args, execute: Callable[[Dict[str, Dict[str, Any]], Dict[str, Any]], Coroutine[Any, Any, bool]] = None, log: Logger = None, timer: Timer = None, target: Target = None, **kwargs)[source]#

Bases: SubprocessExecStreamed

A task implementation for invoking inkscape at command-line.

async invoke(*cli_args, entry: str = 'inkscape') bool[source]#

Invoke inkscape.

async svgen.inkscape.invoke(*cli_args: str, entry: str = 'inkscape') bool[source]#

Run an inkscape command-line command.

async svgen.inkscape.invoke_multiple(args: List[List[str]], entry: str = 'inkscape') bool[source]#

Run multiple inkscape invocations at the same time.

svgen.script module#

svgen - A module for working with external scripts.

svgen.script.invoke_script(path: Path, svg: Svg, config: Config) None[source]#

Invoke an external script’s ‘compose’ function.

Module contents#

Useful defaults and other package metadata.