From 3d845adc61c3d20062af5b7618c71a55a2487da5 Mon Sep 17 00:00:00 2001 From: mbridak Date: Sat, 19 Oct 2024 07:32:09 -0700 Subject: [PATCH] @mbridak Add ESM to ARRL Field Day and Winter Field Day. --- CHANGELOG.md | 2 +- README.md | 4 +- not1mm/plugins/arrl_field_day.py | 91 ++++++++++++++++++++++++++++++ not1mm/plugins/winter_field_day.py | 91 ++++++++++++++++++++++++++++++ 4 files changed, 185 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efa1e8bd..cd310022 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -- [24-10-19] Change ESM button states when the run state is toggled. +- [24-10-19] Change ESM button states when the run state is toggled. Add ESM to ARRL Field Day and Winter Field Day. - [24-10-18] Fixed marked spots showing the correct time. - [24-10-17-2] Add ESM to ARRL Sweepstakes. - [24-10-17-1] Fix dupe check. Reordered change mode and interface update sequence. Resend mode if rigctld does not report back `RPRT 0` diff --git a/README.md b/README.md index ffd70653..ff693995 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ generated, 'cause I'm lazy, list of those who've submitted PR's. - ARRL 10M - ARRL DX CW, SSB - ARRL Field Day -- ARRL Sweepstakes CW, SSB +- .ARRL Sweepstakes CW, SSB - ARRL VHF January, June, September - CQ 160 CW, SSB - .CQ WPX CW, RTTY, SSB @@ -200,7 +200,7 @@ generated, 'cause I'm lazy, list of those who've submitted PR's. ## Recent Changes -- [24-10-19] Change ESM button states when the run state is toggled. +- [24-10-19] Change ESM button states when the run state is toggled. Add ESM to ARRL Field Day and Winter Field Day. - [24-10-18] Fixed marked spots showing the correct time. - [24-10-17-2] Add ESM to ARRL Sweepstakes. - [24-10-17-1] Fix dupe check. Reordered change mode and interface update sequence. Resend mode if rigctld does not report back `RPRT 0` diff --git a/not1mm/plugins/arrl_field_day.py b/not1mm/plugins/arrl_field_day.py index 6d173d9f..998b5a29 100644 --- a/not1mm/plugins/arrl_field_day.py +++ b/not1mm/plugins/arrl_field_day.py @@ -401,3 +401,94 @@ def ft8_handler(the_packet: dict): ALTEREGO.other_1.setText(the_packet.get("CLASS", "ERR")) ALTEREGO.other_2.setText(the_packet.get("ARRL_SECT", "ERR")) ALTEREGO.save_contact() + + +def process_esm(self, new_focused_widget=None, with_enter=False): + """ESM State Machine""" + + # self.pref["run_state"] + + # -----===== Assigned F-Keys =====----- + # self.esm_dict["CQ"] + # self.esm_dict["EXCH"] + # self.esm_dict["QRZ"] + # self.esm_dict["AGN"] + # self.esm_dict["HISCALL"] + # self.esm_dict["MYCALL"] + # self.esm_dict["QSOB4"] + + # ----==== text fields ====---- + # self.callsign + # self.sent + # self.receive + # self.other_1 + # self.other_2 + + if new_focused_widget is not None: + self.current_widget = self.inputs_dict.get(new_focused_widget) + + # print(f"checking esm {self.current_widget=} {with_enter=} {self.pref.get("run_state")=}") + + for a_button in [ + self.esm_dict["CQ"], + self.esm_dict["EXCH"], + self.esm_dict["QRZ"], + self.esm_dict["AGN"], + self.esm_dict["HISCALL"], + self.esm_dict["MYCALL"], + self.esm_dict["QSOB4"], + ]: + if a_button is not None: + self.restore_button_color(a_button) + + buttons_to_send = [] + + if self.pref.get("run_state"): + if self.current_widget == "callsign": + if len(self.callsign.text()) < 3: + self.make_button_green(self.esm_dict["CQ"]) + buttons_to_send.append(self.esm_dict["CQ"]) + elif len(self.callsign.text()) > 2: + self.make_button_green(self.esm_dict["HISCALL"]) + self.make_button_green(self.esm_dict["EXCH"]) + buttons_to_send.append(self.esm_dict["HISCALL"]) + buttons_to_send.append(self.esm_dict["EXCH"]) + + elif self.current_widget in ["other_1", "other_2"]: + if self.other_1.text() == "" or self.other_2.text() == "": + self.make_button_green(self.esm_dict["AGN"]) + buttons_to_send.append(self.esm_dict["AGN"]) + else: + self.make_button_green(self.esm_dict["QRZ"]) + buttons_to_send.append(self.esm_dict["QRZ"]) + buttons_to_send.append("LOGIT") + + if with_enter is True and bool(len(buttons_to_send)): + for button in buttons_to_send: + if button: + if button == "LOGIT": + self.save_contact() + continue + self.process_function_key(button) + else: + if self.current_widget == "callsign": + if len(self.callsign.text()) > 2: + self.make_button_green(self.esm_dict["MYCALL"]) + buttons_to_send.append(self.esm_dict["MYCALL"]) + + elif self.current_widget in ["other_1", "other_2"]: + if self.other_1.text() == "" or self.other_2.text() == "": + self.make_button_green(self.esm_dict["AGN"]) + buttons_to_send.append(self.esm_dict["AGN"]) + else: + self.make_button_green(self.esm_dict["EXCH"]) + buttons_to_send.append(self.esm_dict["EXCH"]) + buttons_to_send.append("LOGIT") + + if with_enter is True and bool(len(buttons_to_send)): + for button in buttons_to_send: + if button: + if button == "LOGIT": + self.save_contact() + continue + self.process_function_key(button) diff --git a/not1mm/plugins/winter_field_day.py b/not1mm/plugins/winter_field_day.py index 17db163e..86f4da02 100644 --- a/not1mm/plugins/winter_field_day.py +++ b/not1mm/plugins/winter_field_day.py @@ -321,3 +321,94 @@ def cabrillo(self): def recalculate_mults(self): """Recalculates multipliers after change in logged qso.""" + + +def process_esm(self, new_focused_widget=None, with_enter=False): + """ESM State Machine""" + + # self.pref["run_state"] + + # -----===== Assigned F-Keys =====----- + # self.esm_dict["CQ"] + # self.esm_dict["EXCH"] + # self.esm_dict["QRZ"] + # self.esm_dict["AGN"] + # self.esm_dict["HISCALL"] + # self.esm_dict["MYCALL"] + # self.esm_dict["QSOB4"] + + # ----==== text fields ====---- + # self.callsign + # self.sent + # self.receive + # self.other_1 + # self.other_2 + + if new_focused_widget is not None: + self.current_widget = self.inputs_dict.get(new_focused_widget) + + # print(f"checking esm {self.current_widget=} {with_enter=} {self.pref.get("run_state")=}") + + for a_button in [ + self.esm_dict["CQ"], + self.esm_dict["EXCH"], + self.esm_dict["QRZ"], + self.esm_dict["AGN"], + self.esm_dict["HISCALL"], + self.esm_dict["MYCALL"], + self.esm_dict["QSOB4"], + ]: + if a_button is not None: + self.restore_button_color(a_button) + + buttons_to_send = [] + + if self.pref.get("run_state"): + if self.current_widget == "callsign": + if len(self.callsign.text()) < 3: + self.make_button_green(self.esm_dict["CQ"]) + buttons_to_send.append(self.esm_dict["CQ"]) + elif len(self.callsign.text()) > 2: + self.make_button_green(self.esm_dict["HISCALL"]) + self.make_button_green(self.esm_dict["EXCH"]) + buttons_to_send.append(self.esm_dict["HISCALL"]) + buttons_to_send.append(self.esm_dict["EXCH"]) + + elif self.current_widget in ["other_1", "other_2"]: + if self.other_1.text() == "" or self.other_2.text() == "": + self.make_button_green(self.esm_dict["AGN"]) + buttons_to_send.append(self.esm_dict["AGN"]) + else: + self.make_button_green(self.esm_dict["QRZ"]) + buttons_to_send.append(self.esm_dict["QRZ"]) + buttons_to_send.append("LOGIT") + + if with_enter is True and bool(len(buttons_to_send)): + for button in buttons_to_send: + if button: + if button == "LOGIT": + self.save_contact() + continue + self.process_function_key(button) + else: + if self.current_widget == "callsign": + if len(self.callsign.text()) > 2: + self.make_button_green(self.esm_dict["MYCALL"]) + buttons_to_send.append(self.esm_dict["MYCALL"]) + + elif self.current_widget in ["other_1", "other_2"]: + if self.other_1.text() == "" or self.other_2.text() == "": + self.make_button_green(self.esm_dict["AGN"]) + buttons_to_send.append(self.esm_dict["AGN"]) + else: + self.make_button_green(self.esm_dict["EXCH"]) + buttons_to_send.append(self.esm_dict["EXCH"]) + buttons_to_send.append("LOGIT") + + if with_enter is True and bool(len(buttons_to_send)): + for button in buttons_to_send: + if button: + if button == "LOGIT": + self.save_contact() + continue + self.process_function_key(button)