not1mm 24.4.26__py3-none-any.whl → 24.5.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.
not1mm/__main__.py CHANGED
@@ -35,10 +35,9 @@ except OSError as exception:
35
35
  print(exception)
36
36
  print("portaudio is not installed")
37
37
  sd = None
38
- import soundfile as sf
39
38
  from PyQt6 import QtCore, QtGui, QtWidgets, uic
40
39
  from PyQt6.QtCore import QDir, Qt, QThread
41
- from PyQt6.QtGui import QFontDatabase, QColorConstants
40
+ from PyQt6.QtGui import QFontDatabase, QColorConstants, QPalette, QColor
42
41
  from PyQt6.QtWidgets import QFileDialog
43
42
 
44
43
  from not1mm.lib.about import About
@@ -75,6 +74,7 @@ from not1mm.checkwindow import CheckWindow
75
74
  from not1mm.bandmap import BandMapWindow
76
75
  from not1mm.vfo import VfoWindow
77
76
  from not1mm.radio import Radio
77
+ from not1mm.voice_keying import Voice
78
78
 
79
79
  poll_time = datetime.datetime.now()
80
80
 
@@ -188,6 +188,7 @@ class MainWindow(QtWidgets.QMainWindow):
188
188
  current_palette = None
189
189
 
190
190
  radio_thread = QThread()
191
+ voice_thread = QThread()
191
192
 
192
193
  rig_control = None
193
194
  log_window = None
@@ -479,6 +480,18 @@ class MainWindow(QtWidgets.QMainWindow):
479
480
  with open(fsutils.APP_DATA_PATH / "cty.json", "rt", encoding="utf-8") as c_file:
480
481
  self.ctyfile = loads(c_file.read())
481
482
  self.readpreferences()
483
+
484
+ self.voice_process = Voice()
485
+ self.voice_process.moveToThread(self.voice_thread)
486
+ self.voice_thread.started.connect(self.voice_process.run)
487
+ self.voice_thread.finished.connect(self.voice_process.deleteLater)
488
+ self.voice_process.ptt_on.connect(self.ptt_on)
489
+ self.voice_process.ptt_off.connect(self.ptt_off)
490
+ self.voice_process.current_op = self.current_op
491
+ self.voice_process.data_path = fsutils.USER_DATA_PATH
492
+ self.voice_process.sounddevice = self.pref.get("sounddevice", "default")
493
+ self.voice_thread.start()
494
+
482
495
  self.dbname = fsutils.USER_DATA_PATH / self.pref.get(
483
496
  "current_database", "ham.db"
484
497
  )
@@ -492,6 +505,7 @@ class MainWindow(QtWidgets.QMainWindow):
492
505
  self.station = {}
493
506
  self.contact = self.database.empty_contact
494
507
  self.current_op = self.station.get("Call", "")
508
+ self.voice_process.current_op = self.current_op
495
509
  self.make_op_dir()
496
510
  self.read_cw_macros()
497
511
  self.clearinputs()
