not1mm 24.10.20__py3-none-any.whl → 24.10.21__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 +190 -203
- not1mm/bandmap.py +122 -127
- not1mm/checkwindow.py +30 -52
- not1mm/lib/super_check_partial.py +1 -1
- not1mm/lib/version.py +1 -1
- not1mm/logwindow.py +27 -42
- not1mm/lookupservice.py +31 -43
- {not1mm-24.10.20.dist-info → not1mm-24.10.21.dist-info}/METADATA +3 -1
- {not1mm-24.10.20.dist-info → not1mm-24.10.21.dist-info}/RECORD +13 -13
- {not1mm-24.10.20.dist-info → not1mm-24.10.21.dist-info}/LICENSE +0 -0
- {not1mm-24.10.20.dist-info → not1mm-24.10.21.dist-info}/WHEEL +0 -0
- {not1mm-24.10.20.dist-info → not1mm-24.10.21.dist-info}/entry_points.txt +0 -0
- {not1mm-24.10.20.dist-info → not1mm-24.10.21.dist-info}/top_level.txt +0 -0
not1mm/bandmap.py
CHANGED
@@ -24,7 +24,8 @@ from PyQt6.QtWidgets import QDockWidget
|
|
24
24
|
from PyQt6.QtCore import pyqtSignal
|
25
25
|
|
26
26
|
import not1mm.fsutils as fsutils
|
27
|
-
|
27
|
+
|
28
|
+
# from not1mm.lib.multicast import Multicast
|
28
29
|
|
29
30
|
logger = logging.getLogger(__name__)
|
30
31
|
|
@@ -160,7 +161,9 @@ class Database:
|
|
160
161
|
"""
|
161
162
|
try:
|
162
163
|
if erase:
|
163
|
-
delete_call =
|
164
|
+
delete_call = (
|
165
|
+
"delete from spots where callsign = ? and ts < DATETIME();"
|
166
|
+
)
|
164
167
|
self.cursor.execute(delete_call, (spot.get("callsign"),))
|
165
168
|
self.db.commit()
|
166
169
|
|
@@ -324,6 +327,7 @@ class BandMapWindow(QDockWidget):
|
|
324
327
|
multicast_interface = None
|
325
328
|
text_color = QColor(45, 45, 45)
|
326
329
|
cluster_expire = pyqtSignal(str)
|
330
|
+
message = pyqtSignal(dict)
|
327
331
|
|
328
332
|
def __init__(self):
|
329
333
|
super().__init__()
|
@@ -357,12 +361,6 @@ class BandMapWindow(QDockWidget):
|
|
357
361
|
self.update_timer.start(UPDATE_INTERVAL)
|
358
362
|
self.setDarkMode(self.settings.get("darkmode", False))
|
359
363
|
self.update()
|
360
|
-
self.multicast_interface = Multicast(
|
361
|
-
self.settings.get("multicast_group", "239.1.1.1"),
|
362
|
-
self.settings.get("multicast_port", 2239),
|
363
|
-
self.settings.get("interface_ip", "0.0.0.0"),
|
364
|
-
)
|
365
|
-
self.multicast_interface.ready_read_connect(self.watch_udp)
|
366
364
|
self.request_workedlist()
|
367
365
|
self.request_contest()
|
368
366
|
|
@@ -372,6 +370,119 @@ class BandMapWindow(QDockWidget):
|
|
372
370
|
with open(fsutils.CONFIG_FILE, "rt", encoding="utf-8") as file_descriptor:
|
373
371
|
return loads(file_descriptor.read())
|
374
372
|
|
373
|
+
def msg_from_main(self, packet):
|
374
|
+
""""""
|
375
|
+
if packet.get("cmd", "") == "RADIO_STATE":
|
376
|
+
self.set_band(packet.get("band") + "m", False)
|
377
|
+
try:
|
378
|
+
if self.rx_freq != float(packet.get("vfoa")) / 1000000:
|
379
|
+
self.rx_freq = float(packet.get("vfoa")) / 1000000
|
380
|
+
self.tx_freq = self.rx_freq
|
381
|
+
self.center_on_rxfreq()
|
382
|
+
except ValueError:
|
383
|
+
print(f"vfo value error {packet.get('vfoa')}")
|
384
|
+
logger.debug(f"vfo value error {packet.get('vfoa')}")
|
385
|
+
return
|
386
|
+
bw_returned = packet.get("bw", "0")
|
387
|
+
if not bw_returned.isdigit():
|
388
|
+
bw_returned = "0"
|
389
|
+
self.bandwidth = int(bw_returned)
|
390
|
+
step, _ = self.determine_step_digits()
|
391
|
+
self.drawTXRXMarks(step)
|
392
|
+
return
|
393
|
+
if packet.get("cmd", "") == "NEXTSPOT" and self.rx_freq:
|
394
|
+
spot = self.spots.get_next_spot(
|
395
|
+
self.rx_freq + 0.000001, self.currentBand.end
|
396
|
+
)
|
397
|
+
if spot:
|
398
|
+
cmd = {}
|
399
|
+
cmd["cmd"] = "TUNE"
|
400
|
+
cmd["freq"] = spot.get("freq", self.rx_freq)
|
401
|
+
cmd["spot"] = spot.get("callsign", "")
|
402
|
+
self.message.emit(cmd)
|
403
|
+
return
|
404
|
+
if packet.get("cmd", "") == "PREVSPOT" and self.rx_freq:
|
405
|
+
spot = self.spots.get_prev_spot(
|
406
|
+
self.rx_freq - 0.000001, self.currentBand.start
|
407
|
+
)
|
408
|
+
if spot:
|
409
|
+
cmd = {}
|
410
|
+
cmd["cmd"] = "TUNE"
|
411
|
+
cmd["freq"] = spot.get("freq", self.rx_freq)
|
412
|
+
cmd["spot"] = spot.get("callsign", "")
|
413
|
+
self.message.emit(cmd)
|
414
|
+
return
|
415
|
+
if packet.get("cmd", "") == "SPOTDX":
|
416
|
+
dx = packet.get("dx", "")
|
417
|
+
freq = packet.get("freq", 0.0)
|
418
|
+
the_UTC_time = datetime.now(timezone.utc).isoformat(" ")[:19].split()[1]
|
419
|
+
spot = {
|
420
|
+
"ts": "2099-01-01 " + the_UTC_time,
|
421
|
+
"callsign": dx,
|
422
|
+
"freq": freq / 1000,
|
423
|
+
"band": self.currentBand.name,
|
424
|
+
"mode": "DX",
|
425
|
+
"spotter": platform.node(),
|
426
|
+
"comment": "MARKED",
|
427
|
+
}
|
428
|
+
self.spots.addspot(spot, erase=False)
|
429
|
+
self.update_stations()
|
430
|
+
return
|
431
|
+
if packet.get("cmd", "") == "MARKDX":
|
432
|
+
dx = packet.get("dx", "")
|
433
|
+
freq = packet.get("freq", 0.0)
|
434
|
+
the_UTC_time = datetime.now(timezone.utc).isoformat(" ")[:19].split()[1]
|
435
|
+
spot = {
|
436
|
+
"ts": "2099-01-01 " + the_UTC_time,
|
437
|
+
"callsign": dx,
|
438
|
+
"freq": freq / 1000,
|
439
|
+
"band": self.currentBand.name,
|
440
|
+
"mode": "DX",
|
441
|
+
"spotter": platform.node(),
|
442
|
+
"comment": "MARKED",
|
443
|
+
}
|
444
|
+
self.spots.addspot(spot, erase=False)
|
445
|
+
self.update_stations()
|
446
|
+
return
|
447
|
+
|
448
|
+
if packet.get("cmd", "") == "FINDDX":
|
449
|
+
dx = packet.get("dx", "")
|
450
|
+
spot = self.spots.get_matching_spot(
|
451
|
+
dx, self.currentBand.start, self.currentBand.end
|
452
|
+
)
|
453
|
+
if spot:
|
454
|
+
cmd = {}
|
455
|
+
cmd["cmd"] = "TUNE"
|
456
|
+
cmd["freq"] = spot.get("freq", self.rx_freq)
|
457
|
+
cmd["spot"] = spot.get("callsign", "")
|
458
|
+
self.message.emit(cmd)
|
459
|
+
return
|
460
|
+
if packet.get("cmd", "") == "WORKED":
|
461
|
+
self.worked_list = packet.get("worked", {})
|
462
|
+
logger.debug("%s", f"{self.worked_list}")
|
463
|
+
return
|
464
|
+
if packet.get("cmd", "") == "CALLCHANGED":
|
465
|
+
call = packet.get("call", "")
|
466
|
+
if call:
|
467
|
+
result = self.spots.get_like_calls(call)
|
468
|
+
if result:
|
469
|
+
cmd = {}
|
470
|
+
cmd["cmd"] = "CHECKSPOTS"
|
471
|
+
cmd["spots"] = result
|
472
|
+
self.message.emit(cmd)
|
473
|
+
return
|
474
|
+
cmd = {}
|
475
|
+
cmd["cmd"] = "CHECKSPOTS"
|
476
|
+
cmd["spots"] = []
|
477
|
+
self.message.emit(cmd)
|
478
|
+
return
|
479
|
+
if packet.get("cmd", "") == "CONTESTSTATUS":
|
480
|
+
if not self.callsignField.text():
|
481
|
+
self.callsignField.setText(packet.get("operator", "").upper())
|
482
|
+
return
|
483
|
+
if packet.get("cmd", "") == "DARKMODE":
|
484
|
+
self.setDarkMode(packet.get("state", False))
|
485
|
+
|
375
486
|
def setDarkMode(self, setdarkmode=False):
|
376
487
|
"""Set dark mode"""
|
377
488
|
if setdarkmode:
|
@@ -434,119 +545,6 @@ class BandMapWindow(QDockWidget):
|
|
434
545
|
self.connectButton.setText("Connecting")
|
435
546
|
self.connected = True
|
436
547
|
|
437
|
-
def watch_udp(self):
|
438
|
-
"""doc"""
|
439
|
-
while self.multicast_interface.server_udp.hasPendingDatagrams():
|
440
|
-
packet = self.multicast_interface.read_datagram_as_json()
|
441
|
-
|
442
|
-
if packet.get("station", "") != platform.node():
|
443
|
-
continue
|
444
|
-
if packet.get("cmd", "") == "RADIO_STATE":
|
445
|
-
self.set_band(packet.get("band") + "m", False)
|
446
|
-
try:
|
447
|
-
if self.rx_freq != float(packet.get("vfoa")) / 1000000:
|
448
|
-
self.rx_freq = float(packet.get("vfoa")) / 1000000
|
449
|
-
self.tx_freq = self.rx_freq
|
450
|
-
self.center_on_rxfreq()
|
451
|
-
except ValueError:
|
452
|
-
logger.debug(f"vfo value error {packet.get('vfoa')}")
|
453
|
-
continue
|
454
|
-
bw_returned = packet.get("bw", "0")
|
455
|
-
if not bw_returned.isdigit():
|
456
|
-
bw_returned = "0"
|
457
|
-
self.bandwidth = int(bw_returned)
|
458
|
-
step, _ = self.determine_step_digits()
|
459
|
-
self.drawTXRXMarks(step)
|
460
|
-
continue
|
461
|
-
|
462
|
-
if packet.get("cmd", "") == "NEXTSPOT" and self.rx_freq:
|
463
|
-
spot = self.spots.get_next_spot(
|
464
|
-
self.rx_freq + 0.000001, self.currentBand.end
|
465
|
-
)
|
466
|
-
if spot:
|
467
|
-
cmd = {}
|
468
|
-
cmd["cmd"] = "TUNE"
|
469
|
-
cmd["station"] = platform.node()
|
470
|
-
cmd["freq"] = spot.get("freq", self.rx_freq)
|
471
|
-
cmd["spot"] = spot.get("callsign", "")
|
472
|
-
self.multicast_interface.send_as_json(cmd)
|
473
|
-
continue
|
474
|
-
|
475
|
-
if packet.get("cmd", "") == "PREVSPOT" and self.rx_freq:
|
476
|
-
spot = self.spots.get_prev_spot(
|
477
|
-
self.rx_freq - 0.000001, self.currentBand.start
|
478
|
-
)
|
479
|
-
if spot:
|
480
|
-
cmd = {}
|
481
|
-
cmd["cmd"] = "TUNE"
|
482
|
-
cmd["station"] = platform.node()
|
483
|
-
cmd["freq"] = spot.get("freq", self.rx_freq)
|
484
|
-
cmd["spot"] = spot.get("callsign", "")
|
485
|
-
self.multicast_interface.send_as_json(cmd)
|
486
|
-
continue
|
487
|
-
if packet.get("cmd", "") == "SPOTDX":
|
488
|
-
dx = packet.get("dx", "")
|
489
|
-
freq = packet.get("freq", 0.0)
|
490
|
-
spotdx = f"dx {dx} {freq}"
|
491
|
-
self.send_command(spotdx)
|
492
|
-
continue
|
493
|
-
if packet.get("cmd", "") == "MARKDX":
|
494
|
-
dx = packet.get("dx", "")
|
495
|
-
freq = packet.get("freq", 0.0)
|
496
|
-
the_UTC_time = datetime.now(timezone.utc).isoformat(" ")[:19].split()[1]
|
497
|
-
spot = {
|
498
|
-
"ts": "2099-01-01 " + the_UTC_time,
|
499
|
-
"callsign": dx,
|
500
|
-
"freq": freq / 1000,
|
501
|
-
"band": self.currentBand.name,
|
502
|
-
"mode": "DX",
|
503
|
-
"spotter": platform.node(),
|
504
|
-
"comment": "MARKED",
|
505
|
-
}
|
506
|
-
self.spots.addspot(spot, erase=False)
|
507
|
-
self.update_stations()
|
508
|
-
continue
|
509
|
-
if packet.get("cmd", "") == "FINDDX":
|
510
|
-
dx = packet.get("dx", "")
|
511
|
-
spot = self.spots.get_matching_spot(
|
512
|
-
dx, self.currentBand.start, self.currentBand.end
|
513
|
-
)
|
514
|
-
if spot:
|
515
|
-
cmd = {}
|
516
|
-
cmd["cmd"] = "TUNE"
|
517
|
-
cmd["station"] = platform.node()
|
518
|
-
cmd["freq"] = spot.get("freq", self.rx_freq)
|
519
|
-
cmd["spot"] = spot.get("callsign", "")
|
520
|
-
self.multicast_interface.send_as_json(cmd)
|
521
|
-
continue
|
522
|
-
if packet.get("cmd", "") == "WORKED":
|
523
|
-
self.worked_list = packet.get("worked", {})
|
524
|
-
logger.debug("%s", f"{self.worked_list}")
|
525
|
-
continue
|
526
|
-
if packet.get("cmd", "") == "CALLCHANGED":
|
527
|
-
call = packet.get("call", "")
|
528
|
-
if call:
|
529
|
-
result = self.spots.get_like_calls(call)
|
530
|
-
if result:
|
531
|
-
cmd = {}
|
532
|
-
cmd["cmd"] = "CHECKSPOTS"
|
533
|
-
cmd["station"] = platform.node()
|
534
|
-
cmd["spots"] = result
|
535
|
-
self.multicast_interface.send_as_json(cmd)
|
536
|
-
continue
|
537
|
-
cmd = {}
|
538
|
-
cmd["cmd"] = "CHECKSPOTS"
|
539
|
-
cmd["station"] = platform.node()
|
540
|
-
cmd["spots"] = []
|
541
|
-
self.multicast_interface.send_as_json(cmd)
|
542
|
-
continue
|
543
|
-
if packet.get("cmd", "") == "CONTESTSTATUS":
|
544
|
-
if not self.callsignField.text():
|
545
|
-
self.callsignField.setText(packet.get("operator", "").upper())
|
546
|
-
continue
|
547
|
-
if packet.get("cmd", "") == "DARKMODE":
|
548
|
-
self.setDarkMode(packet.get("state", False))
|
549
|
-
|
550
548
|
def spot_clicked(self):
|
551
549
|
"""dunno"""
|
552
550
|
items = self.bandmap_scene.selectedItems()
|
@@ -554,24 +552,21 @@ class BandMapWindow(QDockWidget):
|
|
554
552
|
if item:
|
555
553
|
cmd = {}
|
556
554
|
cmd["cmd"] = "TUNE"
|
557
|
-
cmd["station"] = platform.node()
|
558
555
|
cmd["freq"] = items[0].property("freq")
|
559
556
|
cmd["spot"] = items[0].toPlainText().split()[0]
|
560
|
-
self.
|
557
|
+
self.message.emit(cmd)
|
561
558
|
|
562
559
|
def request_workedlist(self):
|
563
560
|
"""Request worked call list from logger"""
|
564
561
|
cmd = {}
|
565
562
|
cmd["cmd"] = "GETWORKEDLIST"
|
566
|
-
|
567
|
-
self.multicast_interface.send_as_json(cmd)
|
563
|
+
self.message.emit(cmd)
|
568
564
|
|
569
565
|
def request_contest(self):
|
570
566
|
"""Request active contest from logger"""
|
571
567
|
cmd = {}
|
572
568
|
cmd["cmd"] = "GETCONTESTSTATUS"
|
573
|
-
|
574
|
-
self.multicast_interface.send_as_json(cmd)
|
569
|
+
self.message.emit(cmd)
|
575
570
|
|
576
571
|
def update_station_timer(self):
|
577
572
|
"""doc"""
|
not1mm/checkwindow.py
CHANGED
@@ -11,7 +11,6 @@ Purpose: Onscreen widget to show possible matches to callsigns entered in the ma
|
|
11
11
|
|
12
12
|
import logging
|
13
13
|
import os
|
14
|
-
import platform
|
15
14
|
import queue
|
16
15
|
from json import loads
|
17
16
|
import Levenshtein
|
@@ -19,10 +18,11 @@ import Levenshtein
|
|
19
18
|
from PyQt6 import uic
|
20
19
|
from PyQt6.QtWidgets import QLabel, QVBoxLayout, QWidget, QDockWidget
|
21
20
|
from PyQt6.QtGui import QMouseEvent, QColorConstants, QPalette, QColor
|
21
|
+
from PyQt6.QtCore import pyqtSignal
|
22
22
|
|
23
23
|
import not1mm.fsutils as fsutils
|
24
24
|
from not1mm.lib.database import DataBase
|
25
|
-
|
25
|
+
|
26
26
|
from not1mm.lib.super_check_partial import SCP
|
27
27
|
|
28
28
|
logger = logging.getLogger(__name__)
|
@@ -31,7 +31,7 @@ logger = logging.getLogger(__name__)
|
|
31
31
|
class CheckWindow(QDockWidget):
|
32
32
|
"""The check window. Shows list or probable stations."""
|
33
33
|
|
34
|
-
|
34
|
+
message = pyqtSignal(dict)
|
35
35
|
dbname = None
|
36
36
|
pref = {}
|
37
37
|
call = None
|
@@ -59,12 +59,32 @@ class CheckWindow(QDockWidget):
|
|
59
59
|
self.mscp = SCP(fsutils.APP_DATA_PATH)
|
60
60
|
self._udpwatch = None
|
61
61
|
self.udp_fifo = queue.Queue()
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
|
63
|
+
def msg_from_main(self, packet):
|
64
|
+
""""""
|
65
|
+
if packet.get("cmd", "") == "DARKMODE":
|
66
|
+
self.setDarkMode(packet.get("state", False))
|
67
|
+
return
|
68
|
+
if packet.get("cmd", "") == "UPDATELOG":
|
69
|
+
self.clear_lists()
|
70
|
+
return
|
71
|
+
|
72
|
+
if self.active is False:
|
73
|
+
return
|
74
|
+
if packet.get("cmd", "") == "CALLCHANGED":
|
75
|
+
call = packet.get("call", "")
|
76
|
+
self.call = call
|
77
|
+
self.master_list(call)
|
78
|
+
self.log_list(call)
|
79
|
+
return
|
80
|
+
if packet.get("cmd", "") == "CHECKSPOTS":
|
81
|
+
self.populate_layout(self.dxcLayout, [])
|
82
|
+
spots = packet.get("spots", [])
|
83
|
+
self.telnet_list(spots)
|
84
|
+
return
|
85
|
+
if packet.get("cmd", "") == "NEWDB":
|
86
|
+
...
|
87
|
+
# self.load_new_db()
|
68
88
|
|
69
89
|
def setActive(self, mode: bool):
|
70
90
|
self.active = bool(mode)
|
@@ -74,9 +94,8 @@ class CheckWindow(QDockWidget):
|
|
74
94
|
if item:
|
75
95
|
cmd = {}
|
76
96
|
cmd["cmd"] = "CHANGECALL"
|
77
|
-
cmd["station"] = platform.node()
|
78
97
|
cmd["call"] = item
|
79
|
-
self.
|
98
|
+
self.message.emit(cmd)
|
80
99
|
|
81
100
|
def setDarkMode(self, dark: bool) -> None:
|
82
101
|
"""Forces a darkmode palette."""
|
@@ -145,47 +164,6 @@ class CheckWindow(QDockWidget):
|
|
145
164
|
logger.critical("Error: %s", exception)
|
146
165
|
self.setDarkMode(self.pref.get("darkmode", False))
|
147
166
|
|
148
|
-
def watch_udp(self):
|
149
|
-
"""
|
150
|
-
Puts UDP datagrams in a FIFO queue.
|
151
|
-
|
152
|
-
Parameters
|
153
|
-
----------
|
154
|
-
None
|
155
|
-
|
156
|
-
Returns
|
157
|
-
-------
|
158
|
-
None
|
159
|
-
"""
|
160
|
-
while self.multicast_interface.server_udp.hasPendingDatagrams():
|
161
|
-
logger.debug("Got multicast ")
|
162
|
-
json_data = self.multicast_interface.read_datagram_as_json()
|
163
|
-
|
164
|
-
if json_data.get("station", "") != platform.node():
|
165
|
-
continue
|
166
|
-
if json_data.get("cmd", "") == "DARKMODE":
|
167
|
-
self.setDarkMode(json_data.get("state", False))
|
168
|
-
continue
|
169
|
-
if json_data.get("cmd", "") == "UPDATELOG":
|
170
|
-
self.clear_lists()
|
171
|
-
continue
|
172
|
-
if self.active is False:
|
173
|
-
continue
|
174
|
-
if json_data.get("cmd", "") == "CALLCHANGED":
|
175
|
-
call = json_data.get("call", "")
|
176
|
-
self.call = call
|
177
|
-
self.master_list(call)
|
178
|
-
self.log_list(call)
|
179
|
-
continue
|
180
|
-
if json_data.get("cmd", "") == "CHECKSPOTS":
|
181
|
-
self.populate_layout(self.dxcLayout, [])
|
182
|
-
spots = json_data.get("spots", [])
|
183
|
-
self.telnet_list(spots)
|
184
|
-
continue
|
185
|
-
if json_data.get("cmd", "") == "NEWDB":
|
186
|
-
...
|
187
|
-
# self.load_new_db()
|
188
|
-
|
189
167
|
def clear_lists(self) -> None:
|
190
168
|
"""
|
191
169
|
Clear match lists.
|
not1mm/lib/version.py
CHANGED
not1mm/logwindow.py
CHANGED
@@ -13,7 +13,6 @@ Purpose: Onscreen widget to show and edit logged contacts.
|
|
13
13
|
|
14
14
|
import logging
|
15
15
|
import os
|
16
|
-
import platform
|
17
16
|
import queue
|
18
17
|
from json import loads
|
19
18
|
|
@@ -22,11 +21,13 @@ from PyQt6 import QtCore, QtGui, QtWidgets, uic
|
|
22
21
|
from PyQt6.QtCore import QItemSelectionModel
|
23
22
|
from PyQt6.QtWidgets import QDockWidget
|
24
23
|
from PyQt6.QtGui import QColorConstants, QPalette, QColor
|
24
|
+
from PyQt6.QtCore import pyqtSignal
|
25
25
|
|
26
26
|
import not1mm.fsutils as fsutils
|
27
27
|
from not1mm.lib.database import DataBase
|
28
28
|
from not1mm.lib.edit_contact import EditContact
|
29
|
-
|
29
|
+
|
30
|
+
# from not1mm.lib.multicast import Multicast
|
30
31
|
from not1mm.lib.n1mm import N1MM
|
31
32
|
|
32
33
|
logger = logging.getLogger(__name__)
|
@@ -62,6 +63,7 @@ class LogWindow(QDockWidget):
|
|
62
63
|
The main window
|
63
64
|
"""
|
64
65
|
|
66
|
+
message = pyqtSignal(dict)
|
65
67
|
multicast_interface = None
|
66
68
|
dbname = None
|
67
69
|
edit_contact_dialog = None
|
@@ -162,18 +164,32 @@ class LogWindow(QDockWidget):
|
|
162
164
|
log.verticalHeader().setVisible(False)
|
163
165
|
|
164
166
|
self.get_log()
|
165
|
-
self.multicast_interface = Multicast(
|
166
|
-
self.pref.get("multicast_group", "239.1.1.1"),
|
167
|
-
self.pref.get("multicast_port", 2239),
|
168
|
-
self.pref.get("interface_ip", "0.0.0.0"),
|
169
|
-
)
|
170
|
-
self.multicast_interface.ready_read_connect(self.watch_udp)
|
171
|
-
|
172
167
|
cmd = {}
|
173
168
|
cmd["cmd"] = "GETCOLUMNS"
|
174
|
-
|
169
|
+
self.message.emit(cmd)
|
175
170
|
|
176
|
-
|
171
|
+
def msg_from_main(self, msg):
|
172
|
+
""""""
|
173
|
+
if msg.get("cmd", "") == "UPDATELOG":
|
174
|
+
logger.debug("External refresh command.")
|
175
|
+
self.get_log()
|
176
|
+
if msg.get("cmd", "") == "CALLCHANGED":
|
177
|
+
call = msg.get("call", "")
|
178
|
+
self.show_like_calls(call)
|
179
|
+
if msg.get("cmd", "") == "NEWDB":
|
180
|
+
self.load_new_db()
|
181
|
+
if msg.get("cmd", "") == "SHOWCOLUMNS":
|
182
|
+
for column in range(len(self.columns)):
|
183
|
+
self.generalLog.setColumnHidden(column, True)
|
184
|
+
self.focusedLog.setColumnHidden(column, True)
|
185
|
+
columns_to_show = msg.get("COLUMNS", [])
|
186
|
+
for column in columns_to_show:
|
187
|
+
if column == "Freq":
|
188
|
+
column = "Freq (Khz)"
|
189
|
+
self.generalLog.setColumnHidden(self.get_column(column), False)
|
190
|
+
self.focusedLog.setColumnHidden(self.get_column(column), False)
|
191
|
+
if msg.get("cmd", "") == "DARKMODE":
|
192
|
+
self.set_dark_mode(msg.get("state", False))
|
177
193
|
|
178
194
|
def resize_headers_to_match(self) -> None:
|
179
195
|
""""""
|
@@ -912,37 +928,6 @@ class LogWindow(QDockWidget):
|
|
912
928
|
self.generalLog.blockSignals(False)
|
913
929
|
self.focusedLog.blockSignals(False)
|
914
930
|
|
915
|
-
def watch_udp(self) -> None:
|
916
|
-
"""
|
917
|
-
Watch for UDP datagrams.
|
918
|
-
Parse commands from our platform.node().
|
919
|
-
"""
|
920
|
-
while self.multicast_interface.server_udp.hasPendingDatagrams():
|
921
|
-
json_data = self.multicast_interface.read_datagram_as_json()
|
922
|
-
|
923
|
-
if json_data.get("station", "") != platform.node():
|
924
|
-
continue
|
925
|
-
if json_data.get("cmd", "") == "UPDATELOG":
|
926
|
-
logger.debug("External refresh command.")
|
927
|
-
self.get_log()
|
928
|
-
if json_data.get("cmd", "") == "CALLCHANGED":
|
929
|
-
call = json_data.get("call", "")
|
930
|
-
self.show_like_calls(call)
|
931
|
-
if json_data.get("cmd", "") == "NEWDB":
|
932
|
-
self.load_new_db()
|
933
|
-
if json_data.get("cmd", "") == "SHOWCOLUMNS":
|
934
|
-
for column in range(len(self.columns)):
|
935
|
-
self.generalLog.setColumnHidden(column, True)
|
936
|
-
self.focusedLog.setColumnHidden(column, True)
|
937
|
-
columns_to_show = json_data.get("COLUMNS", [])
|
938
|
-
for column in columns_to_show:
|
939
|
-
if column == "Freq":
|
940
|
-
column = "Freq (Khz)"
|
941
|
-
self.generalLog.setColumnHidden(self.get_column(column), False)
|
942
|
-
self.focusedLog.setColumnHidden(self.get_column(column), False)
|
943
|
-
if json_data.get("cmd", "") == "DARKMODE":
|
944
|
-
self.set_dark_mode(json_data.get("state", False))
|
945
|
-
|
946
931
|
def show_like_calls(self, call: str) -> None:
|
947
932
|
"""
|
948
933
|
Show all log entries that match call.
|
not1mm/lookupservice.py
CHANGED
@@ -12,13 +12,14 @@ Purpose: Onscreen widget to show realtime spots from an AR cluster.
|
|
12
12
|
|
13
13
|
import logging
|
14
14
|
import os
|
15
|
-
import platform
|
16
15
|
from json import loads
|
17
16
|
|
18
17
|
from PyQt6.QtWidgets import QDockWidget
|
18
|
+
from PyQt6.QtCore import pyqtSignal
|
19
19
|
|
20
20
|
import not1mm.fsutils as fsutils
|
21
|
-
|
21
|
+
|
22
|
+
# from not1mm.lib.multicast import Multicast
|
22
23
|
from not1mm.lib.lookup import QRZlookup, HamQTH
|
23
24
|
|
24
25
|
logger = logging.getLogger(__name__)
|
@@ -27,7 +28,7 @@ logger = logging.getLogger(__name__)
|
|
27
28
|
class LookupService(QDockWidget):
|
28
29
|
"""The Lookup Service class."""
|
29
30
|
|
30
|
-
|
31
|
+
message = pyqtSignal(dict)
|
31
32
|
|
32
33
|
def __init__(self):
|
33
34
|
super().__init__()
|
@@ -49,49 +50,36 @@ class LookupService(QDockWidget):
|
|
49
50
|
self.settings.get("lookuppassword"),
|
50
51
|
)
|
51
52
|
|
52
|
-
self.multicast_interface = Multicast(
|
53
|
-
self.settings.get("multicast_group", "239.1.1.1"),
|
54
|
-
self.settings.get("multicast_port", 2239),
|
55
|
-
self.settings.get("interface_ip", "0.0.0.0"),
|
56
|
-
)
|
57
|
-
self.multicast_interface.ready_read_connect(self.watch_udp)
|
58
|
-
|
59
53
|
def get_settings(self) -> dict:
|
60
54
|
"""Get the settings."""
|
61
55
|
if os.path.exists(fsutils.CONFIG_FILE):
|
62
56
|
with open(fsutils.CONFIG_FILE, "rt", encoding="utf-8") as file_descriptor:
|
63
57
|
return loads(file_descriptor.read())
|
64
58
|
|
65
|
-
def
|
66
|
-
"""
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
if self.settings.get("usehamqth"):
|
94
|
-
self.look_up = HamQTH(
|
95
|
-
self.settings.get("lookupusername"),
|
96
|
-
self.settings.get("lookuppassword"),
|
97
|
-
)
|
59
|
+
def msg_from_main(self, packet):
|
60
|
+
""""""
|
61
|
+
if packet.get("cmd", "") == "LOOKUP_CALL":
|
62
|
+
if self.look_up:
|
63
|
+
call = packet.get("call", "")
|
64
|
+
if call:
|
65
|
+
result = self.look_up.lookup(call)
|
66
|
+
cmd = {}
|
67
|
+
cmd["cmd"] = "LOOKUP_RESPONSE"
|
68
|
+
cmd["result"] = result
|
69
|
+
self.message.emit(cmd)
|
70
|
+
return
|
71
|
+
|
72
|
+
if packet.get("cmd", "") == "REFRESH_LOOKUP":
|
73
|
+
self.settings = self.get_settings()
|
74
|
+
self.look_up = None
|
75
|
+
if self.settings.get("useqrz"):
|
76
|
+
self.look_up = QRZlookup(
|
77
|
+
self.settings.get("lookupusername"),
|
78
|
+
self.settings.get("lookuppassword"),
|
79
|
+
)
|
80
|
+
|
81
|
+
if self.settings.get("usehamqth"):
|
82
|
+
self.look_up = HamQTH(
|
83
|
+
self.settings.get("lookupusername"),
|
84
|
+
self.settings.get("lookuppassword"),
|
85
|
+
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: not1mm
|
3
|
-
Version: 24.10.
|
3
|
+
Version: 24.10.21
|
4
4
|
Summary: NOT1MM Logger
|
5
5
|
Author-email: Michael Bridak <michael.bridak@gmail.com>
|
6
6
|
Project-URL: Homepage, https://github.com/mbridak/not1mm
|
@@ -231,6 +231,8 @@ generated, 'cause I'm lazy, list of those who've submitted PR's.
|
|
231
231
|
|
232
232
|
## Recent Changes
|
233
233
|
|
234
|
+
- [24-10-21] Scaled back the hits returned from the check window from 25 to 20. Seems less resource hungry now.
|
235
|
+
- [24-10-20-1] ReWrote how the widgets interact. I porbably broke a thing or two. Let me know.
|
234
236
|
- [24-10-20] Add ESM to ARRL DX.
|
235
237
|
- [24-10-19-1] Rewrite part of CAT control.
|
236
238
|
- [24-10-19] Change ESM button states when the run state is toggled. Add ESM to ARRL Field Day and Winter Field Day.
|