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, makingAMBER
a combination ofRED
andGREEN
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.
- 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 ofrh_tally
,txt_tally
andlh_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
- txt_tally = 2
- lh_tally = 4
- 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
andall_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