@@ -567,76 +581,50 @@ class MainWindow(QtWidgets.QMainWindow):
567
581
  """
568
582
  print(f"{result=}")
569
583
 
570
- def setDarkMode(self, dark):
571
- """testing"""
584
+ def setDarkMode(self, setdarkmode=False) -> None:
585
+ """Forces a darkmode palette."""
572
586
 
573
- logger.debug(f"Dark mode set to: {dark}")
587
+ logger.debug(f"Dark mode set to: {setdarkmode}")
574
588
 
575
589
  cmd = {}
576
590
  cmd["cmd"] = "DARKMODE"
577
- cmd["state"] = dark
591
+ cmd["state"] = setdarkmode
578
592
  cmd["station"] = platform.node()
579
593
  self.multicast_interface.send_as_json(cmd)
580
594
 
581
- if dark:
582
- darkPalette = QtGui.QPalette()
583
- darkColor = QtGui.QColor(56, 56, 56)
584
- disabledColor = QtGui.QColor(127, 127, 127)
585
- darkPalette.setColor(QtGui.QPalette.ColorRole.Window, darkColor)
595
+ if setdarkmode:
596
+ darkPalette = QPalette()
597
+ darkColor = QColor(56, 56, 56)
598
+ disabledColor = QColor(127, 127, 127)
599
+ darkPalette.setColor(QPalette.ColorRole.Window, darkColor)
600
+ darkPalette.setColor(QPalette.ColorRole.WindowText, QColorConstants.White)
601
+ darkPalette.setColor(QPalette.ColorRole.Base, QColor(45, 45, 45))
602
+ darkPalette.setColor(QPalette.ColorRole.AlternateBase, darkColor)
603
+ darkPalette.setColor(QPalette.ColorRole.Text, QColorConstants.White)
604
+ darkPalette.setColor(QPalette.ColorRole.Button, darkColor)
605
+ darkPalette.setColor(QPalette.ColorRole.ButtonText, QColorConstants.White)
606
+ darkPalette.setColor(QPalette.ColorRole.BrightText, QColorConstants.Red)
607
+ darkPalette.setColor(QPalette.ColorRole.Link, QColor(42, 130, 218))
608
+ darkPalette.setColor(QPalette.ColorRole.Highlight, QColor(42, 130, 218))
586
609
  darkPalette.setColor(
587
- QtGui.QPalette.ColorRole.WindowText, QColorConstants.White
610
+ QPalette.ColorRole.HighlightedText, QColorConstants.Black
588
611
  )
589
612
  darkPalette.setColor(
590
- QtGui.QPalette.ColorRole.Base, QtGui.QColor(45, 45, 45)
591
- )
592
- darkPalette.setColor(QtGui.QPalette.ColorRole.AlternateBase, darkColor)
593
- darkPalette.setColor(QtGui.QPalette.ColorRole.Text, QColorConstants.White)
594
- darkPalette.setColor(
595
- QtGui.QPalette.ColorGroup.Disabled,
596
- QtGui.QPalette.ColorRole.Text,
613
+ QPalette.ColorGroup.Disabled,
614
+ QPalette.ColorRole.ButtonText,
597
615
  disabledColor,
598
616
  )
599
- darkPalette.setColor(QtGui.QPalette.ColorRole.Button, darkColor)
600
617
  darkPalette.setColor(
601
- QtGui.QPalette.ColorRole.ButtonText, QColorConstants.White
602
- )
603
- darkPalette.setColor(
604
- QtGui.QPalette.ColorGroup.Disabled,
605
- QtGui.QPalette.ColorRole.ButtonText,
618
+ QPalette.ColorGroup.Disabled,
619
+ QPalette.ColorRole.HighlightedText,
606
620
  disabledColor,
607
621
  )
608
622
  darkPalette.setColor(
609
- QtGui.QPalette.ColorRole.BrightText, QColorConstants.Red
610
- )
611
- darkPalette.setColor(
612
- QtGui.QPalette.ColorRole.Link, QtGui.QColor(42, 130, 218)
613
- )
614
- darkPalette.setColor(
615
- QtGui.QPalette.ColorRole.Highlight, QtGui.QColor(42, 130, 218)
616
- )
617
- darkPalette.setColor(
618
- QtGui.QPalette.ColorRole.HighlightedText, QColorConstants.Black
619
- )
620
- darkPalette.setColor(
621
- QtGui.QPalette.ColorGroup.Disabled,
622
- QtGui.QPalette.ColorRole.HighlightedText,
623
+ QPalette.ColorGroup.Disabled,
624
+ QPalette.ColorRole.Text,
623
625
  disabledColor,
624
626
  )
625
- dark_button_style = (
626
- "QPushButton {"
627
- "background-color: rgb(56,56,56);"
628
- "color: white;"
629
- "border-style: outset;"
630
- "border-width: 2px;"
631
- "border-radius: 5px;"
632
- "border-color: rgb(45,45,45);"
633
- "padding: 6px;"
634
- "}"
635
- "QPushButton:pressed {"
636
- "background-color: rgb(127, 127, 127);"
637
- "border-style: inset;"
638
- "}"
639
- )
627
+
640
628
  self.current_palette = darkPalette
641
629
  self.setPalette(darkPalette)
642
630
  self.text_color = QColorConstants.White
@@ -651,18 +639,6 @@ class MainWindow(QtWidgets.QMainWindow):
651
639
  self.other_1.setPalette(darkPalette)
652
640
  self.other_2.setPalette(darkPalette)
653
641
  self.cw_entry.setPalette(darkPalette)
654
- self.F1.setStyleSheet(dark_button_style)
655
- self.F2.setStyleSheet(dark_button_style)
656
- self.F3.setStyleSheet(dark_button_style)
657
- self.F4.setStyleSheet(dark_button_style)
658
- self.F5.setStyleSheet(dark_button_style)
659
- self.F6.setStyleSheet(dark_button_style)
660
- self.F7.setStyleSheet(dark_button_style)
661
- self.F8.setStyleSheet(dark_button_style)
662
- self.F9.setStyleSheet(dark_button_style)
663
- self.F10.setStyleSheet(dark_button_style)
664
- self.F11.setStyleSheet(dark_button_style)
665
- self.F12.setStyleSheet(dark_button_style)
666
642
  else:
667
643
  palette = self.style().standardPalette()
668
644
  self.current_palette = palette
@@ -679,33 +655,6 @@ class MainWindow(QtWidgets.QMainWindow):
679
655
  self.other_2.setPalette(palette)
680
656
  self.cw_entry.setPalette(palette)
681
657
  self.text_color = QColorConstants.Black
682
- light_button_style = (
683
- "QPushButton {"
684
- "background-color: rgb(245,245,245);"
685
- "color: rgb(52,52,52);"
686
- "border-style: outset;"
687
- "border-width: 2px;"
688
- "border-radius: 5px;"
689
- "border-color: rgb(150,150,150);"
690
- "padding: 6px;"
691
- "}"
692
- "QPushButton:pressed {"
693
- "background-color: rgb(127, 127, 127);"
694
- "border-style: inset;"
695
- "}"
696
- )
697
- self.F1.setStyleSheet(light_button_style)
698
- self.F2.setStyleSheet(light_button_style)
699
- self.F3.setStyleSheet(light_button_style)
700
- self.F4.setStyleSheet(light_button_style)
701
- self.F5.setStyleSheet(light_button_style)
702
- self.F6.setStyleSheet(light_button_style)
703
- self.F7.setStyleSheet(light_button_style)
704
- self.F8.setStyleSheet(light_button_style)
705
- self.F9.setStyleSheet(light_button_style)
706
- self.F10.setStyleSheet(light_button_style)
707
- self.F11.setStyleSheet(light_button_style)
708
- self.F12.setStyleSheet(light_button_style)
709
658
 
710
659
  def set_radio_icon(self, state: int) -> None:
711
660
  """
