not1mm 23.12.20__py3-none-any.whl → 24.1.15__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.
not1mm/__main__.py CHANGED
@@ -127,7 +127,7 @@ class MainWindow(QtWidgets.QMainWindow):
127
127
  "command_buttons": False,
128
128
  "cw_macros": True,
129
129
  "bands_modes": True,
130
- "bands": ["160m", "80m", "40m", "20m", "15m", "10m"],
130
+ "bands": ["160", "80", "40", "20", "15", "10"],
131
131
  "window_height": 200,
132
132
  "window_width": 600,
133
133
  "window_x": 120,
@@ -270,80 +270,148 @@ class MainWindow(QtWidgets.QMainWindow):
270
270
  self.radio_icon.setPixmap(self.radio_grey)
271
271
 
272
272
  self.F1.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
273
- self.F1.customContextMenuRequested.connect(self.edit_F1)
274
- self.F1.clicked.connect(self.sendf1)
273
+ self.F1.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F1))
274
+ self.F1.clicked.connect(lambda x: self.process_function_key(self.F1))
275
275
  self.F2.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
276
- self.F2.customContextMenuRequested.connect(self.edit_F2)
277
- self.F2.clicked.connect(self.sendf2)
276
+ self.F2.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F2))
277
+ self.F2.clicked.connect(lambda x: self.process_function_key(self.F2))
278
278
  self.F3.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
279
- self.F3.customContextMenuRequested.connect(self.edit_F3)
280
- self.F3.clicked.connect(self.sendf3)
279
+ self.F3.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F3))
280
+ self.F3.clicked.connect(lambda x: self.process_function_key(self.F3))
281
281
  self.F4.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
282
- self.F4.customContextMenuRequested.connect(self.edit_F4)
283
- self.F4.clicked.connect(self.sendf4)
282
+ self.F4.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F4))
283
+ self.F4.clicked.connect(lambda x: self.process_function_key(self.F4))
284
284
  self.F5.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
285
- self.F5.customContextMenuRequested.connect(self.edit_F5)
286
- self.F5.clicked.connect(self.sendf5)
285
+ self.F5.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F5))
286
+ self.F5.clicked.connect(lambda x: self.process_function_key(self.F5))
287
287
  self.F6.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
288
- self.F6.customContextMenuRequested.connect(self.edit_F6)
289
- self.F6.clicked.connect(self.sendf6)
288
+ self.F6.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F6))
289
+ self.F6.clicked.connect(lambda x: self.process_function_key(self.F6))
290
290
  self.F7.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
291
- self.F7.customContextMenuRequested.connect(self.edit_F7)
292
- self.F7.clicked.connect(self.sendf7)
291
+ self.F7.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F7))
292
+ self.F7.clicked.connect(lambda x: self.process_function_key(self.F7))
293
293
  self.F8.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
294
- self.F8.customContextMenuRequested.connect(self.edit_F8)
295
- self.F8.clicked.connect(self.sendf8)
294
+ self.F8.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F8))
295
+ self.F8.clicked.connect(lambda x: self.process_function_key(self.F8))
296
296
  self.F9.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
297
- self.F9.customContextMenuRequested.connect(self.edit_F9)
298
- self.F9.clicked.connect(self.sendf9)
297
+ self.F9.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F9))
298
+ self.F9.clicked.connect(lambda x: self.process_function_key(self.F9))
299
299
  self.F10.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
300
- self.F10.customContextMenuRequested.connect(self.edit_F10)
301
- self.F10.clicked.connect(self.sendf10)
300
+ self.F10.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F10))
301
+ self.F10.clicked.connect(lambda x: self.process_function_key(self.F10))
302
302
  self.F11.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
303
- self.F11.customContextMenuRequested.connect(self.edit_F11)
304
- self.F11.clicked.connect(self.sendf11)
303
+ self.F11.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F11))
304
+ self.F11.clicked.connect(lambda x: self.process_function_key(self.F11))
305
305
  self.F12.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
