common
Module¶
TallyConfig Classes¶
- class tallypi.common.TallyConfig[source]¶
Bases:
object
Configuration data for tally assignment
- classmethod from_dict(d: Dict) → tallypi.common.TallyConfig[source]¶
Create a
TallyConfig
from serialized data
- class tallypi.common.SingleTallyConfig(tally_index: int, tally_type: tslumd.common.TallyType = <TallyType.no_tally: 0>, color_mask: tslumd.common.TallyColor = <TallyColor.AMBER: 3>, screen_index: Optional[int] = None, name: Optional[str] = '')[source]¶
Bases:
tallypi.common.TallyConfig
Configuration for a single tally
- tally_index: int¶
The tally index ranging from 0 to 65534 (
0xfffe
)The special value of 65535 (
0xffff
) is used as a “broadcast” address
- tally_type: tslumd.common.TallyType = 0¶
The
TallyType
- color_mask: tslumd.common.TallyColor = 3¶
An optional mask which can limit the color changes
The default (
AMBER
) allows all changes
- screen_index: Optional[int] = None¶
The
index
of thetslumd.tallyobj.Screen
the tally belongs to, ranging from 0 to 65534 (0xfffe
)If not provided (or
None
), the tally is assumed to belong to any screen. This is also the case if the value is 65535 (0xffff
), defined as the “broadcast” screen address.
- classmethod from_tally(tally: tslumd.tallyobj.Tally, **kwargs) → tallypi.common.SingleTallyConfig[source]¶
Create a
SingleTallyConfig
from aTally
- property tally_key: Tuple[int, int]¶
A tuple of (
screen_index
,tally_index
) matching the format used fortslumd.tallyobj.Tally.id
If
screen_index
ortally_index
isNone
, they are set to 65535 (0xffff
)
- property is_broadcast_screen: bool¶
True
ifscreen_index
is set toNone
or the “broadcast” address of 65535 (0xffff
)
- property is_broadcast_tally: bool¶
True
iftally_index
is set toNone
or the “broadcast” address of 65535 (0xffff
)
- matches(other: Union[tslumd.tallyobj.Tally, tallypi.common.SingleTallyConfig, Tuple[int, int]], tally_type: Optional[tslumd.common.TallyType] = <TallyType.all_tally: 7>, return_matched: Optional[bool] = False) → Union[bool, tallypi.common.SingleTallyConfig][source]¶
Determine whether the given tally argument matches this one
For
screen_index
thematches_screen()
method is used- Parameters
other – Either another
SingleTallyConfig
, atslumd.tallyobj.Tally
instance or a TallyKeytally_type – If provided, a
TallyType
member (or members) to match againstreturn_matched – If False (the default), only return a boolean result, otherwise return the matched
SingleTallyConfig
if one was found.
- matches_screen(other: Union[tslumd.tallyobj.Tally, tallypi.common.SingleTallyConfig, tallypi.common.MultiTallyConfig, Tuple[int, int], int]) → bool[source]¶
Determine whether the
screen_index
matches the given argumentFor
tslumd.tallyobj.Tally
, thescreen's
is_broadcast
value is taken into account as well as cases wherescreen_index
is set toNone
- Parameters
other – A
SingleTallyConfig
,MultiTallyConfig
,tslumd.tallyobj.Tally
orint
- classmethod from_dict(d: Dict) → tallypi.common.SingleTallyConfig[source]¶
Create a
TallyConfig
from serialized data
- create_screen() → tslumd.tallyobj.Screen[source]¶
Create a
tslumd.tallyobj.Screen
with thescreen_index
of this object
- create_tally(screen: Optional[tslumd.tallyobj.Screen] = None) → Tuple[tslumd.tallyobj.Screen, tslumd.tallyobj.Tally][source]¶
Create a
tslumd.tallyobj.Tally
from this instance- Parameters
screen (tslumd.tallyobj.Screen, optional) – The parent
tslumd.tallyobj.Tally.screen
to add the tally to. If not provided, one will be created- Returns
screen (tslumd.tallyobj.Screen) – The parent screen that was either created or given as an argument
tally (tslumd.tallyobj.Tally) – The tally object
- class tallypi.common.MultiTallyConfig(tallies: Optional[dataclasses.InitVar] = None, screen_index: Optional[int] = None, allow_all: bool = False, name: Optional[str] = '')[source]¶
Bases:
tallypi.common.TallyConfig
Configuration for multiple tallies
- tallies: dataclasses.InitVar = None¶
A list of
SingleTallyConfig
instances
- screen_index: Optional[int] = None¶
The
index
of thetslumd.tallyobj.Screen
for the configuration ranging from 0 to 65534 (0xfffe
)This only takes effect if
allow_all
isTrue
and provides a method of filtering the tally assignments to a singletslumd.tallyobj.Screen
if desired.If not provided (or
None
), all tallies within all screens are considered to be members of the configuration. This is also the case if the value is 65535 (0xffff
), defined as the “broadcast” screen address.
- allow_all: bool = False¶
If
True
, all possible tally configurations exist within this instanceTallies can still be limited to a specific
screen_index
if desired
- property is_broadcast_screen: bool¶
True
ifscreen_index
is set toNone
or the “broadcast” address of 65535 (0xffff
)Note
Behavior is undefined if
allow_all
isFalse
- matches(tally: Union[tslumd.tallyobj.Tally, tallypi.common.SingleTallyConfig, Tuple[int, int]], tally_type: Optional[tslumd.common.TallyType] = <TallyType.all_tally: 7>, return_matched: Optional[bool] = False) → Union[bool, tallypi.common.SingleTallyConfig][source]¶
Alias for
contains()
- matches_screen(other: Union[tslumd.tallyobj.Tally, tallypi.common.SingleTallyConfig, tallypi.common.MultiTallyConfig, Tuple[int, int], int]) → bool[source]¶
Determine whether the
screen_index
matches the given argumentFor
tslumd.tallyobj.Tally
, thescreen's
is_broadcast
value is taken into account as well as cases wherescreen_index
is set toNone
- Parameters
other – A
SingleTallyConfig
,MultiTallyConfig
,tslumd.tallyobj.Tally
orint
Note
Behavior is undefined if
allow_all
isFalse
- contains(tally: Union[tslumd.tallyobj.Tally, tallypi.common.SingleTallyConfig, Tuple[int, int]], tally_type: Optional[tslumd.common.TallyType] = <TallyType.all_tally: 7>, return_matched: Optional[bool] = False) → Union[bool, tallypi.common.SingleTallyConfig][source]¶
Determine whether the given tally argument is included in this configuration
The
matches_screen()
method is used to match thescreen_index
. Ifallow_all
isFalse
, each object intallies
ischecked
- Parameters
tally – Either a
SingleTallyConfig
or atslumd.tallyobj.Tally
instance
- classmethod from_dict(d: Dict) → tallypi.common.MultiTallyConfig[source]¶
Create a
TallyConfig
from serialized data