@@ -770,7 +719,9 @@ class MainWindow(QtWidgets.QMainWindow):
770
719
  # self.send_backspace()
771
720
  self.oldtext = newtext
772
721
  return
773
- if self.cw is not None:
722
+ if self.pref.get("cwtype") == 3 and self.rig_control is not None:
723
+ self.rig_control.sendcw(newtext[len(self.oldtext) :])
724
+ elif self.cw is not None:
774
725
  self.cw.sendcw(newtext[len(self.oldtext) :])
775
726
  self.oldtext = newtext
776
727
 
@@ -985,6 +936,7 @@ class MainWindow(QtWidgets.QMainWindow):
985
936
  if self.station is None:
986
937
  self.station = {}
987
938
  self.current_op = self.station.get("Call", "")
939
+ self.voice_process.current_op = self.current_op
988
940
  self.make_op_dir()
989
941
  cmd = {}
990
942
  cmd["cmd"] = "NEWDB"
@@ -1021,6 +973,7 @@ class MainWindow(QtWidgets.QMainWindow):
1021
973
  if self.station.get("Call", "") == "":
1022
974
  self.edit_station_settings()
1023
975
  self.current_op = self.station.get("Call", "")
976
+ self.voice_process.current_op = self.current_op
1024
977
  self.make_op_dir()
1025
978
  cmd = {}
1026
979
  cmd["cmd"] = "NEWDB"
@@ -2181,6 +2134,7 @@ class MainWindow(QtWidgets.QMainWindow):
2181
2134
  self.settings_dialog.close()
2182
2135
  if self.current_op == "":
2183
2136
  self.current_op = self.station.get("Call", "")
2137
+ self.voice_process.current_op = self.current_op
2184
2138
  self.make_op_dir()
2185
2139
  contest_count = self.database.fetch_all_contests()
2186
2140
  if len(contest_count) == 0:
