election_day.utils.svg_generator

Classes

SvgGenerator

Module Contents

class election_day.utils.svg_generator.SvgGenerator(app: onegov.election_day.app.ElectionDayApp, renderer: onegov.election_day.utils.d3_renderer.D3Renderer | None = None)[source]
app[source]
svg_dir = 'svg'[source]
session[source]
renderer[source]
remove(directory: str, files: Collection[str]) None[source]

Safely removes the given files from the directory.

generate_svg(item: onegov.election_day.models.Election | onegov.election_day.models.ElectionCompound | onegov.election_day.models.ElectionCompoundPart | onegov.election_day.models.Ballot, type_: str, filename: str, locale: str) int[source]

Creates the requested SVG.

Returns the number of created files.

create_svgs() tuple[int, int][source]

Generates all SVGs for the given application.

Only generates SVGs if not already generated since the last change of the election, election compound or vote.

Cleans up unused SVGs.