betty.extension.cotton_candy package

Submodules

Module contents

Provide Betty’s default theme.

final class betty.extension.cotton_candy.CottonCandy[source]

Bases: Theme, CssProvider, ConfigurableExtension[CottonCandyConfiguration], Generator, Jinja2Provider, WebpackEntryPointProvider

Provide Betty’s default front-end theme.

Parameters:
classmethod assets_directory_path() pathlib.Path[source]

Return the path on disk where the extension’s assets are located.

This may be anywhere in your Python package.

Return type:

pathlib.Path

classmethod comes_after() set[str][source]

The extensions that this one comes after.

The other extensions may or may not be enabled.

Return type:

set[str]

classmethod default_configuration() betty.extension.cotton_candy.CottonCandyConfiguration[source]

Get this extension’s default configuration.

Return type:

betty.extension.cotton_candy.CottonCandyConfiguration

classmethod depends_on() set[str][source]

The extensions this one depends on, and comes after.

Return type:

set[str]

property filters: dict[str, Callable[[...], Any]]

Jinja2 filters provided by this extension.

Keys are filter names, and values are the filters themselves.

async generate(job_context: betty.generate.GenerationContext) None[source]

Generate (part of) a project’s site.

Parameters:

job_context (betty.generate.GenerationContext)

Return type:

None

property globals: dict[str, Any]

Jinja2 globals provided by this extension.

Keys are the globals’ names, and values are the globals’ values.

The path to the logo file.

classmethod plugin_description() betty.locale.localizable.Localizable[source]

Get the human-readable long plugin description.

Return type:

betty.locale.localizable.Localizable

classmethod plugin_id() str[source]

Get the plugin ID.

IDs are unique per plugin type: - A plugin repository MUST at most have a single plugin for any ID. - Different plugin repositories MAY each have a plugin with the same ID.

Return type:

str

classmethod plugin_label() betty.locale.localizable.Localizable[source]

Get the human-readable short plugin label.

Return type:

betty.locale.localizable.Localizable

property public_css_paths: list[str]

The public URL paths to the CSS files to include in each HTML page.

webpack_entry_point_cache_keys() collections.abc.Sequence[str][source]

Get the keys that make a Webpack build for this provider unique.

Providers that can be cached regardless may return ().

Return type:

collections.abc.Sequence[str]

classmethod webpack_entry_point_directory_path() pathlib.Path[source]

Get the path to the directory with the entry point assets.

The directory must include at least a package.json and main.ts.

Return type:

pathlib.Path

class betty.extension.cotton_candy.CottonCandyConfiguration[source]

Bases: Configuration

Provide configuration for the betty.extension.cotton_candy.CottonCandy extension.

Parameters:
  • featured_entities (Sequence[EntityReference[UserFacingEntity & Entity]] | None)

  • primary_inactive_color (str)

  • primary_active_color (str)

  • link_inactive_color (str)

  • link_active_color (str)

  • logo (Path | None)

DEFAULT_PRIMARY_ACTIVE_COLOR = '#ff69b4'
DEFAULT_PRIMARY_INACTIVE_COLOR = '#ffc0cb'
__init__(*, featured_entities: Sequence[EntityReference[UserFacingEntity & Entity]] | None = None, primary_inactive_color: str = '#ffc0cb', primary_active_color: str = '#ff69b4', link_inactive_color: str = '#149988', link_active_color: str = '#2a615a', logo: Path | None = None)[source]
Parameters:
  • featured_entities (Sequence[EntityReference[UserFacingEntity & Entity]] | None)

  • primary_inactive_color (str)

  • primary_active_color (str)

  • link_inactive_color (str)

  • link_active_color (str)

  • logo (Path | None)

dump() bool | int | float | str | None | Sequence[bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | Mapping[str, bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | type[betty.typing.Void][source]

Dump this instance to a portable format.

Return type:

typing.Union[bool, int, float, str, None, typing.Sequence[typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], typing.Mapping[str, typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], type[betty.typing.Void]]

property featured_entities: EntityReferenceSequence[UserFacingEntity & Entity]

The entities featured on the front page.

The color for active hyperlinks.

The color for inactive hyperlinks.

load(dump: bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]) None[source]

Load dumped configuration.

Raises:

betty.assertion.error.AssertionFailed – Raised if the dump contains invalid configuration.

Parameters:

dump (typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]])

Return type:

None

The path to the logo.

property primary_active_color: _ColorConfiguration

The color for active primary/CTA elements.

property primary_inactive_color: _ColorConfiguration

The color for inactive primary/CTA elements.

update(other: Self) None[source]

Update this configuration with the values from other.

Parameters:

other (typing.Self)

Return type:

None

betty.extension.cotton_candy.associated_files(has_files: betty.model.ancestry.HasFiles) Iterable[betty.model.ancestry.File][source]

Get the associated files for an entity that has files.

Parameters:

has_files (betty.model.ancestry.HasFiles)

Return type:

typing.Iterable[betty.model.ancestry.File]

betty.extension.cotton_candy.person_descendant_families(person: betty.model.ancestry.Person) Iterable[tuple[collections.abc.Sequence[betty.model.ancestry.Person], collections.abc.Sequence[betty.model.ancestry.Person]]][source]

Gather a person’s families they are a parent in.

Parameters:

person (betty.model.ancestry.Person)

Return type:

typing.Iterable[tuple[collections.abc.Sequence[betty.model.ancestry.Person], collections.abc.Sequence[betty.model.ancestry.Person]]]

betty.extension.cotton_candy.person_timeline_events(person: betty.model.ancestry.Person, lifetime_threshold: int) Iterable[betty.model.ancestry.Event][source]

Gather all events for a person’s timeline.

Parameters:
Return type:

typing.Iterable[betty.model.ancestry.Event]