@@ -2262,61 +2216,6 @@ class MainWindow(QtWidgets.QMainWindow):
2262
2216
  )
2263
2217
  return macro
2264
2218
 
2265
- def voice_string(self, the_string: str) -> None:
2266
- """
2267
- voices string using nato phonetics.
2268
-
2269
- Parameters
2270
- ----------
2271
- the_string : str
2272
- String to voicify.
2273
-
2274
- Returns
2275
- -------
2276
- None
2277
- """
2278
-
2279
- logger.debug("Voicing: %s", the_string)
2280
- if sd is None:
2281
- logger.warning("Sounddevice/portaudio not installed.")
2282
- return
2283
- op_path = fsutils.USER_DATA_PATH / self.current_op
2284
- if "[" in the_string:
2285
- sub_string = the_string.strip("[]").lower()
2286
- filename = f"{str(op_path)}/{sub_string}.wav"
2287
- if Path(filename).is_file():
2288
- logger.debug("Voicing: %s", filename)
2289
- data, _fs = sf.read(filename, dtype="float32")
2290
- self.ptt_on()
2291
- try:
2292
- sd.default.device = self.pref.get("sounddevice", "default")
2293
- sd.default.samplerate = 44100.0
2294
- sd.play(data, blocking=False)
2295
- # _status = sd.wait()
2296
- # https://snyk.io/advisor/python/sounddevice/functions/sounddevice.PortAudioError
2297
- except sd.PortAudioError as err:
2298
- logger.warning("%s", f"{err}")
2299
-
2300
- self.ptt_off()
2301
- return
2302
- self.ptt_on()
2303
- for letter in the_string.lower():
2304
- if letter in "abcdefghijklmnopqrstuvwxyz 1234567890":
2305
- if letter == " ":
2306
- letter = "space"
2307
- filename = f"{str(op_path)}/{letter}.wav"
2308
- if Path(filename).is_file():
2309
- logger.debug("Voicing: %s", filename)
2310
- data, _fs = sf.read(filename, dtype="float32")
2311
- try:
2312
- sd.default.device = self.pref.get("sounddevice", "default")
2313
- sd.default.samplerate = 44100.0
2314
- sd.play(data, blocking=False)
2315
- logger.debug("%s", f"{sd.wait()}")
2316
- except sd.PortAudioError as err:
2317
- logger.warning("%s", f"{err}")
2318
- self.ptt_off()
2319
-
2320
2219
  def ptt_on(self) -> None:
2321
2220
  """
2322
2221
  Turn on ptt for rig.
@@ -2348,6 +2247,7 @@ class MainWindow(QtWidgets.QMainWindow):
2348
2247
  -------
2349
2248
  None
2350
2249
  """
2250
+
2351
2251
  logger.debug("PTT Off")
2352
2252
  if self.rig_control:
2353
2253
  self.leftdot.setPixmap(self.reddot)
@@ -2372,9 +2272,13 @@ class MainWindow(QtWidgets.QMainWindow):
2372
2272
  if self.n1mm:
2373
2273
  self.n1mm.radio_info["FunctionKeyCaption"] = function_key.text()
2374
2274
  if self.radio_state.get("mode") in ["LSB", "USB", "SSB"]:
2375
- self.voice_string(self.process_macro(function_key.toolTip()))
2275
+ self.voice_process.voice_string(self.process_macro(function_key.toolTip()))
2276
+ # self.voice_string(self.process_macro(function_key.toolTip()))
2376
2277
  return
2377
2278
  if self.cw:
2279
+ if self.pref.get("cwtype") == 3 and self.rig_control is not None:
2280
+ self.rig_control.sendcw(self.process_macro(function_key.toolTip()))
2281
+ return
2378
2282
  self.cw.sendcw(self.process_macro(function_key.toolTip()))
2379
2283
 
2380
2284
  def run_sp_buttons_clicked(self) -> None:
@@ -3163,6 +3067,7 @@ class MainWindow(QtWidgets.QMainWindow):
3163
3067
 
3164
3068
  if self.opon_dialog.NewOperator.text():
3165
3069
  self.current_op = self.opon_dialog.NewOperator.text().upper()
3070
+ self.voice_process.current_op = self.current_op
3166
3071
  self.opon_dialog.close()
