not1mm 24.11.12.1__py3-none-any.whl → 24.11.17__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 +10 -6
- not1mm/checkwindow.py +1 -1
- not1mm/data/checkwindow.ui +18 -0
- not1mm/data/new_contest.ui +5 -0
- not1mm/lib/version.py +1 -1
- not1mm/plugins/arrl_ss_cw.py +10 -0
- not1mm/plugins/arrl_vhf_jan.py +10 -0
- not1mm/plugins/arrl_vhf_jun.py +10 -0
- not1mm/plugins/arrl_vhf_sep.py +10 -0
- not1mm/plugins/cq_160_cw.py +10 -0
- not1mm/plugins/cq_160_ssb.py +10 -0
- not1mm/plugins/cq_ww_cw.py +10 -0
- not1mm/plugins/cq_ww_rtty.py +10 -0
- not1mm/plugins/cq_ww_ssb.py +10 -0
- not1mm/plugins/cwt.py +10 -0
- not1mm/plugins/helvetia.py +10 -0
- not1mm/plugins/k1usn_sst.py +10 -0
- not1mm/plugins/lz-dx.py +634 -0
- not1mm/plugins/naqp_cw.py +10 -0
- not1mm/plugins/naqp_rtty.py +10 -0
- not1mm/plugins/naqp_ssb.py +10 -0
- not1mm/plugins/raem.py +10 -0
- not1mm/plugins/stew_perry_topband.py +10 -0
- not1mm/plugins/weekly_rtty.py +10 -0
- not1mm/plugins/winter_field_day.py +10 -0
- not1mm/test.py +5 -36
- {not1mm-24.11.12.1.dist-info → not1mm-24.11.17.dist-info}/METADATA +48 -3
- {not1mm-24.11.12.1.dist-info → not1mm-24.11.17.dist-info}/RECORD +32 -31
- {not1mm-24.11.12.1.dist-info → not1mm-24.11.17.dist-info}/WHEEL +1 -1
- {not1mm-24.11.12.1.dist-info → not1mm-24.11.17.dist-info}/LICENSE +0 -0
- {not1mm-24.11.12.1.dist-info → not1mm-24.11.17.dist-info}/entry_points.txt +0 -0
- {not1mm-24.11.12.1.dist-info → not1mm-24.11.17.dist-info}/top_level.txt +0 -0
not1mm/plugins/lz-dx.py
ADDED
@@ -0,0 +1,634 @@
|
|
1
|
+
"""
|
2
|
+
@dg9vh
|
3
|
+
LZ-DX
|
4
|
+
-------------------------------------------------
|
5
|
+
Status: Active
|
6
|
+
Geographic Focus: Bulgaria
|
7
|
+
Participation: Worldwide
|
8
|
+
Mode: CW, SSB
|
9
|
+
Bands: 160, 80, 40, 20, 15, 10m
|
10
|
+
Classes: Single Op (CW/SSB) High
|
11
|
+
Single Op Mixed (QRP/Low/High)
|
12
|
+
Multi-Op (CW/SSB/Mixed) High
|
13
|
+
SWL
|
14
|
+
Max operating hours: 18 with a maximum of two rest periods of any length
|
15
|
+
Max power: HP: >100 watts
|
16
|
+
LP: 100 watts
|
17
|
+
QRP: 5 watts (CW/Digital) or 10 watts (SSB)
|
18
|
+
Exchange: LZ: RS(T) + 2-letter district
|
19
|
+
non-HB: RS(T) + ITU zone
|
20
|
+
Work stations: Once per band per mode
|
21
|
+
|
22
|
+
Scoring:
|
23
|
+
Contact with a station in Bulgaria: 10 points
|
24
|
+
Contact with a station within the same continent: 1 point
|
25
|
+
Contact with a station outside the operator’s continent: 3 points
|
26
|
+
|
27
|
+
Multipliers: District and DXCC country (including Bulgaria) per band: 1 point
|
28
|
+
|
29
|
+
Score Calculation: Total score = total QSO points x total mults
|
30
|
+
Mail logs to: lzdxc@bfra.bg
|
31
|
+
Find rules at: https://lzdx.bfra.bg/rulesen.html
|
32
|
+
Cabrillo name: LZ-DX
|
33
|
+
"""
|
34
|
+
|
35
|
+
import datetime
|
36
|
+
import logging
|
37
|
+
import platform
|
38
|
+
|
39
|
+
from pathlib import Path
|
40
|
+
|
41
|
+
from PyQt6 import QtWidgets
|
42
|
+
|
43
|
+
from not1mm.lib.plugin_common import gen_adif, get_points
|
44
|
+
|
45
|
+
from not1mm.lib.version import __version__
|
46
|
+
|
47
|
+
logger = logging.getLogger(__name__)
|
48
|
+
|
49
|
+
EXCHANGE_HINT = "District or ITU-Zone"
|
50
|
+
|
51
|
+
name = "LZ DX"
|
52
|
+
cabrillo_name = "LZ-DX"
|
53
|
+
mode = "BOTH" # CW SSB BOTH RTTY
|
54
|
+
|
55
|
+
columns = [
|
56
|
+
"YYYY-MM-DD HH:MM:SS",
|
57
|
+
"Call",
|
58
|
+
"Freq",
|
59
|
+
"Mode",
|
60
|
+
"Snt",
|
61
|
+
"Rcv",
|
62
|
+
"SentNr",
|
63
|
+
"RcvNr",
|
64
|
+
"M1",
|
65
|
+
"M2",
|
66
|
+
"PTS",
|
67
|
+
]
|
68
|
+
|
69
|
+
advance_on_space = [True, True, True, True, True]
|
70
|
+
|
71
|
+
# 1 once per contest, 2 work each band, 3 each band/mode, 4 no dupe checking
|
72
|
+
dupe_type = 3
|
73
|
+
|
74
|
+
cantons = [
|
75
|
+
"BU",
|
76
|
+
"BL",
|
77
|
+
"VN",
|
78
|
+
"VD",
|
79
|
+
"VR",
|
80
|
+
"GA",
|
81
|
+
"DO",
|
82
|
+
"KA",
|
83
|
+
"KD",
|
84
|
+
"LV",
|
85
|
+
"MN",
|
86
|
+
"PA",
|
87
|
+
"PK",
|
88
|
+
"PL",
|
89
|
+
"PD",
|
90
|
+
"RZ",
|
91
|
+
"RS",
|
92
|
+
"SS",
|
93
|
+
"SL",
|
94
|
+
"SM",
|
95
|
+
"SF",
|
96
|
+
"SO",
|
97
|
+
"SZ",
|
98
|
+
"TA",
|
99
|
+
"HA",
|
100
|
+
"SN",
|
101
|
+
"YA",
|
102
|
+
]
|
103
|
+
|
104
|
+
|
105
|
+
def init_contest(self):
|
106
|
+
"""setup plugin"""
|
107
|
+
set_tab_next(self)
|
108
|
+
set_tab_prev(self)
|
109
|
+
interface(self)
|
110
|
+
self.next_field = self.other_2
|
111
|
+
|
112
|
+
|
113
|
+
def interface(self):
|
114
|
+
"""Setup user interface"""
|
115
|
+
self.field1.show()
|
116
|
+
self.field2.show()
|
117
|
+
self.field3.hide()
|
118
|
+
self.field4.show()
|
119
|
+
label = self.field3.findChild(QtWidgets.QLabel)
|
120
|
+
label.setText("Sent")
|
121
|
+
self.field3.setAccessibleName("Sent")
|
122
|
+
label = self.field4.findChild(QtWidgets.QLabel)
|
123
|
+
label.setText("District/ITU")
|
124
|
+
self.field4.setAccessibleName("District or ITU")
|
125
|
+
|
126
|
+
|
127
|
+
def reset_label(self):
|
128
|
+
"""reset label after field cleared"""
|
129
|
+
|
130
|
+
|
131
|
+
def set_tab_next(self):
|
132
|
+
"""Set TAB Advances"""
|
133
|
+
self.tab_next = {
|
134
|
+
self.callsign: self.field1.findChild(QtWidgets.QLineEdit),
|
135
|
+
self.field1.findChild(QtWidgets.QLineEdit): self.field4.findChild(
|
136
|
+
QtWidgets.QLineEdit
|
137
|
+
),
|
138
|
+
self.field2.findChild(QtWidgets.QLineEdit): self.field4.findChild(
|
139
|
+
QtWidgets.QLineEdit
|
140
|
+
),
|
141
|
+
self.field3.findChild(QtWidgets.QLineEdit): self.field4.findChild(
|
142
|
+
QtWidgets.QLineEdit
|
143
|
+
),
|
144
|
+
self.field4.findChild(QtWidgets.QLineEdit): self.callsign,
|
145
|
+
}
|
146
|
+
|
147
|
+
|
148
|
+
def set_tab_prev(self):
|
149
|
+
"""Set TAB Advances"""
|
150
|
+
self.tab_prev = {
|
151
|
+
self.callsign: self.field4.findChild(QtWidgets.QLineEdit),
|
152
|
+
self.field1.findChild(QtWidgets.QLineEdit): self.callsign,
|
153
|
+
self.field2.findChild(QtWidgets.QLineEdit): self.callsign,
|
154
|
+
self.field3.findChild(QtWidgets.QLineEdit): self.callsign,
|
155
|
+
self.field4.findChild(QtWidgets.QLineEdit): self.field3.findChild(
|
156
|
+
QtWidgets.QLineEdit
|
157
|
+
),
|
158
|
+
}
|
159
|
+
|
160
|
+
|
161
|
+
def set_contact_vars(self):
|
162
|
+
"""Contest Specific"""
|
163
|
+
self.contact["SNT"] = self.sent.text()
|
164
|
+
self.contact["RCV"] = self.receive.text()
|
165
|
+
self.contact["SentNr"] = self.other_1.text().upper()
|
166
|
+
self.contact["NR"] = self.other_2.text().upper()
|
167
|
+
|
168
|
+
self.contact["IsMultiplier1"] = 0
|
169
|
+
self.contact["IsMultiplier2"] = 0
|
170
|
+
|
171
|
+
if (
|
172
|
+
self.contact.get("CountryPrefix", "") == "LZ"
|
173
|
+
and self.contact.get("NR", "").isalpha()
|
174
|
+
):
|
175
|
+
canton = self.contact.get("NR", "").upper()
|
176
|
+
band = self.contact.get("Band", "")
|
177
|
+
query = (
|
178
|
+
f"select count(*) as canton_count from dxlog where "
|
179
|
+
f"NR = '{canton}' "
|
180
|
+
f"and Band = '{band}' "
|
181
|
+
f"and ContestNR = {self.pref.get('contest', '1')};"
|
182
|
+
)
|
183
|
+
result = self.database.exec_sql(query)
|
184
|
+
count = int(result.get("canton_count", 0))
|
185
|
+
if count == 0:
|
186
|
+
self.contact["IsMultiplier1"] = 1
|
187
|
+
|
188
|
+
if self.contact.get("CountryPrefix", ""):
|
189
|
+
dxcc = self.contact.get("CountryPrefix", "")
|
190
|
+
band = self.contact.get("Band", "")
|
191
|
+
query = (
|
192
|
+
f"select count(*) as dxcc_count from dxlog where "
|
193
|
+
f"CountryPrefix = '{dxcc}' "
|
194
|
+
f"and Band = '{band}' "
|
195
|
+
f"and ContestNR = {self.pref.get('contest', '1')};"
|
196
|
+
)
|
197
|
+
result = self.database.exec_sql(query)
|
198
|
+
if not result.get("dxcc_count", ""):
|
199
|
+
self.contact["IsMultiplier2"] = 1
|
200
|
+
|
201
|
+
|
202
|
+
def prefill(self):
|
203
|
+
"""Fill SentNR"""
|
204
|
+
field = self.field3.findChild(QtWidgets.QLineEdit)
|
205
|
+
sent_sxchange_setting = self.contest_settings.get("SentExchange", "")
|
206
|
+
if sent_sxchange_setting.strip() == "#":
|
207
|
+
result = self.database.get_serial()
|
208
|
+
serial_nr = str(result.get("serial_nr", "1")).zfill(3)
|
209
|
+
if serial_nr == "None":
|
210
|
+
serial_nr = "001"
|
211
|
+
if len(field.text()) == 0:
|
212
|
+
field.setText(serial_nr)
|
213
|
+
else:
|
214
|
+
field.setText(sent_sxchange_setting)
|
215
|
+
|
216
|
+
|
217
|
+
def show_mults(self):
|
218
|
+
"""Return display string for mults"""
|
219
|
+
return int(self.database.fetch_mult_count(1).get("count", 0)) + int(
|
220
|
+
self.database.fetch_mult_count(2).get("count", 0)
|
221
|
+
)
|
222
|
+
|
223
|
+
|
224
|
+
def show_qso(self):
|
225
|
+
"""Return qso count"""
|
226
|
+
result = self.database.fetch_qso_count()
|
227
|
+
if result:
|
228
|
+
return int(result.get("qsos", 0))
|
229
|
+
return 0
|
230
|
+
|
231
|
+
|
232
|
+
def adif(self):
|
233
|
+
"""Call the generate ADIF function"""
|
234
|
+
gen_adif(self, cabrillo_name, "LZ-DX")
|
235
|
+
|
236
|
+
|
237
|
+
def output_cabrillo_line(line_to_output, ending, file_descriptor, file_encoding):
|
238
|
+
""""""
|
239
|
+
print(
|
240
|
+
line_to_output.encode(file_encoding, errors="ignore").decode(),
|
241
|
+
end=ending,
|
242
|
+
file=file_descriptor,
|
243
|
+
)
|
244
|
+
|
245
|
+
|
246
|
+
def cabrillo(self, file_encoding):
|
247
|
+
"""Generates Cabrillo file. Maybe."""
|
248
|
+
# https://www.cqwpx.com/cabrillo.htm
|
249
|
+
logger.debug("******Cabrillo*****")
|
250
|
+
logger.debug("Station: %s", f"{self.station}")
|
251
|
+
logger.debug("Contest: %s", f"{self.contest_settings}")
|
252
|
+
now = datetime.datetime.now()
|
253
|
+
date_time = now.strftime("%Y-%m-%d_%H-%M-%S")
|
254
|
+
filename = (
|
255
|
+
str(Path.home())
|
256
|
+
+ "/"
|
257
|
+
+ f"{self.station.get('Call', '').upper()}_{cabrillo_name}_{date_time}.log"
|
258
|
+
)
|
259
|
+
logger.debug("%s", filename)
|
260
|
+
log = self.database.fetch_all_contacts_asc()
|
261
|
+
try:
|
262
|
+
with open(filename, "w", encoding=file_encoding) as file_descriptor:
|
263
|
+
output_cabrillo_line(
|
264
|
+
"START-OF-LOG: 3.0",
|
265
|
+
"\r\n",
|
266
|
+
file_descriptor,
|
267
|
+
file_encoding,
|
268
|
+
)
|
269
|
+
output_cabrillo_line(
|
270
|
+
f"CREATED-BY: Not1MM v{__version__}",
|
271
|
+
"\r\n",
|
272
|
+
file_descriptor,
|
273
|
+
file_encoding,
|
274
|
+
)
|
275
|
+
output_cabrillo_line(
|
276
|
+
f"CONTEST: {cabrillo_name}",
|
277
|
+
"\r\n",
|
278
|
+
file_descriptor,
|
279
|
+
file_encoding,
|
280
|
+
)
|
281
|
+
if self.station.get("Club", ""):
|
282
|
+
output_cabrillo_line(
|
283
|
+
f"CLUB: {self.station.get('Club', '').upper()}",
|
284
|
+
"\r\n",
|
285
|
+
file_descriptor,
|
286
|
+
file_encoding,
|
287
|
+
)
|
288
|
+
output_cabrillo_line(
|
289
|
+
f"CALLSIGN: {self.station.get('Call','')}",
|
290
|
+
"\r\n",
|
291
|
+
file_descriptor,
|
292
|
+
file_encoding,
|
293
|
+
)
|
294
|
+
output_cabrillo_line(
|
295
|
+
f"LOCATION: {self.station.get('ARRLSection', '')}",
|
296
|
+
"\r\n",
|
297
|
+
file_descriptor,
|
298
|
+
file_encoding,
|
299
|
+
)
|
300
|
+
output_cabrillo_line(
|
301
|
+
f"CATEGORY-OPERATOR: {self.contest_settings.get('OperatorCategory','')}",
|
302
|
+
"\r\n",
|
303
|
+
file_descriptor,
|
304
|
+
file_encoding,
|
305
|
+
)
|
306
|
+
output_cabrillo_line(
|
307
|
+
f"CATEGORY-ASSISTED: {self.contest_settings.get('AssistedCategory','')}",
|
308
|
+
"\r\n",
|
309
|
+
file_descriptor,
|
310
|
+
file_encoding,
|
311
|
+
)
|
312
|
+
output_cabrillo_line(
|
313
|
+
f"CATEGORY-BAND: {self.contest_settings.get('BandCategory','')}",
|
314
|
+
"\r\n",
|
315
|
+
file_descriptor,
|
316
|
+
file_encoding,
|
317
|
+
)
|
318
|
+
output_cabrillo_line(
|
319
|
+
f"CATEGORY-MODE: {self.contest_settings.get('ModeCategory','')}",
|
320
|
+
"\r\n",
|
321
|
+
file_descriptor,
|
322
|
+
file_encoding,
|
323
|
+
)
|
324
|
+
output_cabrillo_line(
|
325
|
+
f"CATEGORY-TRANSMITTER: {self.contest_settings.get('TransmitterCategory','')}",
|
326
|
+
"\r\n",
|
327
|
+
file_descriptor,
|
328
|
+
file_encoding,
|
329
|
+
)
|
330
|
+
if self.contest_settings.get("OverlayCategory", "") != "N/A":
|
331
|
+
output_cabrillo_line(
|
332
|
+
f"CATEGORY-OVERLAY: {self.contest_settings.get('OverlayCategory','')}",
|
333
|
+
"\r\n",
|
334
|
+
file_descriptor,
|
335
|
+
file_encoding,
|
336
|
+
)
|
337
|
+
output_cabrillo_line(
|
338
|
+
f"GRID-LOCATOR: {self.station.get('GridSquare','')}",
|
339
|
+
"\r\n",
|
340
|
+
file_descriptor,
|
341
|
+
file_encoding,
|
342
|
+
)
|
343
|
+
output_cabrillo_line(
|
344
|
+
f"CATEGORY-POWER: {self.contest_settings.get('PowerCategory','')}",
|
345
|
+
"\r\n",
|
346
|
+
file_descriptor,
|
347
|
+
file_encoding,
|
348
|
+
)
|
349
|
+
|
350
|
+
output_cabrillo_line(
|
351
|
+
f"CLAIMED-SCORE: {calc_score(self)}",
|
352
|
+
"\r\n",
|
353
|
+
file_descriptor,
|
354
|
+
file_encoding,
|
355
|
+
)
|
356
|
+
ops = f"@{self.station.get('Call','')}"
|
357
|
+
list_of_ops = self.database.get_ops()
|
358
|
+
for op in list_of_ops:
|
359
|
+
ops += f", {op.get('Operator', '')}"
|
360
|
+
output_cabrillo_line(
|
361
|
+
f"OPERATORS: {ops}",
|
362
|
+
"\r\n",
|
363
|
+
file_descriptor,
|
364
|
+
file_encoding,
|
365
|
+
)
|
366
|
+
output_cabrillo_line(
|
367
|
+
f"NAME: {self.station.get('Name', '')}",
|
368
|
+
"\r\n",
|
369
|
+
file_descriptor,
|
370
|
+
file_encoding,
|
371
|
+
)
|
372
|
+
output_cabrillo_line(
|
373
|
+
f"ADDRESS: {self.station.get('Street1', '')}",
|
374
|
+
"\r\n",
|
375
|
+
file_descriptor,
|
376
|
+
file_encoding,
|
377
|
+
)
|
378
|
+
output_cabrillo_line(
|
379
|
+
f"ADDRESS-CITY: {self.station.get('City', '')}",
|
380
|
+
"\r\n",
|
381
|
+
file_descriptor,
|
382
|
+
file_encoding,
|
383
|
+
)
|
384
|
+
output_cabrillo_line(
|
385
|
+
f"ADDRESS-STATE-PROVINCE: {self.station.get('State', '')}",
|
386
|
+
"\r\n",
|
387
|
+
file_descriptor,
|
388
|
+
file_encoding,
|
389
|
+
)
|
390
|
+
output_cabrillo_line(
|
391
|
+
f"ADDRESS-POSTALCODE: {self.station.get('Zip', '')}",
|
392
|
+
"\r\n",
|
393
|
+
file_descriptor,
|
394
|
+
file_encoding,
|
395
|
+
)
|
396
|
+
output_cabrillo_line(
|
397
|
+
f"ADDRESS-COUNTRY: {self.station.get('Country', '')}",
|
398
|
+
"\r\n",
|
399
|
+
file_descriptor,
|
400
|
+
file_encoding,
|
401
|
+
)
|
402
|
+
output_cabrillo_line(
|
403
|
+
f"EMAIL: {self.station.get('Email', '')}",
|
404
|
+
"\r\n",
|
405
|
+
file_descriptor,
|
406
|
+
file_encoding,
|
407
|
+
)
|
408
|
+
for contact in log:
|
409
|
+
the_date_and_time = contact.get("TS", "")
|
410
|
+
themode = contact.get("Mode", "")
|
411
|
+
if themode == "LSB" or themode == "USB":
|
412
|
+
themode = "PH"
|
413
|
+
frequency = str(int(contact.get("Freq", "0"))).rjust(5)
|
414
|
+
|
415
|
+
loggeddate = the_date_and_time[:10]
|
416
|
+
loggedtime = the_date_and_time[11:13] + the_date_and_time[14:16]
|
417
|
+
output_cabrillo_line(
|
418
|
+
f"QSO: {frequency} {themode} {loggeddate} {loggedtime} "
|
419
|
+
f"{contact.get('StationPrefix', '').ljust(13)} "
|
420
|
+
f"{str(contact.get('SNT', '')).ljust(3)} "
|
421
|
+
f"{str(contact.get('SentNr', '')).ljust(6)} "
|
422
|
+
f"{contact.get('Call', '').ljust(13)} "
|
423
|
+
f"{str(contact.get('RCV', '')).ljust(3)} "
|
424
|
+
f"{str(contact.get('NR', '')).ljust(6)}",
|
425
|
+
"\r\n",
|
426
|
+
file_descriptor,
|
427
|
+
file_encoding,
|
428
|
+
)
|
429
|
+
output_cabrillo_line("END-OF-LOG:", "\r\n", file_descriptor, file_encoding)
|
430
|
+
self.show_message_box(f"Cabrillo saved to: {filename}")
|
431
|
+
except IOError as exception:
|
432
|
+
logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
|
433
|
+
self.show_message_box(f"Error saving Cabrillo: {exception} {filename}")
|
434
|
+
return
|
435
|
+
|
436
|
+
|
437
|
+
def check_call_history(self):
|
438
|
+
""""""
|
439
|
+
result = self.database.fetch_call_history(self.callsign.text())
|
440
|
+
if result:
|
441
|
+
self.history_info.setText(f"{result.get('UserText','')}")
|
442
|
+
if self.other_2.text() == "":
|
443
|
+
self.other_2.setText(f"{result.get('Exch1', '')}")
|
444
|
+
|
445
|
+
|
446
|
+
def predupe(self):
|
447
|
+
"""called after callsign entered"""
|
448
|
+
|
449
|
+
|
450
|
+
def points(self):
|
451
|
+
"""
|
452
|
+
Scoring:
|
453
|
+
Contact with a station within the same continent: 1 point
|
454
|
+
Contact with a station outside the operator’s continent: 3 points
|
455
|
+
Contact with a station in Switzerland: 10 points
|
456
|
+
self.contact["CountryPrefix"]
|
457
|
+
self.contact["Continent"]
|
458
|
+
"""
|
459
|
+
result = self.cty_lookup(self.station.get("Call", ""))
|
460
|
+
if result:
|
461
|
+
for item in result.items():
|
462
|
+
my_continent = item[1].get("continent", "")
|
463
|
+
result = self.cty_lookup(self.contact.get("Call", ""))
|
464
|
+
if result:
|
465
|
+
for item in result.items():
|
466
|
+
their_country = item[1].get("entity", "")
|
467
|
+
their_continent = item[1].get("continent", "")
|
468
|
+
|
469
|
+
if their_country == "Bulgaria":
|
470
|
+
return 10
|
471
|
+
|
472
|
+
if my_continent != their_continent:
|
473
|
+
return 3
|
474
|
+
|
475
|
+
return 1
|
476
|
+
# Something wrong
|
477
|
+
return 0
|
478
|
+
|
479
|
+
|
480
|
+
def calc_score(self):
|
481
|
+
"""Return calculated score"""
|
482
|
+
result = self.database.fetch_points()
|
483
|
+
if result is not None:
|
484
|
+
score = result.get("Points", "0")
|
485
|
+
if score is None:
|
486
|
+
score = "0"
|
487
|
+
contest_points = int(score)
|
488
|
+
mults = show_mults(self)
|
489
|
+
return contest_points * mults
|
490
|
+
return 0
|
491
|
+
|
492
|
+
|
493
|
+
def recalculate_mults(self):
|
494
|
+
"""Recalculates multipliers after change in logged qso."""
|
495
|
+
|
496
|
+
all_contacts = self.database.fetch_all_contacts_asc()
|
497
|
+
for contact in all_contacts:
|
498
|
+
|
499
|
+
contact["IsMultiplier1"] = 0
|
500
|
+
contact["IsMultiplier2"] = 0
|
501
|
+
|
502
|
+
time_stamp = contact.get("TS", "")
|
503
|
+
canton = contact.get("NR", "")
|
504
|
+
dxcc = contact.get("CountryPrefix", "")
|
505
|
+
band = contact.get("Band", "")
|
506
|
+
if dxcc == "LZ" and canton.isalpha():
|
507
|
+
query = (
|
508
|
+
f"select count(*) as canton_count from dxlog where TS < '{time_stamp}' "
|
509
|
+
f"and NR = '{canton.upper()}' "
|
510
|
+
f"and Band = '{band}' "
|
511
|
+
f"and ContestNR = {self.pref.get('contest', '1')};"
|
512
|
+
)
|
513
|
+
result = self.database.exec_sql(query)
|
514
|
+
count = int(result.get("canton_count", 0))
|
515
|
+
if count == 0:
|
516
|
+
contact["IsMultiplier1"] = 1
|
517
|
+
|
518
|
+
if dxcc:
|
519
|
+
query = (
|
520
|
+
f"select count(*) as dxcc_count from dxlog where TS < '{time_stamp}' "
|
521
|
+
f"and CountryPrefix = '{dxcc}' "
|
522
|
+
f"and Band = '{band}' "
|
523
|
+
f"and ContestNR = {self.pref.get('contest', '1')};"
|
524
|
+
)
|
525
|
+
result = self.database.exec_sql(query)
|
526
|
+
if not result.get("dxcc_count", ""):
|
527
|
+
contact["IsMultiplier2"] = 1
|
528
|
+
|
529
|
+
self.database.change_contact(contact)
|
530
|
+
cmd = {}
|
531
|
+
cmd["cmd"] = "UPDATELOG"
|
532
|
+
cmd["station"] = platform.node()
|
533
|
+
# self.multicast_interface.send_as_json(cmd)
|
534
|
+
|
535
|
+
|
536
|
+
def populate_history_info_line(self):
|
537
|
+
result = self.database.fetch_call_history(self.callsign.text())
|
538
|
+
if result:
|
539
|
+
self.history_info.setText(
|
540
|
+
f"{result.get('Call', '')}, {result.get('Exch1', '')}, {result.get('UserText','...')}"
|
541
|
+
)
|
542
|
+
else:
|
543
|
+
self.history_info.setText("")
|
544
|
+
|
545
|
+
|
546
|
+
def process_esm(self, new_focused_widget=None, with_enter=False):
|
547
|
+
"""ESM State Machine"""
|
548
|
+
|
549
|
+
# self.pref["run_state"]
|
550
|
+
|
551
|
+
# -----===== Assigned F-Keys =====-----
|
552
|
+
# self.esm_dict["CQ"]
|
553
|
+
# self.esm_dict["EXCH"]
|
554
|
+
# self.esm_dict["QRZ"]
|
555
|
+
# self.esm_dict["AGN"]
|
556
|
+
# self.esm_dict["HISCALL"]
|
557
|
+
# self.esm_dict["MYCALL"]
|
558
|
+
# self.esm_dict["QSOB4"]
|
559
|
+
|
560
|
+
# ----==== text fields ====----
|
561
|
+
# self.callsign
|
562
|
+
# self.sent
|
563
|
+
# self.receive
|
564
|
+
# self.other_1
|
565
|
+
# self.other_2
|
566
|
+
|
567
|
+
if new_focused_widget is not None:
|
568
|
+
self.current_widget = self.inputs_dict.get(new_focused_widget)
|
569
|
+
|
570
|
+
# print(f"checking esm {self.current_widget=} {with_enter=} {self.pref.get("run_state")=}")
|
571
|
+
|
572
|
+
for a_button in [
|
573
|
+
self.esm_dict["CQ"],
|
574
|
+
self.esm_dict["EXCH"],
|
575
|
+
self.esm_dict["QRZ"],
|
576
|
+
self.esm_dict["AGN"],
|
577
|
+
self.esm_dict["HISCALL"],
|
578
|
+
self.esm_dict["MYCALL"],
|
579
|
+
self.esm_dict["QSOB4"],
|
580
|
+
]:
|
581
|
+
if a_button is not None:
|
582
|
+
self.restore_button_color(a_button)
|
583
|
+
|
584
|
+
buttons_to_send = []
|
585
|
+
|
586
|
+
if self.pref.get("run_state"):
|
587
|
+
if self.current_widget == "callsign":
|
588
|
+
if len(self.callsign.text()) < 3:
|
589
|
+
self.make_button_green(self.esm_dict["CQ"])
|
590
|
+
buttons_to_send.append(self.esm_dict["CQ"])
|
591
|
+
elif len(self.callsign.text()) > 2:
|
592
|
+
self.make_button_green(self.esm_dict["HISCALL"])
|
593
|
+
self.make_button_green(self.esm_dict["EXCH"])
|
594
|
+
buttons_to_send.append(self.esm_dict["HISCALL"])
|
595
|
+
buttons_to_send.append(self.esm_dict["EXCH"])
|
596
|
+
|
597
|
+
elif self.current_widget == "other_2":
|
598
|
+
if self.other_2.text() == "":
|
599
|
+
self.make_button_green(self.esm_dict["AGN"])
|
600
|
+
buttons_to_send.append(self.esm_dict["AGN"])
|
601
|
+
else:
|
602
|
+
self.make_button_green(self.esm_dict["QRZ"])
|
603
|
+
buttons_to_send.append(self.esm_dict["QRZ"])
|
604
|
+
buttons_to_send.append("LOGIT")
|
605
|
+
|
606
|
+
if with_enter is True and bool(len(buttons_to_send)):
|
607
|
+
for button in buttons_to_send:
|
608
|
+
if button:
|
609
|
+
if button == "LOGIT":
|
610
|
+
self.save_contact()
|
611
|
+
continue
|
612
|
+
self.process_function_key(button)
|
613
|
+
else:
|
614
|
+
if self.current_widget == "callsign":
|
615
|
+
if len(self.callsign.text()) > 2:
|
616
|
+
self.make_button_green(self.esm_dict["MYCALL"])
|
617
|
+
buttons_to_send.append(self.esm_dict["MYCALL"])
|
618
|
+
|
619
|
+
elif self.current_widget == "other_2":
|
620
|
+
if self.other_2.text() == "":
|
621
|
+
self.make_button_green(self.esm_dict["AGN"])
|
622
|
+
buttons_to_send.append(self.esm_dict["AGN"])
|
623
|
+
else:
|
624
|
+
self.make_button_green(self.esm_dict["EXCH"])
|
625
|
+
buttons_to_send.append(self.esm_dict["EXCH"])
|
626
|
+
buttons_to_send.append("LOGIT")
|
627
|
+
|
628
|
+
if with_enter is True and bool(len(buttons_to_send)):
|
629
|
+
for button in buttons_to_send:
|
630
|
+
if button:
|
631
|
+
if button == "LOGIT":
|
632
|
+
self.save_contact()
|
633
|
+
continue
|
634
|
+
self.process_function_key(button)
|
not1mm/plugins/naqp_cw.py
CHANGED
@@ -543,6 +543,16 @@ def process_esm(self, new_focused_widget=None, with_enter=False):
|
|
543
543
|
self.process_function_key(button)
|
544
544
|
|
545
545
|
|
546
|
+
def populate_history_info_line(self):
|
547
|
+
result = self.database.fetch_call_history(self.callsign.text())
|
548
|
+
if result:
|
549
|
+
self.history_info.setText(
|
550
|
+
f"{result.get('Call', '')}, {result.get('Name', '')}, {result.get('State', '')}, {result.get('UserText','...')}"
|
551
|
+
)
|
552
|
+
else:
|
553
|
+
self.history_info.setText("")
|
554
|
+
|
555
|
+
|
546
556
|
def check_call_history(self):
|
547
557
|
""""""
|
548
558
|
result = self.database.fetch_call_history(self.callsign.text())
|
not1mm/plugins/naqp_rtty.py
CHANGED
@@ -650,6 +650,16 @@ def process_esm(self, new_focused_widget=None, with_enter=False):
|
|
650
650
|
self.fldigi_util.send_string(sendstring)
|
651
651
|
|
652
652
|
|
653
|
+
def populate_history_info_line(self):
|
654
|
+
result = self.database.fetch_call_history(self.callsign.text())
|
655
|
+
if result:
|
656
|
+
self.history_info.setText(
|
657
|
+
f"{result.get('Call', '')}, {result.get('Name', '')}, {result.get('State', '')}, {result.get('UserText','...')}"
|
658
|
+
)
|
659
|
+
else:
|
660
|
+
self.history_info.setText("")
|
661
|
+
|
662
|
+
|
653
663
|
def check_call_history(self):
|
654
664
|
""""""
|
655
665
|
result = self.database.fetch_call_history(self.callsign.text())
|
not1mm/plugins/naqp_ssb.py
CHANGED
@@ -513,6 +513,16 @@ def process_esm(self, new_focused_widget=None, with_enter=False):
|
|
513
513
|
self.process_function_key(button)
|
514
514
|
|
515
515
|
|
516
|
+
def populate_history_info_line(self):
|
517
|
+
result = self.database.fetch_call_history(self.callsign.text())
|
518
|
+
if result:
|
519
|
+
self.history_info.setText(
|
520
|
+
f"{result.get('Call', '')}, {result.get('Name', '')}, {result.get('State', '')}, {result.get('UserText','...')}"
|
521
|
+
)
|
522
|
+
else:
|
523
|
+
self.history_info.setText("")
|
524
|
+
|
525
|
+
|
516
526
|
def check_call_history(self):
|
517
527
|
""""""
|
518
528
|
result = self.database.fetch_call_history(self.callsign.text())
|
not1mm/plugins/raem.py
CHANGED
@@ -491,6 +491,16 @@ def recalculate_mults(self):
|
|
491
491
|
# self.database.change_contact(contact)
|
492
492
|
|
493
493
|
|
494
|
+
def populate_history_info_line(self):
|
495
|
+
result = self.database.fetch_call_history(self.callsign.text())
|
496
|
+
if result:
|
497
|
+
self.history_info.setText(
|
498
|
+
f"{result.get('Call', '')}, {result.get('Exch1', '')}, {result.get('UserText','...')}"
|
499
|
+
)
|
500
|
+
else:
|
501
|
+
self.history_info.setText("")
|
502
|
+
|
503
|
+
|
494
504
|
def check_call_history(self):
|
495
505
|
""""""
|
496
506
|
result = self.database.fetch_call_history(self.callsign.text())
|