election_day.screen_widgets.generic

Attributes

Entity

_E

Classes

H1Widget

H2Widget

H3Widget

PWidget

HRWidget

GridRowWidget

GridColumnWidget

PrincipalLogoWidget

QrCodeWidget

ModelBoundWidget

Abstract base class for generic types.

ModelTitleWidget

Abstract base class for generic types.

IfCompletedWidget

Abstract base class for generic types.

IfNotCompletedWidget

Abstract base class for generic types.

ModelProgressWidget

Abstract base class for generic types.

CountedEntitiesWidget

Abstract base class for generic types.

ChartWidget

Abstract base class for generic types.

LastResultChangeWidget

Abstract base class for generic types.

NumberOfCountedEntitiesWidget

Abstract base class for generic types.

TotalEntitiesWidget

Abstract base class for generic types.

Module Contents

election_day.screen_widgets.generic.Entity: TypeAlias = Election | ElectionCompound | Vote[source]
election_day.screen_widgets.generic._E[source]
class election_day.screen_widgets.generic.H1Widget[source]
tag = 'h1'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="h1">
            <h1 class="{@class}">
                <xsl:apply-templates select="node()"/>
            </h1>
        </xsl:template>
    """
usage = '<h1 class=""></h1>'[source]
class election_day.screen_widgets.generic.H2Widget[source]
tag = 'h2'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="h2">
            <h2 class="{@class}">
                <xsl:apply-templates select="node()"/>
            </h2>
        </xsl:template>
    """
usage = '<h2 class=""></h2>'[source]
class election_day.screen_widgets.generic.H3Widget[source]
tag = 'h3'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="h3">
            <h3 class="{@class}">
                <xsl:apply-templates select="node()"/>
            </h3>
        </xsl:template>
    """
usage = '<h3 class=""></h3>'[source]
class election_day.screen_widgets.generic.PWidget[source]
tag = 'p'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="p">
            <p class="{@class}">
                <xsl:apply-templates select="node()"/>
            </p>
        </xsl:template>
    """
usage = '<p class=""></p>'[source]
class election_day.screen_widgets.generic.HRWidget[source]
tag = 'hr'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="hr">
            <hr class="{@class}" />
        </xsl:template>
    """
usage = '<hr class=""/>'[source]
class election_day.screen_widgets.generic.GridRowWidget[source]
tag = 'grid-row'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="grid-row">
            <div class="row {@class}" style="max-width: none">
                <xsl:apply-templates select="node()"/>
            </div>
        </xsl:template>
    """
usage = '<grid-row class=""></grid-row>'[source]
class election_day.screen_widgets.generic.GridColumnWidget[source]
tag = 'grid-column'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="grid-column">
            <div class="small-12 medium-{@span} columns {@class}">
                <xsl:apply-templates select="node()"/>
                &#160;
            </div>
        </xsl:template>
    """
usage = '<grid-column span="" class=""></grid-column>'[source]
class election_day.screen_widgets.generic.PrincipalLogoWidget[source]
tag = 'principal-logo'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="principal-logo">
            <img
                tal:attributes="src logo"
                tal:condition="logo"
                class="{@class}"
                />
        </xsl:template>
    """
usage = '<principal-logo class=""/>'[source]
get_variables(layout: onegov.election_day.layouts.DefaultLayout) dict[str, Any][source]
class election_day.screen_widgets.generic.QrCodeWidget[source]
tag = 'qr-code'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="qr-code">
            <tal:block tal:define="url '{@url}'; src qr_code(url)">
                <img tal:attributes="src src"
                     class="{@class}"
                     />
            </tal:block>

        </xsl:template>
    """
usage = '<qr-code class="" url="https://"/>'[source]
static qr_code(url: str) str[source]
get_variables(layout: onegov.election_day.layouts.DefaultLayout) dict[str, Any][source]
class election_day.screen_widgets.generic.ModelBoundWidget(model: _E | None = None)[source]

Bases: Generic[_E]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
model = None[source]
get_variables(layout: onegov.election_day.layouts.DefaultLayout) dict[str, Any][source]
class election_day.screen_widgets.generic.ModelTitleWidget(model: _E | None = None)[source]

Bases: ModelBoundWidget[Entity]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
tag = 'model-title'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="model-title">
            <span tal:content="model.title" class="{@class}" />
        </xsl:template>
    """
usage = '<model-title class=""/>'[source]
class election_day.screen_widgets.generic.IfCompletedWidget(model: _E | None = None)[source]

Bases: ModelBoundWidget[Entity]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
tag = 'if-completed'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="if-completed">
            <tal:block tal:condition="model.completed">
                <xsl:apply-templates select="node()"/>
            </tal:block>
        </xsl:template>
    """
usage = '<if-completed></if-completed>'[source]
class election_day.screen_widgets.generic.IfNotCompletedWidget(model: _E | None = None)[source]

Bases: ModelBoundWidget[Entity]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
tag = 'if-not-completed'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="if-not-completed">
            <tal:block tal:condition="not model.completed">
                <xsl:apply-templates select="node()"/>
            </tal:block>
        </xsl:template>
    """
usage = '<if-not-completed></if-not-completed>'[source]
class election_day.screen_widgets.generic.ModelProgressWidget(model: _E | None = None)[source]

Bases: ModelBoundWidget[Entity]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
tag = 'model-progress'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="model-progress">
            <span class="{@class}">
                <tal:block
                    metal:use-macro="layout.macros['progress']"
                    tal:define="progress model.progress"
                    />
            </span>
        </xsl:template>
    """
usage = '<model-progress class=""/>'[source]
class election_day.screen_widgets.generic.CountedEntitiesWidget(model: _E | None = None)[source]

Bases: ModelBoundWidget[Entity]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
tag = 'counted-entities'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="counted-entities">
            <span class="{@class}">${entities}</span>
        </xsl:template>
    """
usage = '<counted-entities class=""/>'[source]
get_variables(layout: onegov.election_day.layouts.DefaultLayout) dict[str, Any][source]
class election_day.screen_widgets.generic.ChartWidget(model: _E | None = None)[source]

Bases: ModelBoundWidget[_E]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
get_variables(layout: onegov.election_day.layouts.DefaultLayout) dict[str, Any][source]
class election_day.screen_widgets.generic.LastResultChangeWidget(model: _E | None = None)[source]

Bases: ModelBoundWidget[Entity]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
tag = 'last-result-change'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="last-result-change">
            <span class="{@class}">
            ${layout.format_date(layout.last_result_change, 'datetime_long')}
            </span>
        </xsl:template>
    """
usage = '<last-result-change class=""/>'[source]
class election_day.screen_widgets.generic.NumberOfCountedEntitiesWidget(model: _E | None = None)[source]

Bases: ModelBoundWidget[Entity]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
tag = 'number-of-counted-entities'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="number-of-counted-entities">
            <span class="{@class}">
                ${layout.format_number(model.progress[0])}
            </span>
        </xsl:template>
    """
usage = '<number-of-counted-entities class=""/>'[source]
class election_day.screen_widgets.generic.TotalEntitiesWidget(model: _E | None = None)[source]

Bases: ModelBoundWidget[Entity]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
tag = 'total-entities'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="total-entities">
            <span class="{@class}">
                ${layout.format_number(model.progress[1])}
            </span>
        </xsl:template>
    """
usage = '<total-entities class=""/>'[source]