306
- self.F12.customContextMenuRequested.connect(self.edit_F12)
307
- self.F12.clicked.connect(self.sendf12)
308
-
309
- self.cw_band_160.mousePressEvent = self.click_160_cw
310
- self.cw_band_80.mousePressEvent = self.click_80_cw
311
- self.cw_band_40.mousePressEvent = self.click_40_cw
312
- self.cw_band_20.mousePressEvent = self.click_20_cw
313
- self.cw_band_15.mousePressEvent = self.click_15_cw
314
- self.cw_band_10.mousePressEvent = self.click_10_cw
315
- self.cw_band_6.mousePressEvent = self.click_6_cw
316
- self.cw_band_2.mousePressEvent = self.click_2_cw
317
- self.cw_band_125.mousePressEvent = self.click_125_cw
318
- self.cw_band_70cm.mousePressEvent = self.click_70cm_cw
319
- self.cw_band_33cm.mousePressEvent = self.click_33cm_cw
320
- self.cw_band_23cm.mousePressEvent = self.click_23cm_cw
321
-
322
- self.ssb_band_160.mousePressEvent = self.click_160_ssb
323
- self.ssb_band_80.mousePressEvent = self.click_80_ssb
324
- self.ssb_band_40.mousePressEvent = self.click_40_ssb
325
- self.ssb_band_20.mousePressEvent = self.click_20_ssb
326
- self.ssb_band_15.mousePressEvent = self.click_15_ssb
327
- self.ssb_band_10.mousePressEvent = self.click_10_ssb
328
- self.ssb_band_6.mousePressEvent = self.click_6_ssb
329
- self.ssb_band_2.mousePressEvent = self.click_2_ssb
330
- self.ssb_band_125.mousePressEvent = self.click_125_ssb
331
- self.ssb_band_70cm.mousePressEvent = self.click_70cm_ssb
332
- self.ssb_band_33cm.mousePressEvent = self.click_33cm_ssb
333
- self.ssb_band_23cm.mousePressEvent = self.click_23cm_ssb
334
-
335
- self.rtty_band_160.mousePressEvent = self.click_160_rtty
336
- self.rtty_band_80.mousePressEvent = self.click_80_rtty
337
- self.rtty_band_40.mousePressEvent = self.click_40_rtty
338
- self.rtty_band_20.mousePressEvent = self.click_20_rtty
339
- self.rtty_band_15.mousePressEvent = self.click_15_rtty
340
- self.rtty_band_10.mousePressEvent = self.click_10_rtty
341
- self.rtty_band_6.mousePressEvent = self.click_6_rtty
342
- self.rtty_band_2.mousePressEvent = self.click_2_rtty
343
- self.rtty_band_125.mousePressEvent = self.click_125_rtty
344
- self.rtty_band_70cm.mousePressEvent = self.click_70cm_rtty
345
- self.rtty_band_33cm.mousePressEvent = self.click_33cm_rtty
346
- self.rtty_band_23cm.mousePressEvent = self.click_23cm_rtty
306
+ self.F12.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F12))
307
+ self.F12.clicked.connect(lambda x: self.process_function_key(self.F12))
308
+
309
+ self.cw_band_160.mousePressEvent = lambda x: self.change_to_band_and_mode(
310
+ 160, "CW"
311
+ )
312
+ self.cw_band_80.mousePressEvent = lambda x: self.change_to_band_and_mode(
313
+ 80, "CW"
314
+ )
315
+ self.cw_band_40.mousePressEvent = lambda x: self.change_to_band_and_mode(
316
+ 40, "CW"
317
+ )
318
+ self.cw_band_20.mousePressEvent = lambda x: self.change_to_band_and_mode(
319
+ 20, "CW"
320
+ )
321
+ self.cw_band_15.mousePressEvent = lambda x: self.change_to_band_and_mode(
322
+ 15, "CW"
323
+ )
324
+ self.cw_band_10.mousePressEvent = lambda x: self.change_to_band_and_mode(
325
+ 10, "CW"
326
+ )
327
+ self.cw_band_6.mousePressEvent = lambda x: self.change_to_band_and_mode(6, "CW")
328
+ self.cw_band_2.mousePressEvent = lambda x: self.change_to_band_and_mode(2, "CW")
329
+ self.cw_band_125.mousePressEvent = lambda x: self.change_to_band_and_mode(
330
+ 222, "CW"
331
+ )
332
+ self.cw_band_70cm.mousePressEvent = lambda x: self.change_to_band_and_mode(
333
+ 432, "CW"
334
+ )
335
+ self.cw_band_33cm.mousePressEvent = lambda x: self.change_to_band_and_mode(
336
+ 902, "CW"
337
+ )
338
+ self.cw_band_23cm.mousePressEvent = lambda x: self.change_to_band_and_mode(
339
+ 1240, "CW"
340
+ )
341
+
342
+ self.ssb_band_160.mousePressEvent = lambda x: self.change_to_band_and_mode(
343
+ 160, "SSB"
344
+ )
345
+ self.ssb_band_80.mousePressEvent = lambda x: self.change_to_band_and_mode(
346
+ 80, "SSB"
347
+ )
348
+ self.ssb_band_40.mousePressEvent = lambda x: self.change_to_band_and_mode(
349
+ 40, "SSB"
350
+ )
351
+ self.ssb_band_20.mousePressEvent = lambda x: self.change_to_band_and_mode(
352
+ 20, "SSB"
353
+ )
354
+ self.ssb_band_15.mousePressEvent = lambda x: self.change_to_band_and_mode(
355
+ 15, "SSB"
356
+ )
357
+ self.ssb_band_10.mousePressEvent = lambda x: self.change_to_band_and_mode(
358
+ 10, "SSB"
359
+ )
360
+ self.ssb_band_6.mousePressEvent = lambda x: self.change_to_band_and_mode(
361
+ 6, "SSB"
362
+ )
363
+ self.ssb_band_2.mousePressEvent = lambda x: self.change_to_band_and_mode(
364
+ 2, "SSB"
365
+ )
366
+ self.ssb_band_125.mousePressEvent = lambda x: self.change_to_band_and_mode(
367
+ 222, "SSB"
368
+ )
369
+ self.ssb_band_70cm.mousePressEvent = lambda x: self.change_to_band_and_mode(
370
+ 432, "SSB"
371
+ )
372
+ self.ssb_band_33cm.mousePressEvent = lambda x: self.change_to_band_and_mode(
373
+ 902, "SSB"
374
+ )
375
+ self.ssb_band_23cm.mousePressEvent = lambda x: self.change_to_band_and_mode(
376
+ 1240, "SSB"
377
+ )
378
+
379
+ self.rtty_band_160.mousePressEvent = lambda x: self.change_to_band_and_mode(
380
+ 160, "RTTY"
381
+ )
382
+ self.rtty_band_80.mousePressEvent = lambda x: self.change_to_band_and_mode(
383
+ 80, "RTTY"
384
+ )
385
+ self.rtty_band_40.mousePressEvent = lambda x: self.change_to_band_and_mode(
386
+ 40, "RTTY"
387
+ )
388
+ self.rtty_band_20.mousePressEvent = lambda x: self.change_to_band_and_mode(
389
+ 20, "RTTY"
390
+ )
391
+ self.rtty_band_15.mousePressEvent = lambda x: self.change_to_band_and_mode(
392
+ 15, "RTTY"
393
+ )
394
+ self.rtty_band_10.mousePressEvent = lambda x: self.change_to_band_and_mode(
395
+ 10, "RTTY"
396
+ )
397
+ self.rtty_band_6.mousePressEvent = lambda x: self.change_to_band_and_mode(
398
+ 6, "RTTY"
399
+ )
400
+ self.rtty_band_2.mousePressEvent = lambda x: self.change_to_band_and_mode(
401
+ 2, "RTTY"
402
+ )
403
+ self.rtty_band_125.mousePressEvent = lambda x: self.change_to_band_and_mode(
404
+ 222, "RTTY"
405
+ )
406
+ self.rtty_band_70cm.mousePressEvent = lambda x: self.change_to_band_and_mode(
407
+ 432, "RTTY"
408
+ )
409
+ self.rtty_band_33cm.mousePressEvent = lambda x: self.change_to_band_and_mode(
410
+ 902, "RTTY"
411
+ )
412
+ self.rtty_band_23cm.mousePressEvent = lambda x: self.change_to_band_and_mode(
413
+ 1240, "RTTY"
414
+ )
347
415
 