3167
3072
  logger.debug("New Op: %s", self.current_op)
3168
3073
  self.make_op_dir()
not1mm/bandmap.py CHANGED
@@ -17,7 +17,7 @@ from decimal import Decimal
17
17
  from json import loads
18
18
 
19
19
  from PyQt6 import QtCore, QtGui, QtWidgets, uic, QtNetwork
20
- from PyQt6.QtGui import QColorConstants
20
+ from PyQt6.QtGui import QColorConstants, QPalette, QColor
21
21
  from PyQt6.QtWidgets import QDockWidget
22
22
 
23
23
  import not1mm.fsutils as fsutils
@@ -319,7 +319,7 @@ class BandMapWindow(QDockWidget):
319
319
  bandwidth_mark = []
320
320
  worked_list = {}
321
321
  multicast_interface = None
322
- text_color = QtGui.QColor(45, 45, 45)
322
+ text_color = QColor(45, 45, 45)
323
323
 
324
324
  def __init__(self):
325
325
  super().__init__()
@@ -366,101 +366,50 @@ class BandMapWindow(QDockWidget):
366
366
  return loads(file_descriptor.read())
367
367
 
368
368
  def setDarkMode(self, setdarkmode=False):
369
- """testing"""
370
-
369
+ """Set dark mode"""
371
370
  if setdarkmode:
372
- darkPalette = QtGui.QPalette()
373
- darkColor = QtGui.QColor(56, 56, 56)
371
+ darkPalette = QPalette()
372
+ darkColor = QColor(56, 56, 56)
374
373
  self.text_color = QColorConstants.White
375
- disabledColor = QtGui.QColor(127, 127, 127)
376
- darkPalette.setColor(QtGui.QPalette.ColorRole.Window, darkColor)
377
- darkPalette.setColor(
378
- QtGui.QPalette.ColorRole.WindowText, QColorConstants.White
379
- )
374
+ disabledColor = QColor(127, 127, 127)
375
+ darkPalette.setColor(QPalette.ColorRole.Window, darkColor)
376
+ darkPalette.setColor(QPalette.ColorRole.WindowText, QColorConstants.White)
377
+ darkPalette.setColor(QPalette.ColorRole.Base, QColor(45, 45, 45))
378
+ darkPalette.setColor(QPalette.ColorRole.AlternateBase, darkColor)
379
+ darkPalette.setColor(QPalette.ColorRole.Text, QColorConstants.White)
380
+ darkPalette.setColor(QPalette.ColorRole.Button, darkColor)
381
+ darkPalette.setColor(QPalette.ColorRole.ButtonText, QColorConstants.White)
382
+ darkPalette.setColor(QPalette.ColorRole.BrightText, QColorConstants.Red)
383
+ darkPalette.setColor(QPalette.ColorRole.Link, QColor(42, 130, 218))
384
+ darkPalette.setColor(QPalette.ColorRole.Highlight, QColor(42, 130, 218))
380
385
  darkPalette.setColor(
381
- QtGui.QPalette.ColorRole.Base, QtGui.QColor(45, 45, 45)
386
+ QPalette.ColorRole.HighlightedText, QColorConstants.Black
382
387
  )
383
- darkPalette.setColor(QtGui.QPalette.ColorRole.AlternateBase, darkColor)
384
- darkPalette.setColor(QtGui.QPalette.ColorRole.Text, QColorConstants.White)
385
388
  darkPalette.setColor(
386
- QtGui.QPalette.ColorGroup.Disabled,
387
- QtGui.QPalette.ColorRole.Text,
389
+ QPalette.ColorGroup.Disabled,
390
+ QPalette.ColorRole.ButtonText,
388
391
  disabledColor,
389
392
  )
390
- darkPalette.setColor(QtGui.QPalette.ColorRole.Button, darkColor)
391
- darkPalette.setColor(
392
- QtGui.QPalette.ColorRole.ButtonText, QColorConstants.White
393
- )
394
393
  darkPalette.setColor(
395
- QtGui.QPalette.ColorGroup.Disabled,
396
- QtGui.QPalette.ColorRole.ButtonText,
394
+ QPalette.ColorGroup.Disabled,
395
+ QPalette.ColorRole.HighlightedText,
397
396
  disabledColor,
398
397
  )
