From 44c04c06319cb82a2d9ef2ad4a44da133381f302 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 6 Jun 2021 18:29:57 +0200 Subject: Improve automute and switching --- sw/eval-clock-cw-tx/gui.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sw') 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) -- cgit v1.2.3