betty.extension.cotton_candy package - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.extension.cotton_candy package

## Submodules

- betty.extension.cotton_candy.gui module
- betty.extension.cotton_candy.search module
  - `Index`
    - `Index.__init__()`
    - `Index.build()`

## Module contents

Provide Betty’s default theme.

class betty.extension.cotton_candy.CottonCandy

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

  Provide Betty’s default front-end theme.

  Parameters:

    - args (`typing.Any`)

    - configuration (`typing.Optional`[`typing.TypeVar`(`ConfigurationT`, bound= `betty.config.Configuration`)])

    - kwargs (`typing.Any`)

  classmethod assets_directory_path() → pathlib._local.Path

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

    This may be anywhere in your Python package.

    Return type:

      `pathlib._local.Path`

  classmethod comes_after() → set[type[betty.app.extension.Extension]]

    The extensions that this one comes after.

    The other extensions may or may not be enabled.

    Return type:

      `set`[`type`[`betty.app.extension.Extension`]]

  classmethod default_configuration() → betty.extension.cotton_candy.CottonCandyConfiguration

    Get this extension’s default configuration.

    Return type:

      `betty.extension.cotton_candy.CottonCandyConfiguration`

  classmethod depends_on() → set[type[betty.app.extension.Extension]]

    The extensions this one depends on, and comes after.

    Return type:

      `set`[`type`[`betty.app.extension.Extension`]]

  classmethod description() → betty.locale.Str

    Get the human-readable extension description.

    Return type:

      `betty.locale.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

    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.

  gui_build() → PyQt6.QtWidgets.QWidget

    Build this extension’s Graphical User Interface component.

    Return type:

      `PyQt6.QtWidgets.QWidget`

  classmethod label() → betty.locale.Str

    Get the human-readable extension label.

    Return type:

      `betty.locale.Str`

  property logo: Path

    The path to the logo file.

  classmethod name() → str

    The machine name.

    Return type:

      `str`

  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]

    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._local.Path

    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._local.Path`

class betty.extension.cotton_candy.CottonCandyConfiguration

  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_LINK_ACTIVE_COLOR = '#2a615a'
  DEFAULT_LINK_INACTIVE_COLOR = '#149988'
  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)
    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.serde.dump.Void]

    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.serde.dump.Void`]]

  property featured_entities: EntityReferenceSequence[UserFacingEntity & Entity]

    The entities featured on the front page.

  property link_active_color: _ColorConfiguration

    The color for active hyperlinks.

  property link_inactive_color: _ColorConfiguration

    The color for inactive hyperlinks.

  classmethod load(dump: bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump], configuration: Self | None = None) → Self

    Load dumped configuration into a new configuration instance.

    Parameters:

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

      - configuration (`typing.Optional`[`typing.Self`])

    Return type:

      `typing.Self`

  property logo: Path | 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.

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]]]

  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]

  Gather all events for a person’s timeline.

  Parameters:

    - person (`betty.model.ancestry.Person`)

    - lifetime_threshold (`int`)

  Return type:

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