348
416
  self.band_indicators_cw = {
349
417
  "160": self.cw_band_160,
@@ -454,159 +522,27 @@ class MainWindow(QtWidgets.QMainWindow):
454
522
  self.cw.sendcw(newtext[len(self.oldtext) :])
455
523
  self.oldtext = newtext
456
524
 
457
- def click_160_cw(self, _event) -> None:
458
- """Handle clicked on label"""
459
- self.change_to_band_and_mode(160, "CW")
460
-
461
- def click_80_cw(self, _event) -> None:
462
- """doc"""
463
- self.change_to_band_and_mode(80, "CW")
464
-
465
- def click_40_cw(self, _event) -> None:
466
- """doc"""
467
- self.change_to_band_and_mode(40, "CW")
468
-
469
- def click_20_cw(self, _event) -> None:
470
- """doc"""
471
- self.change_to_band_and_mode(20, "CW")
472
-
473
- def click_15_cw(self, _event) -> None:
474
- """doc"""
475
- self.change_to_band_and_mode(15, "CW")
476
-
477
- def click_10_cw(self, _event) -> None:
478
- """doc"""
479
- self.change_to_band_and_mode(10, "CW")
480
-
481
- def click_6_cw(self, _event) -> None:
482
- """doc"""
483
- self.change_to_band_and_mode(6, "CW")
484
-
485
- def click_2_cw(self, _event) -> None:
486
- """doc"""
487
- self.change_to_band_and_mode(2, "CW")
488
-
489
- def click_125_cw(self, _event) -> None:
490
- """doc"""
491
- self.change_to_band_and_mode(222, "CW")
492
-
493
- def click_70cm_cw(self, _event) -> None:
494
- """doc"""
495
- self.change_to_band_and_mode(432, "CW")
496
-
497
- def click_33cm_cw(self, _event) -> None:
498
- """doc"""
499
- self.change_to_band_and_mode(902, "CW")
500
-
501
- def click_23cm_cw(self, _event) -> None:
502
- """doc"""
503
- self.change_to_band_and_mode(1240, "CW")
504
-
505
- def click_160_ssb(self, _event) -> None:
506
- """doc"""
507
- self.change_to_band_and_mode(160, "SSB")
508
-
509
- def click_80_ssb(self, _event) -> None:
510
- """doc"""
511
- self.change_to_band_and_mode(80, "SSB")
512
-
513
- def click_40_ssb(self, _event) -> None:
514
- """doc"""
515
- self.change_to_band_and_mode(40, "SSB")
516
-
517
- def click_20_ssb(self, _event) -> None:
518
- """doc"""
519
- self.change_to_band_and_mode(20, "SSB")
520
-
521
- def click_15_ssb(self, _event) -> None:
522
- """doc"""
523
- self.change_to_band_and_mode(15, "SSB")
524
-
525
- def click_10_ssb(self, _event) -> None:
526
- """doc"""
527
- self.change_to_band_and_mode(10, "SSB")
528
-
529
- def click_6_ssb(self, _event) -> None:
530
- """doc"""
531
- self.change_to_band_and_mode(6, "SSB")
532
-
533
- def click_2_ssb(self, _event) -> None:
534
- """doc"""
535
- self.change_to_band_and_mode(2, "SSB")
536
-
537
- def click_125_ssb(self, _event) -> None:
538
- """doc"""
539
- self.change_to_band_and_mode(222, "SSB")
540
-
541
- def click_70cm_ssb(self, _event) -> None:
542
- """doc"""
543
- self.change_to_band_and_mode(432, "SSB")
544
-
545
- def click_33cm_ssb(self, _event) -> None:
546
- """doc"""
547
- self.change_to_band_and_mode(902, "SSB")
548
-
549
- def click_23cm_ssb(self, _event) -> None:
550
- """doc"""
551
- self.change_to_band_and_mode(1240, "SSB")
552
-
553
- def click_160_rtty(self, _event) -> None:
554
- """doc"""
555
- self.change_to_band_and_mode(160, "RTTY")
556
-
557
- def click_80_rtty(self, _event) -> None:
558
- """doc"""
559
- self.change_to_band_and_mode(80, "RTTY")
560
-
561
- def click_40_rtty(self, _event) -> None:
562
- """doc"""
563
- self.change_to_band_and_mode(40, "RTTY")
564
-
565
- def click_20_rtty(self, _event) -> None:
566
- """doc"""
567
- self.change_to_band_and_mode(20, "RTTY")
568
-
569
- def click_15_rtty(self, _event) -> None:
570
- """doc"""
571
- self.change_to_band_and_mode(15, "RTTY")
572
-
573
- def click_10_rtty(self, _event) -> None:
574
- """doc"""
575
- self.change_to_band_and_mode(10, "RTTY")
576
-
577
- def click_6_rtty(self, _event) -> None:
578
- """doc"""
579
- self.change_to_band_and_mode(6, "RTTY")
580
-
581
- def click_2_rtty(self, _event) -> None:
582
- """doc"""
583
- self.change_to_band_and_mode(2, "RTTY")
584
-
585
- def click_125_rtty(self, _event) -> None:
586
- """doc"""
587
- self.change_to_band_and_mode(222, "RTTY")
588
-
589
- def click_70cm_rtty(self, _event) -> None:
590
- """doc"""
591
- self.change_to_band_and_mode(432, "RTTY")
592
-
593
- def click_33cm_rtty(self, _event) -> None:
594
- """doc"""
595
- self.change_to_band_and_mode(902, "RTTY")
525
+ def change_to_band_and_mode(self, band: int, mode: str) -> None:
526
+ """
527
+ Gets a sane frequency for the chosen band and mode.
528
+ Then changes to that,
596
529
 
597
- def click_23cm_rtty(self, _event) -> None:
598
- """doc"""
599
- self.change_to_band_and_mode(1240, "RTTY")
530
+ Parameters
531
+ ----------
532
+ band : int
533
+ mode : str
600
534
 
601
- def change_to_band_and_mode(self, band, mode) -> None:
602
- """doc"""
535
+ Returns
536
+ -------
537
+ Nothing
538
+ """
603
539
  if mode in ["CW", "SSB", "RTTY"]:
604
540
  freq = fakefreq(str(band), mode)
605
541
  self.change_freq(freq)
606
542
  self.change_mode(mode)
607
543
 
608
544
  def quit_app(self) -> None:
609
- """doc"""
545
+ """Send multicast quit message, then quit the program."""
610
546
  cmd = {}
611
547
  cmd["cmd"] = "HALT"
612
548
  cmd["station"] = platform.node()
@@ -910,34 +846,40 @@ class MainWindow(QtWidgets.QMainWindow):
910
846
  self.pref.get("contest")
911
847
  )
