From 4c0c4b43ff373189125e79cd460519d16f9ceb5a Mon Sep 17 00:00:00 2001 From: sbahling Date: Sun, 7 Jun 2020 18:06:01 +0200 Subject: Change rest of "status" references to "state". --- tascam_fw_console/console.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'tascam_fw_console/console.py') diff --git a/tascam_fw_console/console.py b/tascam_fw_console/console.py index 666bdf6..73e9b78 100644 --- a/tascam_fw_console/console.py +++ b/tascam_fw_console/console.py @@ -43,26 +43,26 @@ ENCODER_MODES = ['PAN', 'AUX1', 'AUX2', 'AUX3', 'AUX4', 'AUX5', 'AUX6', 'AUX7', 'AUX8'] -class ConsoleStatus(): +class ConsoleState(): def __init__(self, quadlets): self.quadlets = quadlets def field(self, index, first_bit=0, last_bit=32): bits = self.quadlets[index] - # reverse the bit order before slicing so the index '0' is the LSB + # reverse the bit order before slicing so that index '0' is the LSB # and reverse back before converting to int return int(bits32(bits)[::-1][first_bit-1:last_bit][::-1], 2) -class RunningStatusThread(): +class RunningStateThread(): def __init__(self, console, interval=0.1): - """ Background thread that will poll the console status data and + """ Background thread that will poll the console state data and pass it to all objects in the callbacks set. If the callback set is empty, polling doesn't happen. - Objects added to the callback set must have a status_callback() - method, a status_quadlet attribute containing the index of the - quadlet of interest, and a status_bits attribute containing a 2 member + Objects added to the callback set must have a state_callback() + method, a state_quadlet attribute containing the index of the + quadlet of interest, and a state_bits attribute containing a 2 member iterable with the start and end bits of the quadlet of interest. :param console: Console object @@ -87,10 +87,10 @@ class RunningStatusThread(): def run(self): while True: for obj in self.callbacks: - value = self.console.status.field(obj.status_quadlet, - *obj.status_bits, - ) - obj.status_callback(value) + value = self.console.state.field(obj.state_quadlet, + *obj.state_bits, + ) + obj.state_callback(value) time.sleep(self.interval) @@ -146,7 +146,7 @@ class Console(): self.unit.set_master_fader(False) self.unit.connect('control', self.handle_control) - self.status_thread = RunningStatusThread(self) # noqa F841 + self.state_thread = RunningStateThread(self) # noqa F841 def init_strips(self): self.strips = [] -- cgit v1.2.3