not1mm 24.3.15__py3-none-any.whl → 24.3.24__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 +288 -124
- not1mm/bandmap.py +207 -191
- not1mm/checkwindow.py +62 -109
- not1mm/data/MASTER.SCP +1077 -749
- not1mm/data/bandmap.ui +4 -4
- not1mm/data/checkwindow.ui +9 -16
- not1mm/data/cty.json +1 -1
- not1mm/data/logwindow.ui +16 -11
- not1mm/data/main.ui +16 -6
- not1mm/data/vfo.ui +64 -52
- not1mm/fsutils.py +63 -0
- not1mm/lib/about.py +4 -2
- not1mm/lib/cat_interface.py +1 -1
- not1mm/lib/cwinterface.py +1 -1
- not1mm/lib/database.py +4 -4
- not1mm/lib/edit_contact.py +2 -2
- not1mm/lib/edit_macro.py +2 -3
- not1mm/lib/edit_opon.py +2 -2
- not1mm/lib/edit_station.py +3 -3
- not1mm/lib/ham_utility.py +1 -1
- not1mm/lib/lookup.py +1 -1
- not1mm/lib/multicast.py +9 -4
- not1mm/lib/n1mm.py +1 -1
- not1mm/lib/new_contest.py +2 -2
- not1mm/lib/plugin_common.py +3 -2
- not1mm/lib/select_contest.py +2 -2
- not1mm/lib/settings.py +3 -4
- not1mm/lib/super_check_partial.py +8 -5
- not1mm/lib/version.py +1 -1
- not1mm/logwindow.py +62 -105
- not1mm/plugins/10_10_fall_cw.py +3 -1
- not1mm/plugins/10_10_spring_cw.py +3 -1
- not1mm/plugins/10_10_summer_phone.py +3 -1
- not1mm/plugins/10_10_winter_phone.py +3 -1
- not1mm/plugins/arrl_10m.py +3 -1
- not1mm/plugins/arrl_dx_cw.py +3 -1
- not1mm/plugins/arrl_dx_ssb.py +3 -1
- not1mm/plugins/arrl_field_day.py +3 -1
- not1mm/plugins/arrl_ss_cw.py +3 -1
- not1mm/plugins/arrl_ss_phone.py +3 -1
- not1mm/plugins/arrl_vhf_jan.py +3 -1
- not1mm/plugins/arrl_vhf_jun.py +3 -1
- not1mm/plugins/arrl_vhf_sep.py +3 -1
- not1mm/plugins/canada_day.py +3 -1
- not1mm/plugins/cq_160_cw.py +4 -2
- not1mm/plugins/cq_160_ssb.py +4 -2
- not1mm/plugins/cq_wpx_cw.py +3 -1
- not1mm/plugins/cq_wpx_ssb.py +3 -1
- not1mm/plugins/cq_ww_cw.py +3 -1
- not1mm/plugins/cq_ww_ssb.py +3 -1
- not1mm/plugins/cwt.py +3 -1
- not1mm/plugins/general_logging.py +1 -1
- not1mm/plugins/iaru_hf.py +3 -1
- not1mm/plugins/jidx_cw.py +3 -1
- not1mm/plugins/jidx_ph.py +3 -1
- not1mm/plugins/naqp_cw.py +3 -1
- not1mm/plugins/naqp_ssb.py +3 -1
- not1mm/plugins/phone_weekly_test.py +3 -1
- not1mm/plugins/stew_perry_topband.py +3 -1
- not1mm/plugins/winter_field_day.py +3 -1
- not1mm/vfo.py +78 -98
- {not1mm-24.3.15.dist-info → not1mm-24.3.24.dist-info}/METADATA +68 -55
- {not1mm-24.3.15.dist-info → not1mm-24.3.24.dist-info}/RECORD +69 -67
- testing/detectdark.py +35 -0
- testing/test.py +13 -11
- {not1mm-24.3.15.dist-info → not1mm-24.3.24.dist-info}/LICENSE +0 -0
- {not1mm-24.3.15.dist-info → not1mm-24.3.24.dist-info}/WHEEL +0 -0
- {not1mm-24.3.15.dist-info → not1mm-24.3.24.dist-info}/entry_points.txt +0 -0
- {not1mm-24.3.15.dist-info → not1mm-24.3.24.dist-info}/top_level.txt +0 -0
not1mm/plugins/cq_ww_ssb.py
CHANGED
@@ -12,7 +12,7 @@ from PyQt5 import QtWidgets
|
|
12
12
|
from not1mm.lib.plugin_common import gen_adif, get_points
|
13
13
|
from not1mm.lib.version import __version__
|
14
14
|
|
15
|
-
logger = logging.getLogger(
|
15
|
+
logger = logging.getLogger(__name__)
|
16
16
|
|
17
17
|
name = "CQ WW SSB"
|
18
18
|
cabrillo_name = "CQ-WW-SSB"
|
@@ -333,8 +333,10 @@ def cabrillo(self):
|
|
333
333
|
file=file_descriptor,
|
334
334
|
)
|
335
335
|
print("END-OF-LOG:", end="\r\n", file=file_descriptor)
|
336
|
+
self.show_message_box(f"Cabrillo saved to: {filename}")
|
336
337
|
except IOError as exception:
|
337
338
|
logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
|
339
|
+
self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
|
338
340
|
return
|
339
341
|
|
340
342
|
|
not1mm/plugins/cwt.py
CHANGED
@@ -12,7 +12,7 @@ from PyQt5 import QtWidgets
|
|
12
12
|
from not1mm.lib.plugin_common import gen_adif, get_points
|
13
13
|
from not1mm.lib.version import __version__
|
14
14
|
|
15
|
-
logger = logging.getLogger(
|
15
|
+
logger = logging.getLogger(__name__)
|
16
16
|
name = "CWT"
|
17
17
|
mode = "CW" # CW SSB BOTH RTTY
|
18
18
|
# columns = [0, 1, 2, 3, 4, 5, 6, 11, 15]
|
@@ -339,8 +339,10 @@ def cabrillo(self):
|
|
339
339
|
file=file_descriptor,
|
340
340
|
)
|
341
341
|
print("END-OF-LOG:", end="\r\n", file=file_descriptor)
|
342
|
+
self.show_message_box(f"Cabrillo saved to: {filename}")
|
342
343
|
except IOError as exception:
|
343
344
|
logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
|
345
|
+
self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
|
344
346
|
return
|
345
347
|
|
346
348
|
|
@@ -9,7 +9,7 @@ from PyQt5 import QtWidgets
|
|
9
9
|
from not1mm.lib.plugin_common import gen_adif, get_points
|
10
10
|
from not1mm.lib.version import __version__
|
11
11
|
|
12
|
-
logger = logging.getLogger(
|
12
|
+
logger = logging.getLogger(__name__)
|
13
13
|
|
14
14
|
name = "General Logging"
|
15
15
|
cabrillo_name = "General-Logging"
|
not1mm/plugins/iaru_hf.py
CHANGED
@@ -25,7 +25,7 @@ from PyQt5 import QtWidgets
|
|
25
25
|
from not1mm.lib.plugin_common import gen_adif, get_points
|
26
26
|
from not1mm.lib.version import __version__
|
27
27
|
|
28
|
-
logger = logging.getLogger(
|
28
|
+
logger = logging.getLogger(__name__)
|
29
29
|
|
30
30
|
name = "IARU HF"
|
31
31
|
cabrillo_name = "IARU-HF"
|
@@ -350,8 +350,10 @@ def cabrillo(self):
|
|
350
350
|
file=file_descriptor,
|
351
351
|
)
|
352
352
|
print("END-OF-LOG:", end="\r\n", file=file_descriptor)
|
353
|
+
self.show_message_box(f"Cabrillo saved to: {filename}")
|
353
354
|
except IOError as exception:
|
354
355
|
logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
|
356
|
+
self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
|
355
357
|
return
|
356
358
|
|
357
359
|
|
not1mm/plugins/jidx_cw.py
CHANGED
@@ -12,7 +12,7 @@ from PyQt5 import QtWidgets
|
|
12
12
|
from not1mm.lib.plugin_common import gen_adif, get_points
|
13
13
|
from not1mm.lib.version import __version__
|
14
14
|
|
15
|
-
logger = logging.getLogger(
|
15
|
+
logger = logging.getLogger(__name__)
|
16
16
|
|
17
17
|
name = "JIDX CW"
|
18
18
|
cabrillo_name = "JIDX-CW"
|
@@ -330,8 +330,10 @@ def cabrillo(self):
|
|
330
330
|
file=file_descriptor,
|
331
331
|
)
|
332
332
|
print("END-OF-LOG:", end="\r\n", file=file_descriptor)
|
333
|
+
self.show_message_box(f"Cabrillo saved to: {filename}")
|
333
334
|
except IOError as exception:
|
334
335
|
logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
|
336
|
+
self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
|
335
337
|
return
|
336
338
|
|
337
339
|
|
not1mm/plugins/jidx_ph.py
CHANGED
@@ -12,7 +12,7 @@ from PyQt5 import QtWidgets
|
|
12
12
|
from not1mm.lib.plugin_common import gen_adif, get_points
|
13
13
|
from not1mm.lib.version import __version__
|
14
14
|
|
15
|
-
logger = logging.getLogger(
|
15
|
+
logger = logging.getLogger(__name__)
|
16
16
|
|
17
17
|
name = "JIDX PH"
|
18
18
|
cabrillo_name = "JIDX-PH"
|
@@ -330,8 +330,10 @@ def cabrillo(self):
|
|
330
330
|
file=file_descriptor,
|
331
331
|
)
|
332
332
|
print("END-OF-LOG:", end="\r\n", file=file_descriptor)
|
333
|
+
self.show_message_box(f"Cabrillo saved to: {filename}")
|
333
334
|
except IOError as exception:
|
334
335
|
logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
|
336
|
+
self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
|
335
337
|
return
|
336
338
|
|
337
339
|
|
not1mm/plugins/naqp_cw.py
CHANGED
@@ -13,7 +13,7 @@ from PyQt5 import QtWidgets
|
|
13
13
|
from not1mm.lib.plugin_common import gen_adif, get_points
|
14
14
|
from not1mm.lib.version import __version__
|
15
15
|
|
16
|
-
logger = logging.getLogger(
|
16
|
+
logger = logging.getLogger(__name__)
|
17
17
|
|
18
18
|
name = "NAQP CW"
|
19
19
|
cabrillo_name = "NAQP-CW"
|
@@ -325,8 +325,10 @@ def cabrillo(self):
|
|
325
325
|
file=file_descriptor,
|
326
326
|
)
|
327
327
|
print("END-OF-LOG:", end="\r\n", file=file_descriptor)
|
328
|
+
self.show_message_box(f"Cabrillo saved to: {filename}")
|
328
329
|
except IOError as exception:
|
329
330
|
logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
|
331
|
+
self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
|
330
332
|
return
|
331
333
|
|
332
334
|
|
not1mm/plugins/naqp_ssb.py
CHANGED
@@ -13,7 +13,7 @@ from PyQt5 import QtWidgets
|
|
13
13
|
from not1mm.lib.plugin_common import gen_adif, get_points
|
14
14
|
from not1mm.lib.version import __version__
|
15
15
|
|
16
|
-
logger = logging.getLogger(
|
16
|
+
logger = logging.getLogger(__name__)
|
17
17
|
|
18
18
|
name = "NAQP SSB"
|
19
19
|
cabrillo_name = "NAQP-SSB"
|
@@ -325,8 +325,10 @@ def cabrillo(self):
|
|
325
325
|
file=file_descriptor,
|
326
326
|
)
|
327
327
|
print("END-OF-LOG:", end="\r\n", file=file_descriptor)
|
328
|
+
self.show_message_box(f"Cabrillo saved to: {filename}")
|
328
329
|
except IOError as exception:
|
329
330
|
logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
|
331
|
+
self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
|
330
332
|
return
|
331
333
|
|
332
334
|
|
@@ -35,7 +35,7 @@ from PyQt5 import QtWidgets
|
|
35
35
|
from not1mm.lib.plugin_common import gen_adif, get_points
|
36
36
|
from not1mm.lib.version import __version__
|
37
37
|
|
38
|
-
logger = logging.getLogger(
|
38
|
+
logger = logging.getLogger(__name__)
|
39
39
|
|
40
40
|
name = "PHONE WEEKLY TEST"
|
41
41
|
cabrillo_name = "PHONE-WEEKLY-TEST"
|
@@ -347,8 +347,10 @@ def cabrillo(self):
|
|
347
347
|
file=file_descriptor,
|
348
348
|
)
|
349
349
|
print("END-OF-LOG:", end="\r\n", file=file_descriptor)
|
350
|
+
self.show_message_box(f"Cabrillo saved to: {filename}")
|
350
351
|
except IOError as exception:
|
351
352
|
logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
|
353
|
+
self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
|
352
354
|
return
|
353
355
|
|
354
356
|
|
@@ -37,7 +37,7 @@ from not1mm.lib.plugin_common import gen_adif, get_points
|
|
37
37
|
from not1mm.lib.version import __version__
|
38
38
|
from not1mm.lib.ham_utility import distance
|
39
39
|
|
40
|
-
logger = logging.getLogger(
|
40
|
+
logger = logging.getLogger(__name__)
|
41
41
|
|
42
42
|
cabrillo_name = "STEW-PERRY"
|
43
43
|
name = "Stew Perry Topband"
|
@@ -325,8 +325,10 @@ def cabrillo(self):
|
|
325
325
|
file=file_descriptor,
|
326
326
|
)
|
327
327
|
print("END-OF-LOG:", end="\r\n", file=file_descriptor)
|
328
|
+
self.show_message_box(f"Cabrillo saved to: {filename}")
|
328
329
|
except IOError as exception:
|
329
330
|
logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
|
331
|
+
self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
|
330
332
|
return
|
331
333
|
|
332
334
|
|
@@ -10,7 +10,7 @@ from PyQt5 import QtWidgets
|
|
10
10
|
from not1mm.lib.plugin_common import gen_adif, get_points
|
11
11
|
from not1mm.lib.version import __version__
|
12
12
|
|
13
|
-
logger = logging.getLogger(
|
13
|
+
logger = logging.getLogger(__name__)
|
14
14
|
|
15
15
|
cabrillo_name = "WFD"
|
16
16
|
name = "Winter Field Day"
|
@@ -310,8 +310,10 @@ def cabrillo(self):
|
|
310
310
|
file=file_descriptor,
|
311
311
|
)
|
312
312
|
print("END-OF-LOG:", end="\r\n", file=file_descriptor)
|
313
|
+
self.show_message_box(f"Cabrillo saved to: {filename}")
|
313
314
|
except IOError as exception:
|
314
315
|
logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
|
316
|
+
self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
|
315
317
|
return
|
316
318
|
|
317
319
|
|
not1mm/vfo.py
CHANGED
@@ -9,58 +9,35 @@ VFO Window
|
|
9
9
|
# usb-Raspberry_Pi_Pico_W_E6614C311B331139-if00
|
10
10
|
|
11
11
|
import logging
|
12
|
-
|
13
12
|
import os
|
14
|
-
|
15
13
|
import platform
|
16
|
-
import queue
|
17
|
-
import sys
|
18
14
|
from json import loads, JSONDecodeError
|
19
|
-
from pathlib import Path
|
20
15
|
|
21
16
|
import serial
|
22
|
-
from PyQt5 import QtCore,
|
23
|
-
from PyQt5.QtCore import QTimer
|
24
|
-
from PyQt5.QtWidgets import
|
17
|
+
from PyQt5 import QtCore, QtGui, QtWidgets, uic
|
18
|
+
from PyQt5.QtCore import Qt, QTimer
|
19
|
+
from PyQt5.QtWidgets import QWidget
|
25
20
|
|
21
|
+
import not1mm.fsutils as fsutils
|
26
22
|
from not1mm.lib.cat_interface import CAT
|
27
23
|
from not1mm.lib.multicast import Multicast
|
28
24
|
|
29
|
-
|
30
|
-
|
31
|
-
if __loader__:
|
32
|
-
WORKING_PATH = os.path.dirname(__loader__.get_filename())
|
33
|
-
else:
|
34
|
-
WORKING_PATH = os.path.dirname(os.path.realpath(__file__))
|
25
|
+
logger = logging.getLogger(__name__)
|
35
26
|
|
36
|
-
if "XDG_DATA_HOME" in os.environ:
|
37
|
-
DATA_PATH = os.environ.get("XDG_DATA_HOME")
|
38
|
-
else:
|
39
|
-
DATA_PATH = str(Path.home() / ".local" / "share")
|
40
|
-
DATA_PATH += "/not1mm"
|
41
27
|
|
42
|
-
|
43
|
-
|
44
|
-
else:
|
45
|
-
CONFIG_PATH = str(Path.home() / ".config")
|
46
|
-
CONFIG_PATH += "/not1mm"
|
47
|
-
|
48
|
-
|
49
|
-
class MainWindow(QMainWindow):
|
50
|
-
"""
|
51
|
-
The main window
|
52
|
-
"""
|
28
|
+
class VfoWindow(QWidget):
|
29
|
+
"""The VFO window."""
|
53
30
|
|
54
31
|
pref = {}
|
55
32
|
old_vfo = ""
|
56
33
|
old_pico = ""
|
57
34
|
message_shown = False
|
58
35
|
multicast_interface = None
|
36
|
+
current_palette = None
|
59
37
|
|
60
38
|
def __init__(self, *args, **kwargs):
|
61
39
|
super().__init__(*args, **kwargs)
|
62
|
-
|
63
|
-
uic.loadUi(data_path, self)
|
40
|
+
uic.loadUi(fsutils.APP_DATA_PATH / "vfo.ui", self)
|
64
41
|
self.rig_control = None
|
65
42
|
self.timer = QTimer()
|
66
43
|
self.timer.timeout.connect(self.getwaiting)
|
@@ -69,7 +46,7 @@ class MainWindow(QMainWindow):
|
|
69
46
|
self.lcdNumber.display(0)
|
70
47
|
self.pico = None
|
71
48
|
self._udpwatch = None
|
72
|
-
|
49
|
+
|
73
50
|
self.multicast_interface = Multicast(
|
74
51
|
self.pref.get("multicast_group", "239.1.1.1"),
|
75
52
|
self.pref.get("multicast_port", 2239),
|
@@ -77,9 +54,45 @@ class MainWindow(QMainWindow):
|
|
77
54
|
)
|
78
55
|
self.multicast_interface.ready_read_connect(self.watch_udp)
|
79
56
|
|
80
|
-
|
81
|
-
|
82
|
-
|
57
|
+
self.setup_serial()
|
58
|
+
# app.processEvents()
|
59
|
+
self.poll_rig_timer = QtCore.QTimer()
|
60
|
+
self.poll_rig_timer.timeout.connect(self.poll_radio)
|
61
|
+
self.poll_rig_timer.start(500)
|
62
|
+
|
63
|
+
def setDarkMode(self, dark: bool):
|
64
|
+
"""testing"""
|
65
|
+
|
66
|
+
if dark:
|
67
|
+
darkPalette = QtGui.QPalette()
|
68
|
+
darkColor = QtGui.QColor(45, 45, 45)
|
69
|
+
disabledColor = QtGui.QColor(127, 127, 127)
|
70
|
+
darkPalette.setColor(QtGui.QPalette.Window, darkColor)
|
71
|
+
darkPalette.setColor(QtGui.QPalette.WindowText, Qt.white)
|
72
|
+
darkPalette.setColor(QtGui.QPalette.Base, QtGui.QColor(18, 18, 18))
|
73
|
+
darkPalette.setColor(QtGui.QPalette.AlternateBase, darkColor)
|
74
|
+
darkPalette.setColor(QtGui.QPalette.Text, Qt.white)
|
75
|
+
darkPalette.setColor(
|
76
|
+
QtGui.QPalette.Disabled, QtGui.QPalette.Text, disabledColor
|
77
|
+
)
|
78
|
+
darkPalette.setColor(QtGui.QPalette.Button, darkColor)
|
79
|
+
darkPalette.setColor(QtGui.QPalette.ButtonText, Qt.white)
|
80
|
+
darkPalette.setColor(
|
81
|
+
QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, disabledColor
|
82
|
+
)
|
83
|
+
darkPalette.setColor(QtGui.QPalette.BrightText, Qt.red)
|
84
|
+
darkPalette.setColor(QtGui.QPalette.Link, QtGui.QColor(42, 130, 218))
|
85
|
+
darkPalette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(42, 130, 218))
|
86
|
+
darkPalette.setColor(QtGui.QPalette.HighlightedText, Qt.black)
|
87
|
+
darkPalette.setColor(
|
88
|
+
QtGui.QPalette.Disabled, QtGui.QPalette.HighlightedText, disabledColor
|
89
|
+
)
|
90
|
+
self.current_palette = darkPalette
|
91
|
+
self.setPalette(darkPalette)
|
92
|
+
else:
|
93
|
+
palette = self.style().standardPalette()
|
94
|
+
self.current_palette = palette
|
95
|
+
self.setPalette(palette)
|
83
96
|
|
84
97
|
def load_pref(self) -> None:
|
85
98
|
"""
|
@@ -87,9 +100,9 @@ class MainWindow(QMainWindow):
|
|
87
100
|
Get CAT interface.
|
88
101
|
"""
|
89
102
|
try:
|
90
|
-
if os.path.exists(
|
103
|
+
if os.path.exists(fsutils.CONFIG_FILE):
|
91
104
|
with open(
|
92
|
-
|
105
|
+
fsutils.CONFIG_FILE, "rt", encoding="utf-8"
|
93
106
|
) as file_descriptor:
|
94
107
|
self.pref = loads(file_descriptor.read())
|
95
108
|
logger.info("%s", self.pref)
|
@@ -119,6 +132,7 @@ class MainWindow(QMainWindow):
|
|
119
132
|
int(self.pref.get("CAT_port", 4532)),
|
120
133
|
)
|
121
134
|
self.timer.start(100)
|
135
|
+
self.setDarkMode(self.pref.get("darkmode", False))
|
122
136
|
|
123
137
|
def discover_device(self) -> str:
|
124
138
|
"""
|
@@ -131,7 +145,7 @@ class MainWindow(QMainWindow):
|
|
131
145
|
|
132
146
|
devices = None
|
133
147
|
data = None
|
134
|
-
app.processEvents()
|
148
|
+
# app.processEvents()
|
135
149
|
try:
|
136
150
|
devices = os.listdir("/dev/serial/by-id")
|
137
151
|
except FileNotFoundError:
|
@@ -154,29 +168,28 @@ class MainWindow(QMainWindow):
|
|
154
168
|
Setup the device returned by discover_device()
|
155
169
|
Or display message saying we didn't find one.
|
156
170
|
"""
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
except OSError:
|
166
|
-
if self.message_shown is False:
|
167
|
-
self.message_shown = True
|
168
|
-
self.show_message_box(
|
169
|
-
"Unable to locate or open the VFO knob serial device."
|
170
|
-
)
|
171
|
-
self.lcdNumber.setStyleSheet("QLCDNumber { color: red; }")
|
172
|
-
else:
|
171
|
+
|
172
|
+
device = self.discover_device()
|
173
|
+
if device:
|
174
|
+
try:
|
175
|
+
self.pico = serial.Serial("/dev/serial/by-id/" + device, 115200)
|
176
|
+
self.pico.timeout = 100
|
177
|
+
self.lcdNumber.setStyleSheet("QLCDNumber { color: white; }")
|
178
|
+
except OSError:
|
173
179
|
if self.message_shown is False:
|
174
180
|
self.message_shown = True
|
175
181
|
self.show_message_box(
|
176
182
|
"Unable to locate or open the VFO knob serial device."
|
177
183
|
)
|
178
184
|
self.lcdNumber.setStyleSheet("QLCDNumber { color: red; }")
|
179
|
-
|
185
|
+
else:
|
186
|
+
if self.message_shown is False:
|
187
|
+
self.message_shown = True
|
188
|
+
self.show_message_box(
|
189
|
+
"Unable to locate or open the VFO knob serial device."
|
190
|
+
)
|
191
|
+
self.lcdNumber.setStyleSheet("QLCDNumber { color: red; }")
|
192
|
+
# app.processEvents()
|
180
193
|
|
181
194
|
def watch_udp(self) -> None:
|
182
195
|
"""
|
@@ -200,8 +213,7 @@ class MainWindow(QMainWindow):
|
|
200
213
|
if json_data.get("station", "") != platform.node():
|
201
214
|
continue
|
202
215
|
logger.debug(f"{json_data=}")
|
203
|
-
|
204
|
-
self.quit_app()
|
216
|
+
|
205
217
|
if json_data.get("cmd", "") == "TUNE":
|
206
218
|
# b'{"cmd": "TUNE", "freq": 7.0235, "spot": "MM0DGI"}'
|
207
219
|
vfo = json_data.get("freq")
|
@@ -214,6 +226,9 @@ class MainWindow(QMainWindow):
|
|
214
226
|
logger.critical("Unable to write to serial device.")
|
215
227
|
except AttributeError:
|
216
228
|
logger.critical("Unable to write to serial device.")
|
229
|
+
continue
|
230
|
+
if json_data.get("cmd", "") == "DARKMODE":
|
231
|
+
self.setDarkMode(json_data.get("state", False))
|
217
232
|
|
218
233
|
def showNumber(self, the_number) -> None:
|
219
234
|
"""Display vfo value with dots"""
|
@@ -221,7 +236,7 @@ class MainWindow(QMainWindow):
|
|
221
236
|
if len(dvfo) > 6:
|
222
237
|
dnum = f"{dvfo[:len(dvfo)-6]}.{dvfo[-6:-3]}.{dvfo[-3:]}"
|
223
238
|
self.lcdNumber.display(dnum)
|
224
|
-
app.processEvents()
|
239
|
+
# app.processEvents()
|
225
240
|
|
226
241
|
def poll_radio(self) -> None:
|
227
242
|
"""
|
@@ -244,7 +259,7 @@ class MainWindow(QMainWindow):
|
|
244
259
|
logger.debug(f"{vfo}")
|
245
260
|
self.showNumber(vfo)
|
246
261
|
# self.lcdNumber.display(dnum)
|
247
|
-
app.processEvents()
|
262
|
+
# app.processEvents()
|
248
263
|
cmd = f"F {vfo}\r"
|
249
264
|
try:
|
250
265
|
if self.pico:
|
@@ -271,56 +286,21 @@ class MainWindow(QMainWindow):
|
|
271
286
|
self.rig_control.set_vfo(result)
|
272
287
|
self.showNumber(result)
|
273
288
|
# self.lcdNumber.display(result)
|
274
|
-
app.processEvents()
|
289
|
+
# app.processEvents()
|
275
290
|
except OSError:
|
276
291
|
logger.critical("Unable to write to serial device.")
|
277
292
|
except AttributeError:
|
278
293
|
logger.critical("Unable to write to serial device.")
|
279
|
-
app.processEvents()
|
294
|
+
# app.processEvents()
|
280
295
|
|
281
296
|
def show_message_box(self, message: str) -> None:
|
282
297
|
"""
|
283
298
|
Display an alert box with the supplied message.
|
284
299
|
"""
|
285
300
|
message_box = QtWidgets.QMessageBox()
|
301
|
+
message_box.setPalette(self.current_palette)
|
286
302
|
message_box.setIcon(QtWidgets.QMessageBox.Information)
|
287
303
|
message_box.setText(message)
|
288
304
|
message_box.setWindowTitle("Information")
|
289
305
|
message_box.setStandardButtons(QtWidgets.QMessageBox.Ok)
|
290
306
|
_ = message_box.exec_()
|
291
|
-
|
292
|
-
|
293
|
-
def main():
|
294
|
-
"""main entry"""
|
295
|
-
window.show()
|
296
|
-
window.setup_serial()
|
297
|
-
app.processEvents()
|
298
|
-
timer = QtCore.QTimer()
|
299
|
-
timer.timeout.connect(window.poll_radio)
|
300
|
-
timer.start(250)
|
301
|
-
sys.exit(app.exec())
|
302
|
-
|
303
|
-
|
304
|
-
logger = logging.getLogger("__main__")
|
305
|
-
handler = logging.StreamHandler()
|
306
|
-
formatter = logging.Formatter(
|
307
|
-
datefmt="%H:%M:%S",
|
308
|
-
fmt="[%(asctime)s] %(levelname)s %(module)s - %(funcName)s Line %(lineno)d:\n%(message)s",
|
309
|
-
)
|
310
|
-
handler.setFormatter(formatter)
|
311
|
-
logger.addHandler(handler)
|
312
|
-
|
313
|
-
if Path("./debug").exists():
|
314
|
-
logger.setLevel(logging.DEBUG)
|
315
|
-
logger.debug("debugging on")
|
316
|
-
else:
|
317
|
-
logger.setLevel(logging.WARNING)
|
318
|
-
logger.warning("debugging off")
|
319
|
-
|
320
|
-
app = QApplication(sys.argv)
|
321
|
-
app.setStyle("Adwaita-Dark")
|
322
|
-
window = MainWindow()
|
323
|
-
|
324
|
-
|
325
|
-
if __name__ == "__main__":
|
326
|
-
main()
|