not1mm 25.4.10.1__py3-none-any.whl → 25.4.11.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,668 @@
1
+ """SAC CW plugin"""
2
+
3
+ # pylint: disable=invalid-name, c-extension-no-member, unused-import
4
+
5
+
6
+ import datetime
7
+ import logging
8
+
9
+ # import time
10
+ # from not1mm.lib.ham_utility import get_logged_band
11
+ from pathlib import Path
12
+
13
+ from PyQt6 import QtWidgets
14
+
15
+ from not1mm.lib.plugin_common import gen_adif, get_points, online_score_xml
16
+ from not1mm.lib.version import __version__
17
+
18
+ logger = logging.getLogger(__name__)
19
+
20
+ EXCHANGE_HINT = "#"
21
+
22
+ name = "SAC CW"
23
+ cabrillo_name = "SAC-CW"
24
+ mode = "CW" # CW SSB BOTH RTTY
25
+ # columns = [0, 1, 2, 3, 4, 5, 6, 9, 11, 15]
26
+ columns = [
27
+ "YYYY-MM-DD HH:MM:SS",
28
+ "Call",
29
+ "Freq",
30
+ "Snt",
31
+ "Rcv",
32
+ "SentNr",
33
+ "RcvNr",
34
+ "PTS",
35
+ ]
36
+
37
+ advance_on_space = [True, True, True, True, True]
38
+
39
+ # 1 once per contest, 2 work each band, 3 each band/mode, 4 no dupe checking
40
+ dupe_type = 2
41
+
42
+ scandinavian_prefixes = [
43
+ "JW",
44
+ "JX",
45
+ "LA",
46
+ "LB",
47
+ "LC",
48
+ "LG",
49
+ "LI",
50
+ "LJ",
51
+ "LN",
52
+ "OF",
53
+ "OG",
54
+ "OH",
55
+ "OI",
56
+ "OFØ",
57
+ "OGØ",
58
+ "OHØ",
59
+ "OJØ",
60
+ "OX",
61
+ "XP",
62
+ "OW",
63
+ "OY",
64
+ "5P",
65
+ "5Q",
66
+ "OU",
67
+ "OV",
68
+ "OZ",
69
+ "7S",
70
+ "8S",
71
+ "SA",
72
+ "SB",
73
+ "SC",
74
+ "SD",
75
+ "SE",
76
+ "SF",
77
+ "SG",
78
+ "SH",
79
+ "SI",
80
+ "SJ",
81
+ "SK",
82
+ "SL",
83
+ "SM",
84
+ "TF",
85
+ ]
86
+
87
+
88
+ def init_contest(self):
89
+ """setup plugin"""
90
+ set_tab_next(self)
91
+ set_tab_prev(self)
92
+ interface(self)
93
+ self.next_field = self.other_2
94
+
95
+
96
+ def interface(self):
97
+ """Setup user interface"""
98
+ self.field1.show()
99
+ self.field2.show()
100
+ self.field3.show()
101
+ self.field4.show()
102
+ self.snt_label.setText("SNT")
103
+ self.field1.setAccessibleName("RST Sent")
104
+ self.other_label.setText("SentNR")
105
+ self.field3.setAccessibleName("Sent Number")
106
+ self.exch_label.setText("RcvNR")
107
+ self.field4.setAccessibleName("Received Number")
108
+
109
+
110
+ def reset_label(self): # pylint: disable=unused-argument
111
+ """reset label after field cleared"""
112
+
113
+
114
+ def set_tab_next(self):
115
+ """Set TAB Advances"""
116
+ self.tab_next = {
117
+ self.callsign: self.sent,
118
+ self.sent: self.receive,
119
+ self.receive: self.other_1,
120
+ self.other_1: self.other_2,
121
+ self.other_2: self.callsign,
122
+ }
123
+
124
+
125
+ def set_tab_prev(self):
126
+ """Set TAB Advances"""
127
+ self.tab_prev = {
128
+ self.callsign: self.other_2,
129
+ self.sent: self.callsign,
130
+ self.receive: self.sent,
131
+ self.other_1: self.receive,
132
+ self.other_2: self.other_1,
133
+ }
134
+
135
+
136
+ def set_contact_vars(self):
137
+ """Contest Specific"""
138
+ self.contact["SNT"] = self.sent.text()
139
+ self.contact["RCV"] = self.receive.text()
140
+ self.contact["SentNr"] = self.other_1.text()
141
+ self.contact["NR"] = self.other_2.text()
142
+
143
+
144
+ def predupe(self): # pylint: disable=unused-argument
145
+ """called after callsign entered"""
146
+
147
+
148
+ def prefill(self):
149
+ """Fill SentNR"""
150
+ result = self.database.get_serial()
151
+ serial_nr = str(result.get("serial_nr", "1")).zfill(3)
152
+ if serial_nr == "None":
153
+ serial_nr = "001"
154
+ if len(self.other_1.text()) == 0:
155
+ self.other_1.setText(serial_nr)
156
+
157
+
158
+ def points(self):
159
+ """Calc point"""
160
+ # 7.1 For Scandinavian stations:
161
+ # EUROPEAN stations, outside Scandinavia, are worth two (2) points for every complete QSO.
162
+ # NON-EUROPEAN stations are worth three (3) points for every complete QSO.
163
+ # 7.2 For non-Scandinavian stations:
164
+ # EUROPEAN stations receive one (1) point for every complete Scandinavian QSO.
165
+ # NON-EUROPEAN stations receive one (1) point for every complete Scandinavian QSO on
166
+ # 14, 21, and 28 MHz and three (3) points for every complete QSO on 3.5 and 7 MHz.
167
+
168
+ if self.contact_is_dupe > 0:
169
+ return 0
170
+
171
+ myprimary_pfx = ""
172
+ mycontinent = ""
173
+ hisprimary_pfx = ""
174
+ hiscontinent = ""
175
+
176
+ result = self.cty_lookup(self.station.get("Call", ""))
177
+ if result:
178
+ for item in result.items():
179
+ myprimary_pfx = item[1].get("primary_pfx", "")
180
+ mycontinent = item[1].get("continent", "")
181
+
182
+ result = self.cty_lookup(self.contact.get("Call", ""))
183
+ if result:
184
+ for item in result.items():
185
+ hisprimary_pfx = item[1].get("primary_pfx", "")
186
+ hiscontinent = item[1].get("continent", "")
187
+
188
+ if (
189
+ myprimary_pfx in scandinavian_prefixes
190
+ and hisprimary_pfx not in scandinavian_prefixes
191
+ ):
192
+ if hiscontinent == "EU":
193
+ return 2
194
+ return 3
195
+ if (
196
+ myprimary_pfx not in scandinavian_prefixes
197
+ and hisprimary_pfx in scandinavian_prefixes
198
+ ):
199
+ if mycontinent == "EU":
200
+ return 1
201
+ if self.contact.get("Band", 0) in ["3.5", "7"]:
202
+ return 3
203
+ if self.contact.get("Band", 0) in ["14", "21", "28"]:
204
+ return 1
205
+
206
+ # Something wrong
207
+ return 0
208
+
209
+
210
+ def show_mults(self):
211
+ """Return display string for mults"""
212
+ myprimary_pfx = ""
213
+ mult_count = 0
214
+
215
+ result = self.cty_lookup(self.station.get("Call", ""))
216
+ if result:
217
+ for item in result.items():
218
+ myprimary_pfx = item[1].get("primary_pfx", "")
219
+
220
+ if myprimary_pfx in scandinavian_prefixes:
221
+ result = self.database.fetch_country_band_count()
222
+ mult_count = result.get("cb_count", 0)
223
+ else:
224
+ query = f"SELECT count(DISTINCT(CountryPrefix || ':' || substr(WPXPrefix,3,1) || ':' || Band)) as mults from DXLOG where ContestNR = {self.pref.get('contest', '1')} AND CountryPrefix IN ('JW', 'JX', 'LA', 'LB', 'LC', 'LG', 'LI', 'LJ' , 'LN', 'OF', 'OG', 'OH', 'OI', 'OFØ', 'OGØ', 'OHØ', 'OJØ', 'OX', 'XP', 'OW', 'OY', '5P', '5Q', 'OU', 'OV', 'OZ', '7S', '8S', 'SA', 'SB', 'SC', 'SD', 'SE', 'SF', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'TF');"
225
+ result = self.database.exec_sql(query)
226
+ mult_count = result.get("mults", 0)
227
+ return mult_count
228
+
229
+
230
+ def show_qso(self):
231
+ """Return qso count"""
232
+ result = self.database.fetch_qso_count()
233
+ if result:
234
+ return int(result.get("qsos", 0))
235
+ return 0
236
+
237
+
238
+ def calc_score(self):
239
+ """Return calculated score"""
240
+ result = self.database.fetch_points()
241
+ if result is not None:
242
+ score = result.get("Points", "0")
243
+ if score is None:
244
+ score = "0"
245
+ contest_points = int(score)
246
+ mults = show_mults(self)
247
+ return contest_points * mults
248
+ return 0
249
+
250
+
251
+ def adif(self):
252
+ """Call the generate ADIF function"""
253
+ gen_adif(self, cabrillo_name, "SAC-CW")
254
+
255
+
256
+ def output_cabrillo_line(line_to_output, ending, file_descriptor, file_encoding):
257
+ """"""
258
+ print(
259
+ line_to_output.encode(file_encoding, errors="ignore").decode(),
260
+ end=ending,
261
+ file=file_descriptor,
262
+ )
263
+
264
+
265
+ def cabrillo(self, file_encoding):
266
+ """Generates Cabrillo file. Maybe."""
267
+ # https://www.cqwpx.com/cabrillo.htm
268
+ logger.debug("******Cabrillo*****")
269
+ logger.debug("Station: %s", f"{self.station}")
270
+ logger.debug("Contest: %s", f"{self.contest_settings}")
271
+ now = datetime.datetime.now()
272
+ date_time = now.strftime("%Y-%m-%d_%H-%M-%S")
273
+ filename = (
274
+ str(Path.home())
275
+ + "/"
276
+ + f"{self.station.get('Call', '').upper()}_{cabrillo_name}_{date_time}.log"
277
+ )
278
+ logger.debug("%s", filename)
279
+ log = self.database.fetch_all_contacts_asc()
280
+ try:
281
+ with open(filename, "w", encoding=file_encoding, newline="") as file_descriptor:
282
+ output_cabrillo_line(
283
+ "START-OF-LOG: 3.0",
284
+ "\r\n",
285
+ file_descriptor,
286
+ file_encoding,
287
+ )
288
+ output_cabrillo_line(
289
+ f"CREATED-BY: Not1MM v{__version__}",
290
+ "\r\n",
291
+ file_descriptor,
292
+ file_encoding,
293
+ )
294
+ output_cabrillo_line(
295
+ f"CONTEST: {cabrillo_name}",
296
+ "\r\n",
297
+ file_descriptor,
298
+ file_encoding,
299
+ )
300
+ if self.station.get("Club", ""):
301
+ output_cabrillo_line(
302
+ f"CLUB: {self.station.get('Club', '').upper()}",
303
+ "\r\n",
304
+ file_descriptor,
305
+ file_encoding,
306
+ )
307
+ output_cabrillo_line(
308
+ f"CALLSIGN: {self.station.get('Call','')}",
309
+ "\r\n",
310
+ file_descriptor,
311
+ file_encoding,
312
+ )
313
+ output_cabrillo_line(
314
+ f"LOCATION: {self.station.get('ARRLSection', '')}",
315
+ "\r\n",
316
+ file_descriptor,
317
+ file_encoding,
318
+ )
319
+ output_cabrillo_line(
320
+ f"CATEGORY-OPERATOR: {self.contest_settings.get('OperatorCategory','')}",
321
+ "\r\n",
322
+ file_descriptor,
323
+ file_encoding,
324
+ )
325
+ output_cabrillo_line(
326
+ f"CATEGORY-ASSISTED: {self.contest_settings.get('AssistedCategory','')}",
327
+ "\r\n",
328
+ file_descriptor,
329
+ file_encoding,
330
+ )
331
+ output_cabrillo_line(
332
+ f"CATEGORY-BAND: {self.contest_settings.get('BandCategory','')}",
333
+ "\r\n",
334
+ file_descriptor,
335
+ file_encoding,
336
+ )
337
+ mode = self.contest_settings.get("ModeCategory", "")
338
+ if mode in ["SSB+CW", "SSB+CW+DIGITAL"]:
339
+ mode = "MIXED"
340
+ output_cabrillo_line(
341
+ f"CATEGORY-MODE: {mode}",
342
+ "\r\n",
343
+ file_descriptor,
344
+ file_encoding,
345
+ )
346
+ output_cabrillo_line(
347
+ f"CATEGORY-TRANSMITTER: {self.contest_settings.get('TransmitterCategory','')}",
348
+ "\r\n",
349
+ file_descriptor,
350
+ file_encoding,
351
+ )
352
+ if self.contest_settings.get("OverlayCategory", "") != "N/A":
353
+ output_cabrillo_line(
354
+ f"CATEGORY-OVERLAY: {self.contest_settings.get('OverlayCategory','')}",
355
+ "\r\n",
356
+ file_descriptor,
357
+ file_encoding,
358
+ )
359
+ output_cabrillo_line(
360
+ f"GRID-LOCATOR: {self.station.get('GridSquare','')}",
361
+ "\r\n",
362
+ file_descriptor,
363
+ file_encoding,
364
+ )
365
+ output_cabrillo_line(
366
+ f"CATEGORY-POWER: {self.contest_settings.get('PowerCategory','')}",
367
+ "\r\n",
368
+ file_descriptor,
369
+ file_encoding,
370
+ )
371
+
372
+ output_cabrillo_line(
373
+ f"CLAIMED-SCORE: {calc_score(self)}",
374
+ "\r\n",
375
+ file_descriptor,
376
+ file_encoding,
377
+ )
378
+ ops = f"@{self.station.get('Call','')}"
379
+ list_of_ops = self.database.get_ops()
380
+ for op in list_of_ops:
381
+ ops += f", {op.get('Operator', '')}"
382
+ output_cabrillo_line(
383
+ f"OPERATORS: {ops}",
384
+ "\r\n",
385
+ file_descriptor,
386
+ file_encoding,
387
+ )
388
+ output_cabrillo_line(
389
+ f"NAME: {self.station.get('Name', '')}",
390
+ "\r\n",
391
+ file_descriptor,
392
+ file_encoding,
393
+ )
394
+ output_cabrillo_line(
395
+ f"ADDRESS: {self.station.get('Street1', '')}",
396
+ "\r\n",
397
+ file_descriptor,
398
+ file_encoding,
399
+ )
400
+ output_cabrillo_line(
401
+ f"ADDRESS-CITY: {self.station.get('City', '')}",
402
+ "\r\n",
403
+ file_descriptor,
404
+ file_encoding,
405
+ )
406
+ output_cabrillo_line(
407
+ f"ADDRESS-STATE-PROVINCE: {self.station.get('State', '')}",
408
+ "\r\n",
409
+ file_descriptor,
410
+ file_encoding,
411
+ )
412
+ output_cabrillo_line(
413
+ f"ADDRESS-POSTALCODE: {self.station.get('Zip', '')}",
414
+ "\r\n",
415
+ file_descriptor,
416
+ file_encoding,
417
+ )
418
+ output_cabrillo_line(
419
+ f"ADDRESS-COUNTRY: {self.station.get('Country', '')}",
420
+ "\r\n",
421
+ file_descriptor,
422
+ file_encoding,
423
+ )
424
+ output_cabrillo_line(
425
+ f"EMAIL: {self.station.get('Email', '')}",
426
+ "\r\n",
427
+ file_descriptor,
428
+ file_encoding,
429
+ )
430
+ for contact in log:
431
+ the_date_and_time = contact.get("TS", "")
432
+ themode = contact.get("Mode", "")
433
+ if themode == "LSB" or themode == "USB":
434
+ themode = "PH"
435
+ frequency = str(int(contact.get("Freq", "0"))).rjust(5)
436
+
437
+ loggeddate = the_date_and_time[:10]
438
+ loggedtime = the_date_and_time[11:13] + the_date_and_time[14:16]
439
+ output_cabrillo_line(
440
+ f"QSO: {frequency} {themode} {loggeddate} {loggedtime} "
441
+ f"{contact.get('StationPrefix', '').ljust(13)} "
442
+ f"{str(contact.get('SNT', '')).ljust(3)} "
443
+ f"{str(contact.get('SentNr', '')).ljust(6)} "
444
+ f"{contact.get('Call', '').ljust(13)} "
445
+ f"{str(contact.get('RCV', '')).ljust(3)} "
446
+ f"{str(contact.get('NR', '')).ljust(6)}",
447
+ "\r\n",
448
+ file_descriptor,
449
+ file_encoding,
450
+ )
451
+ output_cabrillo_line("END-OF-LOG:", "\r\n", file_descriptor, file_encoding)
452
+ self.show_message_box(f"Cabrillo saved to: {filename}")
453
+ except IOError as exception:
454
+ logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
455
+ self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
456
+ return
457
+
458
+
459
+ def recalculate_mults(self):
460
+ """Recalculates multipliers after change in logged qso."""
461
+
462
+
463
+ def process_esm(self, new_focused_widget=None, with_enter=False):
464
+ """ESM State Machine"""
465
+
466
+ # self.pref["run_state"]
467
+
468
+ # -----===== Assigned F-Keys =====-----
469
+ # self.esm_dict["CQ"]
470
+ # self.esm_dict["EXCH"]
471
+ # self.esm_dict["QRZ"]
472
+ # self.esm_dict["AGN"]
473
+ # self.esm_dict["HISCALL"]
474
+ # self.esm_dict["MYCALL"]
475
+ # self.esm_dict["QSOB4"]
476
+
477
+ # ----==== text fields ====----
478
+ # self.callsign
479
+ # self.sent
480
+ # self.receive
481
+ # self.other_1
482
+ # self.other_2
483
+
484
+ if new_focused_widget is not None:
485
+ self.current_widget = self.inputs_dict.get(new_focused_widget)
486
+
487
+ # print(f"checking esm {self.current_widget=} {with_enter=} {self.pref.get("run_state")=}")
488
+
489
+ for a_button in [
490
+ self.F1,
491
+ self.F2,
492
+ self.F3,
493
+ self.F4,
494
+ self.F5,
495
+ self.F6,
496
+ self.F7,
497
+ self.F8,
498
+ self.F9,
499
+ self.F10,
500
+ self.F11,
501
+ self.F12,
502
+ ]:
503
+ self.restore_button_color(a_button)
504
+
505
+ buttons_to_send = []
506
+
507
+ if self.pref.get("run_state"):
508
+ if self.current_widget == "callsign":
509
+ if len(self.callsign.text()) < 3:
510
+ self.make_button_green(self.esm_dict["CQ"])
511
+ buttons_to_send.append(self.esm_dict["CQ"])
512
+ elif len(self.callsign.text()) > 2:
513
+ self.make_button_green(self.esm_dict["HISCALL"])
514
+ self.make_button_green(self.esm_dict["EXCH"])
515
+ buttons_to_send.append(self.esm_dict["HISCALL"])
516
+ buttons_to_send.append(self.esm_dict["EXCH"])
517
+
518
+ elif self.current_widget == "other_2":
519
+ if self.other_2.text() == "":
520
+ self.make_button_green(self.esm_dict["AGN"])
521
+ buttons_to_send.append(self.esm_dict["AGN"])
522
+ elif self.other_2.text().isnumeric():
523
+ self.make_button_green(self.esm_dict["QRZ"])
524
+ buttons_to_send.append(self.esm_dict["QRZ"])
525
+ buttons_to_send.append("LOGIT")
526
+ else:
527
+ self.make_button_green(self.esm_dict["AGN"])
528
+ buttons_to_send.append(self.esm_dict["AGN"])
529
+
530
+ if with_enter is True and bool(len(buttons_to_send)):
531
+ for button in buttons_to_send:
532
+ if button:
533
+ if button == "LOGIT":
534
+ self.save_contact()
535
+ continue
536
+ self.process_function_key(button)
537
+ else:
538
+ if self.current_widget == "callsign":
539
+ if len(self.callsign.text()) > 2:
540
+ self.make_button_green(self.esm_dict["MYCALL"])
541
+ buttons_to_send.append(self.esm_dict["MYCALL"])
542
+
543
+ elif self.current_widget == "other_2":
544
+ if self.other_2.text() == "":
545
+ self.make_button_green(self.esm_dict["AGN"])
546
+ buttons_to_send.append(self.esm_dict["AGN"])
547
+ elif self.other_2.text().isnumeric():
548
+ self.make_button_green(self.esm_dict["EXCH"])
549
+ buttons_to_send.append(self.esm_dict["EXCH"])
550
+ buttons_to_send.append("LOGIT")
551
+ else:
552
+ self.make_button_green(self.esm_dict["AGN"])
553
+ buttons_to_send.append(self.esm_dict["AGN"])
554
+
555
+ if with_enter is True and bool(len(buttons_to_send)):
556
+ for button in buttons_to_send:
557
+ if button:
558
+ if button == "LOGIT":
559
+ self.save_contact()
560
+ continue
561
+ self.process_function_key(button)
562
+
563
+
564
+ def get_mults(self):
565
+ """Get mults for RTC XML"""
566
+ mults = {}
567
+ mults["wpxprefix"] = show_mults(self)
568
+ return mults
569
+
570
+
571
+ def just_points(self):
572
+ """Get points for RTC XML"""
573
+ return get_points(self)
574
+
575
+
576
+ # def add_test_data(self):
577
+ # """"""
578
+ # filename = "/home/mbridak/Nextcloud/dev/not1mm/research/sac/sac_log.txt"
579
+ # try:
580
+ # with open(filename, "rt", encoding="utf-8") as file_descriptor:
581
+ # lines = file_descriptor.readlines()
582
+ # for line in lines:
583
+ # field = line.split()
584
+ # print(f"{field[8]} {field[10]}")
585
+ # self.callsign.setText(str(field[8]))
586
+ # time.sleep(1.0)
587
+ # self.other_2.setText(str(field[10]))
588
+ # time.sleep(1.0)
589
+
590
+ # except (FileNotFoundError, IndexError) as err:
591
+ # print(f"{err=}")
592
+
593
+
594
+ # def set_self(the_outie):
595
+ # """..."""
596
+ # globals()["ALTEREGO"] = the_outie
597
+
598
+
599
+ # def ft8_handler(the_packet: dict):
600
+ # """Process FT8 QSO packets
601
+
602
+ # FlDigi
603
+ # {
604
+ # 'FREQ': '7.029500',
605
+ # 'CALL': 'DL2DSL',
606
+ # 'MODE': 'RTTY',
607
+ # 'NAME': 'BOB',result = ALTEREGO.database.fetch_call_exists(the_packet.get("CALL", ""))
608
+ # if result.get("call_count", ""):
609
+ # ALTEREGO.contact["IsMultiplier1"] = 0
610
+ # else:
611
+ # ALTEREGO.contact["IsMultiplier1"] = 1
612
+ # 'QSO_DATE': '20240904',
613
+ # 'QSO_DATE_OFF': '20240904',
614
+ # 'TIME_OFF': '212825',
615
+ # 'TIME_ON': '212800',
616
+ # 'RST_RCVD': '599',
617
+ # 'RST_SENT': '599',
618
+ # 'BAND': '40M',
619
+ # 'COUNTRY': 'FED. REP. OF GERMANY',
620
+ # 'CQZ': '14',
621
+ # 'STX': '000',
622
+ # 'STX_STRING': '1D ORG',
623
+ # 'CLASS': '1D',
624
+ # 'ARRL_SECT': 'DX',
625
+ # 'TX_PWR': '0',
626
+ # 'OPERATOR': 'K6GTE',
627
+ # 'STATION_CALLSIGN': 'K6GTE',
628
+ # 'MY_GRIDSQUARE': 'DM13AT',
629
+ # 'MY_CITY': 'ANAHEIM, CA',
630
+ # 'MY_STATE': 'CA'
631
+ # }
632
+
633
+ # """
634
+ # logger.debug(f"{the_packet=}")
635
+ # if ALTEREGO is not None:
636
+ # ALTEREGO.callsign.setText(the_packet.get("CALL"))
637
+ # ALTEREGO.contact["Call"] = the_packet.get("CALL", "")
638
+ # ALTEREGO.contact["SNT"] = ALTEREGO.sent.text()
639
+ # ALTEREGO.contact["RCV"] = ALTEREGO.receive.text()
640
+ # ALTEREGO.contact["NR"] = the_packet.get("SRX_STRING", "001")
641
+ # ALTEREGO.other_2.setText(the_packet.get("SRX_STRING", "001"))
642
+ # ALTEREGO.other_1.setText(the_packet.get("STX_STRING", "001"))
643
+ # ALTEREGO.contact["SentNr"] = the_packet.get("STX_STRING", "001")
644
+
645
+ # ALTEREGO.contact["Mode"] = the_packet.get("MODE", "ERR")
646
+ # ALTEREGO.contact["Freq"] = round(float(the_packet.get("FREQ", "0.0")) * 1000, 2)
647
+
648
+ # ALTEREGO.contact["QSXFreq"] = round(
649
+ # float(the_packet.get("FREQ", "0.0")) * 1000, 2
650
+ # )
651
+ # ALTEREGO.contact["Band"] = get_logged_band(
652
+ # str(int(float(the_packet.get("FREQ", "0.0")) * 1000000))
653
+ # )
654
+ # result = ALTEREGO.cty_lookup(the_packet.get("CALL"))
655
+ # if result:
656
+ # for a in result.items():
657
+ # entity = a[1].get("entity", "")
658
+ # cq = a[1].get("cq", "")
659
+ # itu = a[1].get("itu", "")
660
+ # continent = a[1].get("continent")
661
+ # primary_pfx = a[1].get("primary_pfx", "")
662
+ # ALTEREGO.contact["CountryPrefix"] = primary_pfx
663
+ # ALTEREGO.contact["Continent"] = continent
664
+ # ALTEREGO.radio_state["vfoa"] = int(
665
+ # float(the_packet.get("FREQ", "0.0")) * 1000000
666
+ # )
667
+ # logger.debug(f"{ALTEREGO.contact=}")
668
+ # ALTEREGO.save_contact()