election_day.screen_widgets.election

Module Contents

Classes

ElectionCandidatesTableWidget

Abstract base class for generic types.

ElectionCandidatesByEntityTableWidget

Abstract base class for generic types.

ElectionListsTableWidget

Abstract base class for generic types.

ElectionPartyStrengthsTableWidget

Abstract base class for generic types.

ElectionCandidatesChartWidget

Abstract base class for generic types.

ElectionListsChartWidget

Abstract base class for generic types.

ElectionPartyStrengthsChartWidget

Abstract base class for generic types.

AllocatedMandatesWidget

Abstract base class for generic types.

NumberOfMandatesWidget

Abstract base class for generic types.

MandatesWidget

Abstract base class for generic types.

ElectionTurnoutWidget

Abstract base class for generic types.

AbsoluteMajorityWidget

Abstract base class for generic types.

IfAbsoluteMajorityWidget

Abstract base class for generic types.

IfRelateMajorityWidget

Abstract base class for generic types.

class election_day.screen_widgets.election.ElectionCandidatesTableWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ModelBoundWidget[onegov.ballot.Election]

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 = 'election-candidates-table'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="election-candidates-table">
            <div class="{@class}" tal:define="lists '{@lists}'">
                <tal:block
                    metal:use-macro="layout.macros['election-candidates-table']"
                    tal:define="show_percentage (election.type != 'proporz')"
                    />
            </div>
        </xsl:template>
    """
usage = '<election-candidates-table class="" lists=","/>'[source]
get_variables(layout: onegov.election_day.layouts.DefaultLayout) dict[str, Any][source]
class election_day.screen_widgets.election.ElectionCandidatesByEntityTableWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ModelBoundWidget[onegov.ballot.Election]

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 = 'election-candidates-by-entity-table'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="election-candidates-by-entity-table">
            <div class="{@class}">
                <tal:block
                    metal:use-macro="layout.macros['election-candidates-by-entity-table']"
                    />
            </div>
        </xsl:template>
    """
usage = '<election-candidates-by-entity-table class=""/>'[source]
get_variables(layout: onegov.election_day.layouts.DefaultLayout) dict[str, Any][source]
class election_day.screen_widgets.election.ElectionListsTableWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ModelBoundWidget[onegov.ballot.ProporzElection]

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 = 'election-lists-table'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="election-lists-table">
            <div class="{@class}" tal:define="names '{@names}'">
                <tal:block
                    metal:use-macro="layout.macros['election-lists-table']"
                    />
            </div>
        </xsl:template>
    """
usage = '<election-lists-table class="" names=","/>'[source]
get_variables(layout: onegov.election_day.layouts.DefaultLayout) dict[str, Any][source]
class election_day.screen_widgets.election.ElectionPartyStrengthsTableWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ModelBoundWidget[onegov.ballot.ProporzElection]

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 = 'election-party-strengths-table'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="election-party-strengths-table">
            <div class="{@class}" tal:define="year '{@year}'">
                <tal:block
                    metal:use-macro="layout.macros['party-strengths-table']"
                    />
            </div>
        </xsl:template>
    """
usage = '<election-party-strengths-table year="" class=""/>'[source]
get_variables(layout: onegov.election_day.layouts.DefaultLayout) dict[str, Any][source]
class election_day.screen_widgets.election.ElectionCandidatesChartWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ChartWidget[onegov.ballot.Election]

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 = 'election-candidates-chart'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="election-candidates-chart">
            <div class="{@class}"
                 tal:define="limit '0{@limit}';
                             lists '{@lists}';
                             elected '{@elected}';
                             sort_by_lists '{@sort-by-lists}';
                             ">
                <tal:block
                    metal:use-macro="layout.macros['candidates-chart']"
                    />
            </div>
        </xsl:template>
    """
usage = '<election-candidates-chart limit="" lists="," sort-by-lists="" elected="" class=""/>'[source]
class election_day.screen_widgets.election.ElectionListsChartWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ChartWidget[onegov.ballot.ProporzElection]

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 = 'election-lists-chart'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="election-lists-chart">
            <div class="{@class}"
                 tal:define="limit '0{@limit}';
                             names '{@names}';
                             sort_by_names '{@sort-by-names}'
                             ">
                <tal:block
                    metal:use-macro="layout.macros['lists-chart']"
                    />
            </div>
        </xsl:template>
    """
usage = '<election-lists-chart limit="" names="," sort-by-names="" class=""/>'[source]
class election_day.screen_widgets.election.ElectionPartyStrengthsChartWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ChartWidget[onegov.ballot.ProporzElection]

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 = 'election-party-strengths-chart'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="election-party-strengths-chart">
            <div class="{@class}"
                 tal:define="horizontal '{@horizontal}'=='true'">
                <tal:block
                    metal:use-macro="layout.macros['party-strengths-chart']"
                    />
            </div>
        </xsl:template>
    """
usage = '<election-party-strengths-chart horizontal="false" class=""/>'[source]
class election_day.screen_widgets.election.AllocatedMandatesWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ModelBoundWidget[onegov.ballot.Election]

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 = 'allocated-mandates'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="allocated-mandates">
            <span class="{@class}">
                ${layout.format_number(model.allocated_mandates)}
            </span>
        </xsl:template>
    """
usage = '<allocated-mandates class=""/>'[source]
class election_day.screen_widgets.election.NumberOfMandatesWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ModelBoundWidget[onegov.ballot.Election]

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-mandates'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="number-of-mandates">
            <span class="{@class}">
                ${layout.format_number(model.number_of_mandates)}
            </span>
        </xsl:template>
    """
usage = '<number-of-mandates class=""/>'[source]
class election_day.screen_widgets.election.MandatesWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ModelBoundWidget[onegov.ballot.Election]

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 = 'mandates'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="mandates">
            <span class="{@class}">
                <tal:block
                    metal:use-macro="layout.macros['progress']"
                    tal:define="progress (model.allocated_mandates,                                            model.number_of_mandates)"
                    />
            </span>
        </xsl:template>
    """
usage = '<mandates class=""/>'[source]
class election_day.screen_widgets.election.ElectionTurnoutWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ModelBoundWidget[onegov.ballot.Election]

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 = 'election-turnout'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="election-turnout">
            <span class="{@class}">
                ${'{0:.2f}'.format(model.turnout)} %
            </span>
        </xsl:template>
    """
usage = '<election-turnout class=""/>'[source]
class election_day.screen_widgets.election.AbsoluteMajorityWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ModelBoundWidget[onegov.ballot.Election]

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 = 'absolute-majority'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="absolute-majority">
            <span class="{@class}">
                ${layout.format_number(model.absolute_majority or 0)}
            </span>
        </xsl:template>
    """
usage = '<absolute-majority class=""/>'[source]
class election_day.screen_widgets.election.IfAbsoluteMajorityWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ModelBoundWidget[onegov.ballot.Election]

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-absolute-majority'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="if-absolute-majority">
            <tal:block tal:condition="model.majority_type == 'absolute'">
                <xsl:apply-templates select="node()"/>
            </tal:block>
        </xsl:template>
    """
usage = '<if-absolute-majority></if-absolute-majority>'[source]
class election_day.screen_widgets.election.IfRelateMajorityWidget(model: _E | None = None)[source]

Bases: onegov.election_day.screen_widgets.generic.ModelBoundWidget[onegov.ballot.Election]

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-relative-majority'[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="if-relative-majority">
            <tal:block tal:condition="model.majority_type == 'relative'">
                <xsl:apply-templates select="node()"/>
            </tal:block>
        </xsl:template>
    """
usage = '<if-relative-majority></if-relative-majority>'[source]