912
848
  if self.contest_settings:
913
- self.database.current_contest = self.pref.get("contest")
914
- if self.contest_settings.get("ContestName"):
915
- self.contest = doimp(self.contest_settings.get("ContestName"))
916
- logger.debug("Loaded Contest Name = %s", self.contest.name)
917
- self.set_window_title()
918
- self.contest.init_contest(self)
919
- self.hide_band_mode(self.contest_settings.get("ModeCategory", ""))
920
- logger.debug("%s", f"{self.contest_settings}")
921
- if self.contest_settings.get("ModeCategory", "") == "CW":
922
- self.setmode("CW")
923
- self.radio_state["mode"] = "CW"
924
- if self.rig_control:
925
- if self.rig_control.online:
926
- self.rig_control.set_mode("CW")
927
- band = getband(str(self.radio_state.get("vfoa", "0.0")))
928
- self.set_band_indicator(band)
929
- self.set_window_title()
930
- if self.contest_settings.get("ModeCategory", "") == "SSB":
931
- self.setmode("SSB")
932
- if int(self.radio_state.get("vfoa", 0)) > 10000000:
933
- self.radio_state["mode"] = "USB"
934
- else:
935
- self.radio_state["mode"] = "LSB"
936
- band = getband(str(self.radio_state.get("vfoa", "0.0")))
937
- self.set_band_indicator(band)
849
+ try:
850
+ self.database.current_contest = self.pref.get("contest")
851
+ if self.contest_settings.get("ContestName"):
852
+ self.contest = doimp(self.contest_settings.get("ContestName"))
853
+ logger.debug("Loaded Contest Name = %s", self.contest.name)
938
854
  self.set_window_title()