399
398
  darkPalette.setColor(
400
- QtGui.QPalette.ColorRole.BrightText, QColorConstants.Red
401
- )
402
- darkPalette.setColor(
403
- QtGui.QPalette.ColorRole.Link, QtGui.QColor(42, 130, 218)
404
- )
405
- darkPalette.setColor(
406
- QtGui.QPalette.ColorRole.Highlight, QtGui.QColor(42, 130, 218)
407
- )
408
- darkPalette.setColor(
409
- QtGui.QPalette.ColorRole.HighlightedText, QColorConstants.Black
410
- )
411
- darkPalette.setColor(
412
- QtGui.QPalette.ColorGroup.Disabled,
413
- QtGui.QPalette.ColorRole.HighlightedText,
399
+ QPalette.ColorGroup.Disabled,
400
+ QPalette.ColorRole.Text,
414
401
  disabledColor,
415
402
  )
416
403
 
417
404
  self.setPalette(darkPalette)
418
405
  self.callsignField.setPalette(darkPalette)
419
406
  self.update()
420
- dark_button_style = (
421
- "QPushButton {"
422
- "background-color: rgb(56,56,56);"
423
- "color: white;"
424
- "border-style: outset;"
425
- "border-width: 2px;"
426
- "border-radius: 5px;"
427
- "border-color: rgb(45,45,45);"
428
- "padding: 6px;"
429
- "}"
430
- "QPushButton:pressed {"
431
- "background-color: rgb(127, 127, 127);"
432
- "border-style: inset;"
433
- "}"
434
- )
435
- self.connectButton.setStyleSheet(dark_button_style)
436
- self.clearButton.setStyleSheet(dark_button_style)
437
- self.zoominButton.setStyleSheet(dark_button_style)
438
- self.zoomoutButton.setStyleSheet(dark_button_style)
439
407
  else:
440
408
  palette = self.style().standardPalette()
441
409
  self.setPalette(palette)
442
410
  self.callsignField.setPalette(palette)
443
411
  self.text_color = QColorConstants.Black
444
412
  self.update()
445
- light_button_style = (
446
- "QPushButton {"
447
- "background-color: rgb(245,245,245);"
448
- "color: rgb(52,52,52);"
449
- "border-style: outset;"
450
- "border-width: 2px;"
451
- "border-radius: 5px;"
452
- "border-color: rgb(150,150,150);"
453
- "padding: 6px;"
454
- "}"
455
- "QPushButton:pressed {"
456
- "background-color: rgb(127, 127, 127);"
457
- "border-style: inset;"
458
- "}"
459
- )
460
- self.connectButton.setStyleSheet(light_button_style)
461
- self.clearButton.setStyleSheet(light_button_style)
462
- self.zoominButton.setStyleSheet(light_button_style)
463
- self.zoomoutButton.setStyleSheet(light_button_style)
464
413
 
465
414
  def connect(self):
466
415
  """Connect to the cluster."""
@@ -686,11 +635,9 @@ class BandMapWindow(QDockWidget):
686
635
  self.clear_freq_mark(self.bandwidth_mark)
687
636
  self.clear_freq_mark(self.rxMark)
688
637
  self.draw_bandwidth(
689
- self.rx_freq, step, QtGui.QColor(30, 30, 180, 180), self.bandwidth_mark
690
- )
691
- self.drawfreqmark(
692
- self.rx_freq, step, QtGui.QColor(30, 180, 30, 180), self.rxMark
638
+ self.rx_freq, step, QColor(30, 30, 180, 180), self.bandwidth_mark
693
639
  )
640
+ self.drawfreqmark(self.rx_freq, step, QColor(30, 180, 30, 180), self.rxMark)
694
641
 
695
642
  def Freq2ScenePos(self, freq: float):
696
643
  """doc"""
@@ -751,7 +698,7 @@ class BandMapWindow(QDockWidget):
751
698
  if freq < self.currentBand.start or freq > self.currentBand.end:
752
699
  return
753
700
  if freq and self.bandwidth:
754
- # color = QtGui.QColor(30, 30, 180)
701
+ # color = QColor(30, 30, 180)
755
702
  bw_start = Decimal(str(freq)) - (
756
703
  (Decimal(str(self.bandwidth)) / 2) / 1000000
757
704
  )
