diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-06-06 18:29:57 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-06-06 18:29:57 +0200 |
commit | 44c04c06319cb82a2d9ef2ad4a44da133381f302 (patch) | |
tree | 0cc8bd38870ebe28138a9a1acc1f5a418b61cf35 | |
parent | 28c0ca2514219752c2f045d0933d5aad13a08f0b (diff) | |
download | picardy-44c04c06319cb82a2d9ef2ad4a44da133381f302.tar.gz picardy-44c04c06319cb82a2d9ef2ad4a44da133381f302.tar.bz2 picardy-44c04c06319cb82a2d9ef2ad4a44da133381f302.zip |
Improve automute and switching
-rwxr-xr-x | sw/eval-clock-cw-tx/gui.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sw/eval-clock-cw-tx/gui.py b/sw/eval-clock-cw-tx/gui.py index 2e268e1..5b39ccb 100755 --- a/sw/eval-clock-cw-tx/gui.py +++ b/sw/eval-clock-cw-tx/gui.py @@ -60,9 +60,9 @@ class GUI(Frame): if self.last_serial_message.endswith(b"\n"): print(f"< {self.last_serial_message.decode().strip()}") self.set_status(f"Received: {self.last_serial_message.decode().strip()}") - if self.last_serial_message == b"Switch RX\n": + if self.last_serial_message == b"Switch RX\n" and self.enable_mute.get(): os.system("pactl set-sink-mute 0 0") - elif self.last_serial_message == b"Switch TX\n": + elif self.last_serial_message == b"Switch TX\n" and self.enable_mute.get(): os.system("pactl set-sink-mute 0 1") elif self.last_serial_message.startswith(b"FH sent"): self.send_serial(b'rx\n') @@ -104,10 +104,10 @@ class GUI(Frame): def terminate(self): print("Terminate: send RX") - self.toggle_to_rx() + self.send_serial(b'rx\n') def toggle_to_rx(self): - self.send_serial(b'rx\n') + self.root.after(1000, self.send_serial, b'rx\n') def load_macro(self, i): self.tx_message.set(self.macro_widgets[i]["var"].get()) @@ -127,7 +127,7 @@ class GUI(Frame): def send_tx_message(self): msg = self.tx_message.get() print(f"TX and Send '{msg}'") - self.send_serial('tx\nm{}\n'.format(msg).encode("ascii")) + self.send_serial('tx\nm {} \n'.format(msg).encode("ascii")) def create_widgets(self): self.root.columnconfigure(0, weight=1) @@ -169,8 +169,11 @@ class GUI(Frame): self.gqrx_frame = Frame(self.control_frame, borderwidth=1, relief="ridge") self.gqrx_frame.grid(column=0, row=1, sticky=(N, S, E, W)) self.enable_freq_sync = IntVar() + self.enable_mute = IntVar() self.gqrx_checkbutton = Checkbutton(self.gqrx_frame, text="Sync", variable=self.enable_freq_sync) self.gqrx_checkbutton.grid(column=0, row=0, columnspan=1) + self.mute_on_tx_checkbutton = Checkbutton(self.gqrx_frame, text="Mute on TX", variable=self.enable_mute) + self.mute_on_tx_checkbutton.grid(column=1, row=0, columnspan=1) self.gqrx_freq_label = Label(self.gqrx_frame, text="Frequency") self.gqrx_freq_label.grid(column=0, row=1) |