Skip to content

Commit

Permalink
@mbridak Shutdown radio thread before closing.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbridak committed Oct 19, 2024
1 parent 6d5b5dd commit ba8ae19
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions not1mm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,15 @@ def closeEvent(self, _event) -> None:
self.settings.setValue("windowState", self.saveState())
self.settings.sync()

try: # Shutdown the radio thread.
if self.radio_thread.isRunning():
self.rig_control.time_to_quit = True
self.radio_thread.quit()
self.radio_thread.wait(1000)

except (RuntimeError, AttributeError):
...

cmd = {}
cmd["cmd"] = "HALT"
cmd["station"] = platform.node()
Expand Down Expand Up @@ -3088,17 +3097,18 @@ def callsign_changed(self) -> None:
self.show_help_dialog()
self.clearinputs()
return
if stripped_text == "TEST":
result = self.database.get_calls_and_bands()
cmd = {}
cmd["cmd"] = "WORKED"
cmd["station"] = platform.node()
cmd["worked"] = result
self.multicast_interface.send_as_json(cmd)
self.clearinputs()
return
# if stripped_text == "TEST":
# result = self.database.get_calls_and_bands()
# cmd = {}
# cmd["cmd"] = "WORKED"
# cmd["station"] = platform.node()
# cmd["worked"] = result
# self.multicast_interface.send_as_json(cmd)
# self.clearinputs()
# return
if self.is_floatable(stripped_text):
self.change_freq(stripped_text)
self.clearinputs()
return

cmd = {}
Expand Down Expand Up @@ -3187,9 +3197,9 @@ def change_mode(self, mode: str) -> None:
self.radio_state["mode"] = "CW"
band = getband(str(self.radio_state.get("vfoa", "0.0")))
self.set_band_indicator(band)
self.set_window_title()
self.clearinputs()
self.read_cw_macros()
self.set_window_title()
self.clearinputs()
self.read_cw_macros()
return
if mode == "RTTY":
if self.rig_control and self.rig_control.online:
Expand All @@ -3214,9 +3224,9 @@ def change_mode(self, mode: str) -> None:
self.setmode("SSB")
band = getband(str(self.radio_state.get("vfoa", "0.0")))
self.set_band_indicator(band)
self.set_window_title()
self.clearinputs()
self.read_cw_macros()
self.set_window_title()
self.clearinputs()
self.read_cw_macros()

def check_callsign(self, callsign) -> None:
"""
Expand Down

0 comments on commit ba8ae19

Please sign in to comment.