@@ -786,11 +733,11 @@ class BandMapWindow(QDockWidget):
786
733
  for items in result:
787
734
  pen_color = self.text_color
788
735
  if items.get("comment") == "MARKED":
789
- pen_color = QtGui.QColor(47, 47, 255)
736
+ pen_color = QColor(47, 47, 255)
790
737
  if items.get("callsign") in self.worked_list:
791
738
  call_bandlist = self.worked_list.get(items.get("callsign"))
792
739
  if self.currentBand.altname in call_bandlist:
793
- pen_color = QtGui.QColor(255, 47, 47)
740
+ pen_color = QColor(255, 47, 47)
794
741
  freq_y = (
795
742
  (items.get("freq") - self.currentBand.start) / step
796
743
  ) * PIXELSPERSTEP
not1mm/checkwindow.py CHANGED
@@ -12,9 +12,9 @@ import queue
12
12
  from json import loads
13
13
  import Levenshtein
14
14
 
15
- from PyQt6 import QtGui, uic
15
+ from PyQt6 import uic
16
16
  from PyQt6.QtWidgets import QLabel, QVBoxLayout, QWidget, QDockWidget
17
- from PyQt6.QtGui import QMouseEvent, QColorConstants
17
+ from PyQt6.QtGui import QMouseEvent, QColorConstants, QPalette, QColor
18
18
 
19
19
  import not1mm.fsutils as fsutils
20
20
  from not1mm.lib.database import DataBase
@@ -70,51 +70,39 @@ class CheckWindow(QDockWidget):
70
70
  cmd["call"] = item
71
71
  self.multicast_interface.send_as_json(cmd)
72
72
 
73
- def setDarkMode(self, dark: bool):
73
+ def setDarkMode(self, dark: bool) -> None:
74
74
  """Forces a darkmode palette."""
75
75
 
76
76
  if dark:
77
- darkPalette = QtGui.QPalette()
78
- darkColor = QtGui.QColor(56, 56, 56)
79
- disabledColor = QtGui.QColor(127, 127, 127)
80
- darkPalette.setColor(QtGui.QPalette.ColorRole.Window, darkColor)
77
+ darkPalette = QPalette()
78
+ darkColor = QColor(56, 56, 56)
79
+ disabledColor = QColor(127, 127, 127)
80
+ darkPalette.setColor(QPalette.ColorRole.Window, darkColor)
81
+ darkPalette.setColor(QPalette.ColorRole.WindowText, QColorConstants.White)
82
+ darkPalette.setColor(QPalette.ColorRole.Base, QColor(45, 45, 45))
83
+ darkPalette.setColor(QPalette.ColorRole.AlternateBase, darkColor)
84
+ darkPalette.setColor(QPalette.ColorRole.Text, QColorConstants.White)
85
+ darkPalette.setColor(QPalette.ColorRole.Button, darkColor)
86
+ darkPalette.setColor(QPalette.ColorRole.ButtonText, QColorConstants.White)
87
+ darkPalette.setColor(QPalette.ColorRole.BrightText, QColorConstants.Red)
88
+ darkPalette.setColor(QPalette.ColorRole.Link, QColor(42, 130, 218))
89
+ darkPalette.setColor(QPalette.ColorRole.Highlight, QColor(42, 130, 218))
81
90
  darkPalette.setColor(
82
- QtGui.QPalette.ColorRole.WindowText, QColorConstants.White
91
+ QPalette.ColorRole.HighlightedText, QColorConstants.Black
83
92
  )
84
93
  darkPalette.setColor(
85
- QtGui.QPalette.ColorRole.Base, QtGui.QColor(45, 45, 45)
86
- )
87
- darkPalette.setColor(QtGui.QPalette.ColorRole.AlternateBase, darkColor)
88
- darkPalette.setColor(QtGui.QPalette.ColorRole.Text, QColorConstants.White)
89
- darkPalette.setColor(
90
- QtGui.QPalette.ColorGroup.Disabled,
91
- QtGui.QPalette.ColorRole.Text,
94
+ QPalette.ColorGroup.Disabled,
95
+ QPalette.ColorRole.ButtonText,
92
96
  disabledColor,
93
97
  )