939
- if self.rig_control:
940
- self.rig_control.set_mode(self.radio_state.get("mode"))
855
+ self.contest.init_contest(self)
856
+ self.hide_band_mode(
857
+ self.contest_settings.get("ModeCategory", "")
858
+ )
859
+ logger.debug("%s", f"{self.contest_settings}")
860
+ if self.contest_settings.get("ModeCategory", "") == "CW":
861
+ self.setmode("CW")
862
+ self.radio_state["mode"] = "CW"
863
+ if self.rig_control:
864
+ if self.rig_control.online:
865
+ self.rig_control.set_mode("CW")
866
+ band = getband(str(self.radio_state.get("vfoa", "0.0")))
867
+ self.set_band_indicator(band)
868
+ self.set_window_title()
869
+ if self.contest_settings.get("ModeCategory", "") == "SSB":
870
+ self.setmode("SSB")
871
+ if int(self.radio_state.get("vfoa", 0)) > 10000000:
872
+ self.radio_state["mode"] = "USB"
873
+ else:
874
+ self.radio_state["mode"] = "LSB"
875
+ band = getband(str(self.radio_state.get("vfoa", "0.0")))
876
+ self.set_band_indicator(band)
877
+ self.set_window_title()
878
+ if self.rig_control:
879
+ self.rig_control.set_mode(self.radio_state.get("mode"))
880
+ except ModuleNotFoundError:
881
+ self.pref["contest"] = 1
882
+ self.show_message_box("Contest plugin not found")
941
883
 
942
884
  if hasattr(self.contest, "mode"):
943
885
  logger.debug("%s", f" **** {self.contest}")
@@ -1298,29 +1240,29 @@ class MainWindow(QtWidgets.QMainWindow):
1298
1240
  next_tab.end(False)
1299
1241
  return
1300
1242
  if event.key() == Qt.Key_F1:
