tslumd.sender
- class tslumd.sender.UmdSender(*args, **kwargs)[source]
Bases:
Dispatcher
Send UMD Messages
Messages are sent immediately when a change is made to any of the
Tally
objects intallies
. These can be added by using theadd_tally()
method.Alternatively, the
set_tally_color()
andset_tally_text()
methods may be used.- Parameters:
clients – Intitial value for
clients
all_off_on_close – Initial value for
all_off_on_close
Changed in version 0.0.4: The
all_off_on_close
parameter was added- all_off_on_close: bool
If
True
, a broadcast message will be sent before shutdown to turn off all tally lights in the system. (default isFalse
)New in version 0.0.4.
- tallies: dict[Tuple[int, int], Tally]
Mapping of
Tally
objects by theirid
Note
This should not be altered directly. Use
add_tally()
instead
- async send_scontrol(screen_index: int, data: bytes)[source]
Send an
SCONTROL
message- Parameters:
New in version 0.0.2.
- async send_broadcast_scontrol(data: bytes)[source]
Send a
broadcast
SCONTROL
message- Parameters:
data – The data to send in the
scontrol
field
New in version 0.0.2.
- add_tally(tally_id: Tuple[int, int], **kwargs) Tally [source]
Create a
Tally
object and add it totallies
if one does not existIf necessary, creates a
Screen
usingget_or_create_screen()
- Parameters:
tally_id – A tuple of (
screen_index
,tally_index
)**kwargs – Keyword arguments passed to create the tally instance
- Raises:
KeyError – If the given
tally_id
already exists
Changed in version 0.0.3: Chaned the
tally_index
parameter totally_id
- get_or_create_tally(tally_id: Tuple[int, int]) Tally [source]
If a
Tally
object matching the given tally id exists, return it. Otherwise, create it usingScreen.get_or_create_tally()
This method is similar to
add_tally()
and it can be used to avoid exception handling. It does not however take keyword arguments and is only intended for object creation.New in version 0.0.3.
- get_or_create_screen(index_: int) Screen [source]
Create a
Screen
object and add it toscreens
- Parameters:
index – The screen
index
- Raises:
KeyError – If the given
index_
already exists
New in version 0.0.3.
- set_tally_color(tally_id: Tuple[int, int], tally_type: str | TallyType, color: str | TallyColor)[source]
Set the tally color for the given index and tally type
Uses
Tally.set_color()
. See the method documentation for details- Parameters:
tally_id (TallyKey) – A tuple of (
screen_index
,tally_index
)tally_type (TallyType or str) –
TallyType
or member name as described inTally.set_color()
color (TallyColor or str) –
TallyColor
or color name as described inTally.set_color()
Changed in version 0.0.3: Chaned the
tally_index
parameter totally_id
Changed in version 0.0.5: Accept string arguments and match behavior of
Tally.set_color()
- set_tally_text(tally_id: Tuple[int, int], text: str)[source]
Set the tally text for the given id
- Parameters:
tally_id – A tuple of (
screen_index
,tally_index
)text – The
text
to set
Changed in version 0.0.3: Chaned the
tally_index
parameter totally_id
- async send_tally_control(tally_id: Tuple[int, int], data: bytes)[source]
Send
control
data for the given screen and tally index- Parameters:
tally_id – A tuple of (
screen_index
,tally_index
)control – The control data to send
New in version 0.0.2.
Changed in version 0.0.3: Chaned the
tally_index
parameter totally_id
- async send_broadcast_tally_control(screen_index: int, data: bytes, **kwargs)[source]
Send
control
data asbroadcast
to all listening displays- Parameters:
screen_index – The screen
index
**kwargs – Additional keyword arguments to pass to the
Tally
constructor
New in version 0.0.2.
Changed in version 0.0.3: Added the screen_index parameter
- async send_broadcast_tally(screen_index: int, **kwargs)[source]
Send a
broadcast
update to all listening displays- Parameters:
screen_index – The screen
index
**kwargs – The keyword arguments to pass to the
Tally
constructor
New in version 0.0.2.
Changed in version 0.0.3: Added the screen_index parameter