94
- darkPalette.setColor(QtGui.QPalette.ColorRole.Button, darkColor)
95
- darkPalette.setColor(
96
- QtGui.QPalette.ColorRole.ButtonText, QColorConstants.White
97
- )
98
98
  darkPalette.setColor(
99
- QtGui.QPalette.ColorGroup.Disabled,
100
- QtGui.QPalette.ColorRole.ButtonText,
99
+ QPalette.ColorGroup.Disabled,
100
+ QPalette.ColorRole.HighlightedText,
101
101
  disabledColor,
102
102
  )
103
103
  darkPalette.setColor(
104
- QtGui.QPalette.ColorRole.BrightText, QColorConstants.Red
105
- )
106
- darkPalette.setColor(
107
- QtGui.QPalette.ColorRole.Link, QtGui.QColor(42, 130, 218)
108
- )
109
- darkPalette.setColor(
110
- QtGui.QPalette.ColorRole.Highlight, QtGui.QColor(42, 130, 218)
111
- )
112
- darkPalette.setColor(
113
- QtGui.QPalette.ColorRole.HighlightedText, QColorConstants.Black
114
- )
115
- darkPalette.setColor(
116
- QtGui.QPalette.ColorGroup.Disabled,
117
- QtGui.QPalette.ColorRole.HighlightedText,
104
+ QPalette.ColorGroup.Disabled,
105
+ QPalette.ColorRole.Text,
118
106
  disabledColor,
119
107
  )
120
108
 
@@ -726,7 +726,7 @@
726
726
  </widget>
727
727
  </item>
728
728
  <item row="2" column="3" alignment="Qt::AlignHCenter">
729
- <widget class="QRadioButton" name="radioButton_5">
729
+ <widget class="QRadioButton" name="usecwviacat_radioButton">
730
730
  <property name="font">
731
731
  <font>
732
732
  <family>JetBrains Mono</family>
@@ -735,13 +735,13 @@
735
735
  </font>
736
736
  </property>
737
737
  <property name="accessibleName">
738
- <string>none</string>
738
+ <string>CAT</string>
739
739
  </property>
740
740
  <property name="accessibleDescription">
741
- <string>none</string>
741
+ <string>use cat for c w</string>
742
742
  </property>
743
743
  <property name="text">
744
- <string>None</string>
744
+ <string>CAT</string>
745
745
  </property>
746
746
  </widget>
747
747
  </item>
@@ -1604,7 +1604,7 @@
1604
1604
  <tabstop>rigcontrolport_field</tabstop>
1605
1605
  <tabstop>cwport_field</tabstop>
1606
1606
  <tabstop>usepywinkeyer_radioButton</tabstop>
1607
- <tabstop>radioButton_5</tabstop>
1607
+ <tabstop>usecwviacat_radioButton</tabstop>
1608
1608
  <tabstop>cwip_field</tabstop>
1609
1609
  <tabstop>usecwdaemon_radioButton</tabstop>
1610
1610
  <tabstop>connect_to_server</tabstop>
@@ -90,6 +90,34 @@ class CAT:
90
90
  if self.interface == "rigctld":
91
91
  self.__initialize_rigctrld()
92
92
 
93
+ def sendcw(self, texttosend):
94
+ """..."""
95
+ logger.debug(f"{texttosend=} {self.interface=}")
96
+ if self.interface == "flrig":
97
+ ...
98
+ return
99
+ if self.interface == "rigctld":
100
+ self.sendcwrigctl(texttosend)
101
+
102
+ def sendcwrigctl(self, texttosend):
103
+ """..."""
104
+ if self.rigctrlsocket:
105
+ try:
106
+ self.online = True
107
+ self.rigctrlsocket.send(bytes(f"b{texttosend}\n", "utf-8"))
108
+ _ = self.rigctrlsocket.recv(1024).decode().strip()
109
+ return True
110
+ except socket.error as exception:
111
+ self.online = False
112
+ logger.debug("setvfo_rigctld: %s", f"{exception}")
113
+ self.rigctrlsocket = None
114
+ return False
115
+ self.__initialize_rigctrld()
116
+ return False
117
+
118
+ def sendcwxmlrpc(self, texttosend):
119
+ """..."""
120
+
93
121
  def get_vfo(self) -> str:
94
122
  """Poll the radio for current vfo using the interface"""
95
123
  vfo = ""