not1mm 24.3.16__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/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 +1 -1
- not1mm/plugins/10_10_spring_cw.py +1 -1
- not1mm/plugins/10_10_summer_phone.py +1 -1
- not1mm/plugins/10_10_winter_phone.py +1 -1
- not1mm/plugins/arrl_10m.py +1 -1
- not1mm/plugins/arrl_dx_cw.py +1 -1
- not1mm/plugins/arrl_dx_ssb.py +1 -1
- not1mm/plugins/arrl_field_day.py +1 -1
- not1mm/plugins/arrl_ss_cw.py +1 -1
- not1mm/plugins/arrl_ss_phone.py +1 -1
- not1mm/plugins/arrl_vhf_jan.py +1 -1
- not1mm/plugins/arrl_vhf_jun.py +1 -1
- not1mm/plugins/arrl_vhf_sep.py +1 -1
- not1mm/plugins/canada_day.py +1 -1
- not1mm/plugins/cq_160_cw.py +1 -1
- not1mm/plugins/cq_160_ssb.py +1 -1
- not1mm/plugins/cq_wpx_cw.py +1 -1
- not1mm/plugins/cq_wpx_ssb.py +1 -1
- not1mm/plugins/cq_ww_cw.py +1 -1
- not1mm/plugins/cq_ww_ssb.py +1 -1
- not1mm/plugins/cwt.py +1 -1
- not1mm/plugins/general_logging.py +1 -1
- not1mm/plugins/iaru_hf.py +1 -1
- not1mm/plugins/jidx_cw.py +1 -1
- not1mm/plugins/jidx_ph.py +1 -1
- not1mm/plugins/naqp_cw.py +1 -1
- not1mm/plugins/naqp_ssb.py +1 -1
- not1mm/plugins/phone_weekly_test.py +1 -1
- not1mm/plugins/stew_perry_topband.py +1 -1
- not1mm/plugins/winter_field_day.py +1 -1
- not1mm/vfo.py +78 -98
- {not1mm-24.3.16.dist-info → not1mm-24.3.24.dist-info}/METADATA +67 -55
- {not1mm-24.3.16.dist-info → not1mm-24.3.24.dist-info}/RECORD +68 -66
- testing/detectdark.py +35 -0
- testing/test.py +13 -11
- {not1mm-24.3.16.dist-info → not1mm-24.3.24.dist-info}/LICENSE +0 -0
- {not1mm-24.3.16.dist-info → not1mm-24.3.24.dist-info}/WHEEL +0 -0
- {not1mm-24.3.16.dist-info → not1mm-24.3.24.dist-info}/entry_points.txt +0 -0
- {not1mm-24.3.16.dist-info → not1mm-24.3.24.dist-info}/top_level.txt +0 -0
not1mm/checkwindow.py
CHANGED
@@ -3,47 +3,29 @@
|
|
3
3
|
Check Window
|
4
4
|
"""
|
5
5
|
# pylint: disable=no-name-in-module, unused-import, no-member, invalid-name, c-extension-no-member
|
6
|
+
# pylint: disable=logging-fstring-interpolation, line-too-long
|
6
7
|
|
7
8
|
import logging
|
8
|
-
|
9
|
+
import os
|
9
10
|
import platform
|
10
11
|
import queue
|
11
|
-
import os
|
12
|
-
import sys
|
13
|
-
|
14
12
|
from json import loads
|
15
|
-
from pathlib import Path
|
16
13
|
|
17
|
-
from PyQt5 import uic
|
18
|
-
from PyQt5.QtCore import
|
19
|
-
from PyQt5.QtWidgets import
|
20
|
-
from PyQt5.
|
14
|
+
from PyQt5 import QtGui, uic
|
15
|
+
from PyQt5.QtCore import Qt
|
16
|
+
from PyQt5.QtWidgets import QListWidgetItem
|
17
|
+
from PyQt5.QtWidgets import QWidget
|
21
18
|
|
19
|
+
import not1mm.fsutils as fsutils
|
22
20
|
from not1mm.lib.database import DataBase
|
23
21
|
from not1mm.lib.multicast import Multicast
|
24
22
|
from not1mm.lib.super_check_partial import SCP
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
WORKING_PATH = os.path.dirname(__loader__.get_filename())
|
29
|
-
|
30
|
-
if "XDG_DATA_HOME" in os.environ:
|
31
|
-
DATA_PATH = os.environ.get("XDG_DATA_HOME")
|
32
|
-
else:
|
33
|
-
DATA_PATH = str(Path.home() / ".local" / "share")
|
34
|
-
DATA_PATH += "/not1mm"
|
24
|
+
logger = logging.getLogger(__name__)
|
35
25
|
|
36
|
-
if "XDG_CONFIG_HOME" in os.environ:
|
37
|
-
CONFIG_PATH = os.environ.get("XDG_CONFIG_HOME")
|
38
|
-
else:
|
39
|
-
CONFIG_PATH = str(Path.home() / ".config")
|
40
|
-
CONFIG_PATH += "/not1mm"
|
41
26
|
|
42
|
-
|
43
|
-
|
44
|
-
"""
|
45
|
-
The main window
|
46
|
-
"""
|
27
|
+
class CheckWindow(QWidget):
|
28
|
+
"""The check window. Shows list or probable stations."""
|
47
29
|
|
48
30
|
multicast_interface = None
|
49
31
|
dbname = None
|
@@ -52,45 +34,66 @@ class MainWindow(QMainWindow):
|
|
52
34
|
def __init__(self, *args, **kwargs):
|
53
35
|
super().__init__(*args, **kwargs)
|
54
36
|
self.load_pref()
|
55
|
-
self.dbname =
|
56
|
-
|
37
|
+
self.dbname = fsutils.USER_DATA_PATH / self.pref.get(
|
38
|
+
"current_database", "ham.db"
|
39
|
+
)
|
40
|
+
self.database = DataBase(self.dbname, fsutils.APP_DATA_PATH)
|
57
41
|
self.database.current_contest = self.pref.get("contest", 0)
|
58
|
-
|
59
|
-
uic.loadUi(
|
60
|
-
|
42
|
+
|
43
|
+
uic.loadUi(fsutils.APP_DATA_PATH / "checkwindow.ui", self)
|
44
|
+
|
61
45
|
self.logList.clear()
|
62
46
|
self.masterList.clear()
|
63
47
|
self.telnetList.clear()
|
64
48
|
self.callhistoryList.clear()
|
65
49
|
self.callhistoryList.hide()
|
66
50
|
self.callhistoryListLabel.hide()
|
67
|
-
self.mscp = SCP(
|
51
|
+
self.mscp = SCP(fsutils.APP_DATA_PATH)
|
68
52
|
self._udpwatch = None
|
69
53
|
self.udp_fifo = queue.Queue()
|
70
54
|
self.multicast_interface = Multicast(
|
71
55
|
self.pref.get("multicast_group", "239.1.1.1"),
|
72
56
|
self.pref.get("multicast_port", 2239),
|
73
|
-
self.pref.get("interface_ip", "
|
57
|
+
self.pref.get("interface_ip", "127.0.0.1"),
|
74
58
|
)
|
75
59
|
self.multicast_interface.ready_read_connect(self.watch_udp)
|
76
60
|
|
77
|
-
def
|
78
|
-
"""
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
61
|
+
def setDarkMode(self, dark: bool):
|
62
|
+
"""Forces a darkmode palette."""
|
63
|
+
|
64
|
+
if dark:
|
65
|
+
darkPalette = QtGui.QPalette()
|
66
|
+
darkColor = QtGui.QColor(45, 45, 45)
|
67
|
+
disabledColor = QtGui.QColor(127, 127, 127)
|
68
|
+
darkPalette.setColor(QtGui.QPalette.Window, darkColor)
|
69
|
+
darkPalette.setColor(QtGui.QPalette.WindowText, Qt.white)
|
70
|
+
darkPalette.setColor(QtGui.QPalette.Base, QtGui.QColor(18, 18, 18))
|
71
|
+
darkPalette.setColor(QtGui.QPalette.AlternateBase, darkColor)
|
72
|
+
darkPalette.setColor(QtGui.QPalette.Text, Qt.white)
|
73
|
+
darkPalette.setColor(
|
74
|
+
QtGui.QPalette.Disabled, QtGui.QPalette.Text, disabledColor
|
75
|
+
)
|
76
|
+
darkPalette.setColor(QtGui.QPalette.Button, darkColor)
|
77
|
+
darkPalette.setColor(QtGui.QPalette.ButtonText, Qt.white)
|
78
|
+
darkPalette.setColor(
|
79
|
+
QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, disabledColor
|
80
|
+
)
|
81
|
+
darkPalette.setColor(QtGui.QPalette.BrightText, Qt.red)
|
82
|
+
darkPalette.setColor(QtGui.QPalette.Link, QtGui.QColor(42, 130, 218))
|
83
|
+
darkPalette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(42, 130, 218))
|
84
|
+
darkPalette.setColor(QtGui.QPalette.HighlightedText, Qt.black)
|
85
|
+
darkPalette.setColor(
|
86
|
+
QtGui.QPalette.Disabled, QtGui.QPalette.HighlightedText, disabledColor
|
87
|
+
)
|
88
|
+
|
89
|
+
self.setPalette(darkPalette)
|
90
|
+
else:
|
91
|
+
palette = self.style().standardPalette()
|
92
|
+
self.setPalette(palette)
|
93
|
+
|
94
|
+
def load_pref(self) -> None:
|
92
95
|
"""
|
93
|
-
Load preference file to get current db filename.
|
96
|
+
Load preference file to get current db filename and sets the initial darkmode state.
|
94
97
|
|
95
98
|
Parameters
|
96
99
|
----------
|
@@ -101,17 +104,18 @@ class MainWindow(QMainWindow):
|
|
101
104
|
None
|
102
105
|
"""
|
103
106
|
try:
|
104
|
-
if os.path.exists(
|
107
|
+
if os.path.exists(fsutils.CONFIG_FILE):
|
105
108
|
with open(
|
106
|
-
|
109
|
+
fsutils.CONFIG_FILE, "rt", encoding="utf-8"
|
107
110
|
) as file_descriptor:
|
108
111
|
self.pref = loads(file_descriptor.read())
|
109
|
-
logger.info("
|
112
|
+
logger.info(f"loaded config file from {fsutils.CONFIG_FILE}")
|
110
113
|
else:
|
111
114
|
self.pref["current_database"] = "ham.db"
|
112
115
|
|
113
116
|
except IOError as exception:
|
114
117
|
logger.critical("Error: %s", exception)
|
118
|
+
self.setDarkMode(self.pref.get("darkmode", False))
|
115
119
|
|
116
120
|
def watch_udp(self):
|
117
121
|
"""
|
@@ -126,6 +130,7 @@ class MainWindow(QMainWindow):
|
|
126
130
|
None
|
127
131
|
"""
|
128
132
|
while self.multicast_interface.server_udp.hasPendingDatagrams():
|
133
|
+
logger.error("Got multicast ")
|
129
134
|
json_data = self.multicast_interface.read_datagram_as_json()
|
130
135
|
|
131
136
|
if json_data.get("station", "") != platform.node():
|
@@ -145,8 +150,9 @@ class MainWindow(QMainWindow):
|
|
145
150
|
if json_data.get("cmd", "") == "NEWDB":
|
146
151
|
...
|
147
152
|
# self.load_new_db()
|
148
|
-
|
149
|
-
|
153
|
+
|
154
|
+
if json_data.get("cmd", "") == "DARKMODE":
|
155
|
+
self.setDarkMode(json_data.get("state", False))
|
150
156
|
|
151
157
|
def clear_lists(self) -> None:
|
152
158
|
"""
|
@@ -228,56 +234,3 @@ class MainWindow(QMainWindow):
|
|
228
234
|
listItem = QListWidgetItem(call)
|
229
235
|
self.telnetList.addItem(listItem)
|
230
236
|
self.telnetList.show()
|
231
|
-
|
232
|
-
|
233
|
-
def load_fonts_from_dir(directory: str) -> set:
|
234
|
-
"""
|
235
|
-
Load fonts from directory.
|
236
|
-
|
237
|
-
Parameters
|
238
|
-
----------
|
239
|
-
directory : str
|
240
|
-
The directory to load fonts from.
|
241
|
-
|
242
|
-
Returns
|
243
|
-
-------
|
244
|
-
set
|
245
|
-
The set of font families loaded.
|
246
|
-
"""
|
247
|
-
font_families = set()
|
248
|
-
for _fi in QDir(directory).entryInfoList(["*.ttf", "*.woff", "*.woff2"]):
|
249
|
-
_id = QFontDatabase.addApplicationFont(_fi.absoluteFilePath())
|
250
|
-
font_families |= set(QFontDatabase.applicationFontFamilies(_id))
|
251
|
-
return font_families
|
252
|
-
|
253
|
-
|
254
|
-
def main():
|
255
|
-
"""main entry"""
|
256
|
-
sys.exit(app.exec())
|
257
|
-
|
258
|
-
|
259
|
-
logger = logging.getLogger("__main__")
|
260
|
-
handler = logging.StreamHandler()
|
261
|
-
formatter = logging.Formatter(
|
262
|
-
datefmt="%H:%M:%S",
|
263
|
-
fmt="[%(asctime)s] %(levelname)s %(module)s - %(funcName)s Line %(lineno)d:\n%(message)s",
|
264
|
-
)
|
265
|
-
handler.setFormatter(formatter)
|
266
|
-
logger.addHandler(handler)
|
267
|
-
|
268
|
-
if Path("./debug").exists():
|
269
|
-
logger.setLevel(logging.DEBUG)
|
270
|
-
logger.debug("debugging on")
|
271
|
-
else:
|
272
|
-
logger.setLevel(logging.WARNING)
|
273
|
-
logger.warning("debugging off")
|
274
|
-
|
275
|
-
app = QApplication(sys.argv)
|
276
|
-
app.setStyle("Adwaita-Dark")
|
277
|
-
font_path = WORKING_PATH + "/data"
|
278
|
-
_families = load_fonts_from_dir(os.fspath(font_path))
|
279
|
-
window = MainWindow()
|
280
|
-
window.show()
|
281
|
-
|
282
|
-
if __name__ == "__main__":
|
283
|
-
main()
|