1301
- self.sendf1()
1243
+ self.process_function_key(self.F1)
1302
1244
  if event.key() == Qt.Key_F2:
1303
- self.sendf2()
1245
+ self.process_function_key(self.F2)
1304
1246
  if event.key() == Qt.Key_F3:
1305
- self.sendf3()
1247
+ self.process_function_key(self.F3)
1306
1248
  if event.key() == Qt.Key_F4:
1307
- self.sendf4()
1249
+ self.process_function_key(self.F4)
1308
1250
  if event.key() == Qt.Key_F5:
1309
- self.sendf5()
1251
+ self.process_function_key(self.F5)
1310
1252
  if event.key() == Qt.Key_F6:
1311
- self.sendf6()
1253
+ self.process_function_key(self.F6)
1312
1254
  if event.key() == Qt.Key_F7:
1313
- self.sendf7()
1255
+ self.process_function_key(self.F7)
1314
1256
  if event.key() == Qt.Key_F8:
1315
- self.sendf8()
1257
+ self.process_function_key(self.F8)
1316
1258
  if event.key() == Qt.Key_F9:
1317
- self.sendf9()
1259
+ self.process_function_key(self.F9)
1318
1260
  if event.key() == Qt.Key_F10:
1319
- self.sendf10()
1261
+ self.process_function_key(self.F10)
1320
1262
  if event.key() == Qt.Key_F11:
1321
- self.sendf11()
1263
+ self.process_function_key(self.F11)
1322
1264
  if event.key() == Qt.Key_F12:
1323
- self.sendf12()
1265
+ self.process_function_key(self.F12)
1324
1266
 
1325
1267
  def set_window_title(self) -> None:
1326
1268
  """Set window title"""
@@ -1461,12 +1403,6 @@ class MainWindow(QtWidgets.QMainWindow):
1461
1403
  self.n1mm.contact_info["zn"] = self.contact["ZN"]
1462
1404
  self.n1mm.contact_info["power"] = self.contact["Power"]
1463
1405
  self.n1mm.contact_info["band"] = self.contact["Band"]
1464
- # self.n1mm.contact_info['']
1465
- # self.n1mm.contact_info['']
1466
- # self.n1mm.contact_info['']
1467
- # self.n1mm.contact_info['']
1468
- # self.n1mm.contact_info['']
1469
- # self.n1mm.contact_info['']
1470
1406
  logger.debug("%s", f"{self.n1mm.contact_info}")
1471
1407
  self.n1mm.send_contact_info()
1472
1408
 
@@ -1480,39 +1416,6 @@ class MainWindow(QtWidgets.QMainWindow):
1480
1416
  cmd["station"] = platform.node()
1481
1417
  self.multicast_interface.send_as_json(cmd)
1482
1418
 
1483
- # self.contact["ContestName"] = self.contest.name
1484
- # self.contact["SNT"] = self.sent.text()
1485
- # self.contact["RCV"] = self.receive.text()
1486
- # self.contact["CountryPrefix"]
1487
- # self.contact["StationPrefix"] = self.pref.get("callsign", "")
1488
- # self.contact["QTH"]
1489
- # self.contact["Name"] = self.other_1.text()
1490
- # self.contact["Comment"] = self.other_2.text()
1491
- # self.contact["NR"]
1492
- # self.contact["Sect"]
1493
- # self.contact["Prec"]
1494
- # self.contact["CK"]
1495
- # self.contact["ZN"]
1496
- # self.contact["SentNr"]
1497
- # self.contact["Points"]
1498
- # self.contact["IsMultiplier1"]
1499
- # self.contact["IsMultiplier2"]
1500
- # self.contact["Power"]
1501
- # self.contact["Band"]
1502
- # self.contact["WPXPrefix"] = calculate_wpx_prefix(self.callsign.text())
1503
- # self.contact["Exchange1"]
1504
- # self.contact["RadioNR"]
1505
- # self.contact["isMultiplier3"]
1506
- # self.contact["MiscText"]
1507
- # self.contact["ContactType"]
1508
- # self.contact["Run1Run2"]
1509
- # self.contact["GridSquare"]
1510
- # self.contact["Continent"]
1511
- # self.contact["RoverLocation"]
1512
- # self.contact["RadioInterfaced"]
1513
- # self.contact["NetworkedCompNr"]
1514
- # self.contact["CLAIMEDQSO"]
1515
-
1516
1419
  def new_contest_dialog(self) -> None:
1517
1420
  """Show new contest dialog"""
1518
1421
  logger.debug("New contest Dialog")
