tslumd.common

class tslumd.common.TallyColor(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

Color enum for tally indicators

Since this is an IntFlag, its members can be combined using bitwise operators, making AMBER a combination of RED and GREEN

This allows merging one color with another

>>> from tslumd import TallyColor
>>> TallyColor.RED
<TallyColor.RED: 1>
>>> TallyColor.GREEN
<TallyColor.GREEN: 2>
>>> TallyColor.AMBER
<TallyColor.AMBER: 3>
>>> TallyColor.RED | TallyColor.GREEN
<TallyColor.AMBER: 3>

Changed in version 0.0.4: Bitwise operators

OFF = 0

Off

RED = 1

Red

GREEN = 2

Green

AMBER = 3

Amber

static from_str(s: str) TallyColor[source]

Return the member matching the given name (case-insensitive)

>>> TallyColor.from_str('RED')
<TallyColor.RED: 1>
>>> TallyColor.from_str('green')
<TallyColor.GREEN: 2>
>>> TallyColor.from_str('Amber')
<TallyColor.AMBER: 3>

New in version 0.0.5.

to_str() str[source]

The member name as a string

>>> TallyColor.RED.to_str()
'RED'
>>> TallyColor.GREEN.to_str()
'GREEN'
>>> TallyColor.AMBER.to_str()
'AMBER'
>>> (TallyColor.RED | TallyColor.GREEN).to_str()
'AMBER'

New in version 0.0.5.

classmethod all()[source]

Iterate over all members

New in version 0.0.6.

class tslumd.common.TallyType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

Enum for the three tally display types in the UMD protocol

Since this is an IntFlag, its members can be combined using bitwise operators. The members can then be iterated over to retrieve the individual “concrete” values of rh_tally, txt_tally and lh_tally

>>> from tslumd import TallyType
>>> list(TallyType.rh_tally)
[<TallyType.rh_tally: 1>]
>>> list(TallyType.rh_tally | TallyType.txt_tally)
[<TallyType.rh_tally: 1>, <TallyType.txt_tally: 2>]
>>> list(TallyType.all_tally)
[<TallyType.rh_tally: 1>, <TallyType.txt_tally: 2>, <TallyType.lh_tally: 4>]

Changed in version 0.0.4: Added support for bitwise operators and member iteration

no_tally = 0

No-op

rh_tally = 1

Right-hand tally

txt_tally = 2

Text tally

lh_tally = 4

Left-hand tally

all_tally = 7

Combination of all tally types

New in version 0.0.4.

classmethod all() Iterator[TallyType][source]

Iterate over all members, excluding no_tally and all_tally

New in version 0.0.4.

static from_str(s: str) TallyType[source]

Create an instance from a string of member name(s)

The string can be a single member or multiple member names separated by a “|”. For convenience, the names may be shortened by omitting the "_tally" portion from the end (“rh” == “rh_tally”, etc)

>>> TallyType.from_str('rh_tally')
<TallyType.rh_tally: 1>
>>> TallyType.from_str('rh|txt_tally')
<TallyType.rh_tally|txt_tally: 3>
>>> TallyType.from_str('rh|txt|lh')
<TallyType.all_tally: 7>
>>> TallyType.from_str('all')
<TallyType.all_tally: 7>

New in version 0.0.5.

to_str() str[source]

Create a string representation suitable for use in from_str()

>>> tt = TallyType.rh_tally
>>> tt.to_str()
'rh_tally'
>>> tt |= TallyType.txt_tally
>>> tt.to_str()
'rh_tally|txt_tally'
>>> tt |= TallyType.lh_tally
>>> tt.to_str()
'all_tally'

New in version 0.0.5.

class tslumd.common.TallyState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

OFF = 0

Off

PREVIEW = 1

Preview

PROGRAM = 2

Program

class tslumd.common.MessageType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Message type

New in version 0.0.2.

display = 1

A message containing tally display information

control = 2

A message containing control data

tslumd.common.TallyKey

A tuple of (screen_index, tally_index) to uniquely identify a single Tally within its Screen

alias of Tuple[int, int]