@@ -1638,66 +1541,6 @@ class MainWindow(QtWidgets.QMainWindow):
1638
1541
  )
1639
1542
  self.edit_macro_dialog.close()
1640
1543
 
1641
- def edit_F1(self) -> None:
1642
- """stub"""
1643
- logger.debug("F1 Right Clicked.")
1644
- self.edit_macro(self.F1)
1645
-
1646
- def edit_F2(self) -> None:
1647
- """stub"""
1648
- logger.debug("F2 Right Clicked.")
1649
- self.edit_macro(self.F2)
1650
-
1651
- def edit_F3(self) -> None:
1652
- """stub"""
1653
- logger.debug("F3 Right Clicked.")
1654
- self.edit_macro(self.F3)
1655
-
1656
- def edit_F4(self) -> None:
1657
- """stub"""
1658
- logger.debug("F4 Right Clicked.")
1659
- self.edit_macro(self.F4)
1660
-
1661
- def edit_F5(self) -> None:
1662
- """stub"""
1663
- logger.debug("F5 Right Clicked.")
1664
- self.edit_macro(self.F5)
1665
-
1666
- def edit_F6(self) -> None:
1667
- """stub"""
1668
- logger.debug("F6 Right Clicked.")
1669
- self.edit_macro(self.F6)
1670
-
1671
- def edit_F7(self) -> None:
1672
- """stub"""
1673
- logger.debug("F7 Right Clicked.")
1674
- self.edit_macro(self.F7)
1675
-
1676
- def edit_F8(self) -> None:
1677
- """stub"""
1678
- logger.debug("F8 Right Clicked.")
1679
- self.edit_macro(self.F8)
1680
-
1681
- def edit_F9(self) -> None:
1682
- """stub"""
1683
- logger.debug("F9 Right Clicked.")
1684
- self.edit_macro(self.F9)
1685
-
1686
- def edit_F10(self) -> None:
1687
- """stub"""
1688
- logger.debug("F10 Right Clicked.")
1689
- self.edit_macro(self.F10)
1690
-
1691
- def edit_F11(self) -> None:
1692
- """stub"""
1693
- logger.debug("F11 Right Clicked.")
1694
- self.edit_macro(self.F11)
1695
-
1696
- def edit_F12(self) -> None:
1697
- """stub"""
1698
- logger.debug("F12 Right Clicked.")
1699
- self.edit_macro(self.F12)
1700
-
1701
1544
  def process_macro(self, macro: str) -> str:
1702
1545
  """Process CW macro substitutions"""
1703
1546
  result = self.database.get_serial()
@@ -1772,137 +1615,16 @@ class MainWindow(QtWidgets.QMainWindow):
1772
1615
  app.processEvents()
1773
1616
  self.rig_control.ptt_off()
1774
1617
 
1775
- def sendf1(self) -> None:
1776
- """stub"""
1618
+ def process_function_key(self, function_key) -> None:
1619
+ """Called when a function key is clicked."""
1777
1620
  logger.debug("F1 Clicked")
1778
1621
  if self.n1mm:
1779
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F1.text()
1780
- if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1781
- self.voice_string(self.process_macro(self.F1.toolTip()))
1782
- return
1783
- if self.cw:
1784
- self.cw.sendcw(self.process_macro(self.F1.toolTip()))
1785
-
1786
- def sendf2(self) -> None:
1787
- """stub"""
1788
- logger.debug("F2 Clicked")
1789
- if self.n1mm:
1790
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F2.text()
1791
- if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1792
- self.voice_string(self.process_macro(self.F2.toolTip()))
1793
- return
1794
- if self.cw:
1795
- self.cw.sendcw(self.process_macro(self.F2.toolTip()))
1796
-
1797
- def sendf3(self) -> None:
1798
- """stub"""
1799
- logger.debug("F3 Clicked")
1800
- if self.n1mm:
1801
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F3.text()
1802
- if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1803
- self.voice_string(self.process_macro(self.F3.toolTip()))
1804
- return
1805
- if self.cw:
1806
- self.cw.sendcw(self.process_macro(self.F3.toolTip()))
1807
-
1808
- def sendf4(self) -> None:
1809
- """stub"""
1810
- logger.debug("F4 Clicked")
1811
- if self.n1mm:
1812
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F4.text()
1813
- if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1814
- self.voice_string(self.process_macro(self.F4.toolTip()))
1815
- return
1816
- if self.cw:
1817
- self.cw.sendcw(self.process_macro(self.F4.toolTip()))
1818
-
1819
- def sendf5(self) -> None:
1820
- """stub"""
1821
- logger.debug("F5 Clicked")
1822
- if self.n1mm:
1823
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F5.text()
1824
- if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1825
- self.voice_string(self.process_macro(self.F5.toolTip()))
1826
- return
1827
- if self.cw:
1828
- self.cw.sendcw(self.process_macro(self.F5.toolTip()))
1829
-
1830
- def sendf6(self) -> None:
1831
- """stub"""
1832
- logger.debug("F6 Clicked")
1833
- if self.n1mm:
1834
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F6.text()
1835
- if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1836
- self.voice_string(self.process_macro(self.F6.toolTip()))
1837
- return
1838
- if self.cw:
1839
- self.cw.sendcw(self.process_macro(self.F6.toolTip()))
1840
-
1841
- def sendf7(self) -> None:
1842
- """stub"""
1843
- logger.debug("F7 Clicked")
1844
- if self.n1mm:
1845
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F7.text()
1846
- if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1847
- self.voice_string(self.process_macro(self.F7.toolTip()))
1848
- return
1849
- if self.cw:
1850
- self.cw.sendcw(self.process_macro(self.F7.toolTip()))
1851
-
1852
- def sendf8(self) -> None:
1853
- """stub"""
1854
- logger.debug("F8 Clicked")
1855
- if self.n1mm:
1856
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F8.text()
1857
- if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1858
- self.voice_string(self.process_macro(self.F8.toolTip()))
1859
- return
1860
- if self.cw:
1861
- self.cw.sendcw(self.process_macro(self.F8.toolTip()))
1862
-
1863
- def sendf9(self) -> None:
1864
- """stub"""
1865
- logger.debug("F9 Clicked")
1866
- if self.n1mm:
1867
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F9.text()
1622
+ self.n1mm.radio_info["FunctionKeyCaption"] = function_key.text()
1868
1623
  if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1869
- self.voice_string(self.process_macro(self.F9.toolTip()))
1624
+ self.voice_string(self.process_macro(function_key.toolTip()))
1870
1625
  return
1871
1626
  if self.cw:
1872
- self.cw.sendcw(self.process_macro(self.F9.toolTip()))
1873
-
1874
- def sendf10(self) -> None:
1875
- """stub"""
1876
- logger.debug("F10 Clicked")
1877
- if self.n1mm:
1878
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F10.text()
1879
- if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1880
- self.voice_string(self.process_macro(self.F10.toolTip()))
1881
- return
1882
- if self.cw:
1883
- self.cw.sendcw(self.process_macro(self.F10.toolTip()))
1884
-
1885
- def sendf11(self) -> None:
1886
- """stub"""
1887
- logger.debug("F11 Clicked")
1888
- if self.n1mm:
1889
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F11.text()
1890
- if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1891
- self.voice_string(self.process_macro(self.F11.toolTip()))
1892
- return
1893
- if self.cw:
1894
- self.cw.sendcw(self.process_macro(self.F11.toolTip()))
1895
-
1896
- def sendf12(self) -> None:
1897
- """stub"""
1898
- logger.debug("F12 Clicked")
1899
- if self.n1mm:
1900
- self.n1mm.radio_info["FunctionKeyCaption"] = self.F12.text()
1901
- if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
1902
- self.voice_string(self.process_macro(self.F12.toolTip()))
1903
- return
1904
- if self.cw:
1905
- self.cw.sendcw(self.process_macro(self.F12.toolTip()))
1627
+ self.cw.sendcw(self.process_macro(function_key.toolTip()))
1906
1628
 
1907
1629
  def run_sp_buttons_clicked(self) -> None:
1908
1630
  """Handle run/s&p mode"""
@@ -2399,7 +2121,7 @@ class MainWindow(QtWidgets.QMainWindow):
2399
2121
  return result.get("isdupe", False)
2400
2122
 
2401
2123
  def setmode(self, mode: str) -> None:
2402
- """stub for when the mode changes."""
2124
+ """Call when the mode changes."""
2403
2125
  if mode == "CW":
2404
2126
  if self.current_mode != "CW":
2405
2127
  self.current_mode = "CW"
@@ -2455,7 +2177,10 @@ class MainWindow(QtWidgets.QMainWindow):
2455
2177
  destination_file.write_bytes(child.read_bytes())
2456
2178
 
2457
2179
  def poll_radio(self) -> None:
2458
- """stub"""
2180
+ """
2181
+ Poll radio for VFO, mode, bandwidth.
2182
+ Send state via multicast.
2183
+ """
2459
2184
  self.set_radio_icon(0)
2460
2185
  if self.rig_control:
2461
2186
  if self.rig_control.online is False: