not1mm 23.12.20__py3-none-any.whl → 24.1.15__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.
@@ -312,6 +312,11 @@
312
312
  <string>NAQP SSB</string>
313
313
  </property>
314
314
  </item>
315
+ <item>
316
+ <property name="text">
317
+ <string>PHONE WEEKLY TEST</string>
318
+ </property>
319
+ </item>
315
320
  <item>
316
321
  <property name="text">
317
322
  <string>WINTER FIELD DAY</string>
@@ -326,7 +331,7 @@
326
331
  </property>
327
332
  <property name="time">
328
333
  <time>
329
- <hour>0</hour>
334
+ <hour>16</hour>
330
335
  <minute>0</minute>
331
336
  <second>0</second>
332
337
  </time>
not1mm/lib/version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  """It's the version"""
2
- __version__ = "23.12.20"
2
+ __version__ = "24.1.15"
@@ -0,0 +1,372 @@
1
+ """Phone Weekly Test plugin"""
2
+
3
+ # Geographic Focus: North America
4
+ # Participation: Worldwide
5
+ # Mode: SSB
6
+ # Bands: 160, 80, 40, 20, 15m
7
+ # Classes: Single Op
8
+ # Max power: 100 watts
9
+ # Exchange: NA: Name + (state/province/country)
10
+ # non-NA: Name
11
+ # Work stations: Once per band
12
+ # QSO Points: NA station: 1 point per QSO
13
+ # non-NA station: 1 point per QSO with an NA station
14
+ # Multipliers: Each US state (including KH6/KL7) once per band
15
+ # Each VE province/territory once per band
16
+ # Each North American country (except W/VE) once per band
17
+ # Score Calculation: Total score = total QSO points x total mults
18
+ # Submit logs by: 0300Z January 19, 2024
19
+ # E-mail logs to: (none)
20
+ # Post log summary at: http://www.3830scores.com
21
+ # Mail logs to: (none)
22
+ # Find rules at: http://www.perluma.com/Phone_Fray_Contest_Rules.pdf
23
+
24
+
25
+ # pylint: disable=invalid-name, unused-argument, unused-variable, c-extension-no-member, unused-import
26
+
27
+ import datetime
28
+ import logging
29
+ import platform
30
+
31
+ from pathlib import Path
32
+
33
+ from PyQt5 import QtWidgets
34
+
35
+ from not1mm.lib.plugin_common import gen_adif, get_points
36
+ from not1mm.lib.version import __version__
37
+
38
+ logger = logging.getLogger("__main__")
39
+
40
+ name = "PHONE WEEKLY TEST"
41
+ cabrillo_name = "PHONE-WEEKLY-TEST"
42
+ mode = "SSB" # CW SSB BOTH RTTY
43
+ # columns = [0, 1, 2, 3, 4, 10, 11, 14, 15]
44
+ columns = [
45
+ "YYYY-MM-DD HH:MM:SS",
46
+ "Call",
47
+ "Freq",
48
+ "Name",
49
+ "Sect",
50
+ "M1",
51
+ "PTS",
52
+ ]
53
+
54
+ advance_on_space = [True, True, True, True, True]
55
+
56
+ # 1 once per contest, 2 work each band, 3 each band/mode, 4 no dupe checking
57
+ dupe_type = 2
58
+
59
+
60
+ def init_contest(self):
61
+ """setup plugin"""
62
+ set_tab_next(self)
63
+ set_tab_prev(self)
64
+ interface(self)
65
+ self.next_field = self.other_1
66
+
67
+
68
+ def interface(self):
69
+ """Setup user interface"""
70
+ self.field1.hide()
71
+ self.field2.hide()
72
+ self.field3.show()
73
+ self.field4.show()
74
+ namefield = self.field3.findChild(QtWidgets.QLabel)
75
+ namefield.setText("Name")
76
+ self.field3.setAccessibleName("Name")
77
+ spc = self.field4.findChild(QtWidgets.QLabel)
78
+ spc.setText("State")
79
+ self.field4.setAccessibleName("State")
80
+
81
+
82
+ def reset_label(self):
83
+ """reset label after field cleared"""
84
+
85
+
86
+ def set_tab_next(self):
87
+ """Set TAB Advances"""
88
+ self.tab_next = {
89
+ self.callsign: self.field3.findChild(QtWidgets.QLineEdit),
90
+ self.field3.findChild(QtWidgets.QLineEdit): self.field4.findChild(
91
+ QtWidgets.QLineEdit
92
+ ),
93
+ self.field4.findChild(QtWidgets.QLineEdit): self.callsign,
94
+ }
95
+
96
+
97
+ def set_tab_prev(self):
98
+ """Set TAB Advances"""
99
+ self.tab_prev = {
100
+ self.callsign: self.field4.findChild(QtWidgets.QLineEdit),
101
+ self.field3.findChild(QtWidgets.QLineEdit): self.callsign,
102
+ self.field4.findChild(QtWidgets.QLineEdit): self.field3.findChild(
103
+ QtWidgets.QLineEdit
104
+ ),
105
+ }
106
+
107
+
108
+ def set_contact_vars(self):
109
+ """Contest Specific"""
110
+ self.contact["SNT"] = self.sent.text()
111
+ self.contact["RCV"] = self.receive.text()
112
+ self.contact["Name"] = self.other_1.text().upper()
113
+ self.contact["Sect"] = self.other_2.text().upper()
114
+ self.contact["SentNr"] = self.contest_settings.get("SentExchange", 0)
115
+
116
+ if self.contact.get("Sect"):
117
+ result = self.database.fetch_sect_band_exists(
118
+ self.contact.get("Sect", ""), self.contact.get("Band", "")
119
+ )
120
+ if result.get("sect_count"):
121
+ self.contact["IsMultiplier1"] = 0
122
+ else:
123
+ self.contact["IsMultiplier1"] = 1
124
+
125
+
126
+ def predupe(self):
127
+ """called after callsign entered"""
128
+
129
+
130
+ def prefill(self):
131
+ """Fill sentnr"""
132
+ # if len(self.other_2.text()) == 0:
133
+ # self.other_2.setText(str(self.contact.get("ZN", "")))
134
+ # self.other_1.setText(str(self.contest_settings.get("SentExchange", 0)))
135
+
136
+
137
+ def points(self):
138
+ """Calc point"""
139
+ mycontinent = ""
140
+ hiscontinent = ""
141
+ result = self.cty_lookup(self.station.get("Call", ""))
142
+ if result:
143
+ for item in result.items():
144
+ mycontinent = item[1].get("continent", "")
145
+ result = self.cty_lookup(self.contact.get("Call", ""))
146
+ if result:
147
+ for item in result.items():
148
+ hiscontinent = item[1].get("continent", "")
149
+ if mycontinent == "NA" or hiscontinent == "NA":
150
+ return 1
151
+ return 0
152
+
153
+
154
+ def show_mults(self):
155
+ """Return display string for mults"""
156
+ result = self.database.fetch_section_band_count_nodx()
157
+ if result:
158
+ return int(result.get("sb_count", 0))
159
+ return 0
160
+
161
+
162
+ def show_qso(self):
163
+ """Return qso count"""
164
+ result = self.database.fetch_qso_count()
165
+ if result:
166
+ return int(result.get("qsos", 0))
167
+ return 0
168
+
169
+
170
+ def calc_score(self):
171
+ """Return calculated score"""
172
+ result = self.database.fetch_points()
173
+ if result is not None:
174
+ score = result.get("Points", "0")
175
+ if score is None:
176
+ score = "0"
177
+ contest_points = int(score)
178
+ mults = show_mults(self)
179
+ return contest_points * mults
180
+ return 0
181
+
182
+
183
+ def adif(self):
184
+ """Call the generate ADIF function"""
185
+ gen_adif(self, cabrillo_name, "NAQP-SSB")
186
+
187
+
188
+ def cabrillo(self):
189
+ """Generates Cabrillo file. Maybe."""
190
+ # https://www.cqwpx.com/cabrillo.htm
191
+ logger.debug("******Cabrillo*****")
192
+ logger.debug("Station: %s", f"{self.station}")
193
+ logger.debug("Contest: %s", f"{self.contest_settings}")
194
+ now = datetime.datetime.now()
195
+ date_time = now.strftime("%Y-%m-%d_%H-%M-%S")
196
+ filename = (
197
+ str(Path.home())
198
+ + "/"
199
+ + f"{self.station.get('Call').upper()}_{cabrillo_name}_{date_time}.log"
200
+ )
201
+ logger.debug("%s", filename)
202
+ log = self.database.fetch_all_contacts_asc()
203
+ try:
204
+ with open(filename, "w", encoding="ascii") as file_descriptor:
205
+ print("START-OF-LOG: 3.0", end="\r\n", file=file_descriptor)
206
+ print(
207
+ f"CREATED-BY: Not1MM v{__version__}",
208
+ end="\r\n",
209
+ file=file_descriptor,
210
+ )
211
+ print(
212
+ f"CONTEST: {cabrillo_name}",
213
+ end="\r\n",
214
+ file=file_descriptor,
215
+ )
216
+ print(
217
+ f"CALLSIGN: {self.station.get('Call','')}",
218
+ end="\r\n",
219
+ file=file_descriptor,
220
+ )
221
+ print(
222
+ f"LOCATION: {self.station.get('ARRLSection', '')}",
223
+ end="\r\n",
224
+ file=file_descriptor,
225
+ )
226
+ # print(
227
+ # f"ARRL-SECTION: {self.pref.get('section', '')}",
228
+ # end="\r\n",
229
+ # file=file_descriptor,
230
+ # )
231
+ print(
232
+ f"CATEGORY-OPERATOR: {self.contest_settings.get('OperatorCategory','')}",
233
+ end="\r\n",
234
+ file=file_descriptor,
235
+ )
236
+ print(
237
+ f"CATEGORY-ASSISTED: {self.contest_settings.get('AssistedCategory','')}",
238
+ end="\r\n",
239
+ file=file_descriptor,
240
+ )
241
+ print(
242
+ f"CATEGORY-BAND: {self.contest_settings.get('BandCategory','')}",
243
+ end="\r\n",
244
+ file=file_descriptor,
245
+ )
246
+ print(
247
+ f"CATEGORY-MODE: {self.contest_settings.get('ModeCategory','')}",
248
+ end="\r\n",
249
+ file=file_descriptor,
250
+ )
251
+ print(
252
+ f"CATEGORY-TRANSMITTER: {self.contest_settings.get('TransmitterCategory','')}",
253
+ end="\r\n",
254
+ file=file_descriptor,
255
+ )
256
+ if self.contest_settings.get("OverlayCategory", "") != "N/A":
257
+ print(
258
+ f"CATEGORY-OVERLAY: {self.contest_settings.get('OverlayCategory','')}",
259
+ end="\r\n",
260
+ file=file_descriptor,
261
+ )
262
+ print(
263
+ f"GRID-LOCATOR: {self.station.get('GridSquare','')}",
264
+ end="\r\n",
265
+ file=file_descriptor,
266
+ )
267
+ # print(
268
+ # f"CATEGORY: {None}",
269
+ # end="\r\n",
270
+ # file=file_descriptor,
271
+ # )
272
+ print(
273
+ f"CATEGORY-POWER: {self.contest_settings.get('PowerCategory','')}",
274
+ end="\r\n",
275
+ file=file_descriptor,
276
+ )
277
+
278
+ print(
279
+ f"CLAIMED-SCORE: {calc_score(self)}",
280
+ end="\r\n",
281
+ file=file_descriptor,
282
+ )
283
+ print(
284
+ f"OPERATORS: {self.contest_settings.get('Operators','')}",
285
+ end="\r\n",
286
+ file=file_descriptor,
287
+ )
288
+ print(
289
+ f"NAME: {self.station.get('Name', '')}",
290
+ end="\r\n",
291
+ file=file_descriptor,
292
+ )
293
+ print(
294
+ f"ADDRESS: {self.station.get('Street1', '')}",
295
+ end="\r\n",
296
+ file=file_descriptor,
297
+ )
298
+ print(
299
+ f"ADDRESS-CITY: {self.station.get('City', '')}",
300
+ end="\r\n",
301
+ file=file_descriptor,
302
+ )
303
+ print(
304
+ f"ADDRESS-STATE-PROVINCE: {self.station.get('State', '')}",
305
+ end="\r\n",
306
+ file=file_descriptor,
307
+ )
308
+ print(
309
+ f"ADDRESS-POSTALCODE: {self.station.get('Zip', '')}",
310
+ end="\r\n",
311
+ file=file_descriptor,
312
+ )
313
+ print(
314
+ f"ADDRESS-COUNTRY: {self.station.get('Country', '')}",
315
+ end="\r\n",
316
+ file=file_descriptor,
317
+ )
318
+ print(
319
+ f"EMAIL: {self.station.get('Email', '')}",
320
+ end="\r\n",
321
+ file=file_descriptor,
322
+ )
323
+ for contact in log:
324
+ the_date_and_time = contact.get("TS", "")
325
+ themode = contact.get("Mode", "")
326
+ if themode == "LSB" or themode == "USB":
327
+ themode = "PH"
328
+ frequency = str(int(contact.get("Freq", "0"))).rjust(5)
329
+
330
+ loggeddate = the_date_and_time[:10]
331
+ loggedtime = the_date_and_time[11:13] + the_date_and_time[14:16]
332
+ print(
333
+ f"QSO: {frequency} {themode} {loggeddate} {loggedtime} "
334
+ f"{contact.get('StationPrefix', '').ljust(13)} "
335
+ f"{str(contact.get('SentNr', '')).upper()} "
336
+ f"{contact.get('Call', '').ljust(13)} "
337
+ f"{str(contact.get('Name', '')).ljust(11)} "
338
+ f"{str(contact.get('Sect', '')).ljust(5)}",
339
+ end="\r\n",
340
+ file=file_descriptor,
341
+ )
342
+ print("END-OF-LOG:", end="\r\n", file=file_descriptor)
343
+ except IOError as exception:
344
+ logger.critical("cabrillo: IO error: %s, writing to %s", exception, filename)
345
+ return
346
+
347
+
348
+ def recalculate_mults(self):
349
+ """Recalculates multipliers after change in logged qso."""
350
+
351
+ all_contacts = self.database.fetch_all_contacts_asc()
352
+ for contact in all_contacts:
353
+ time_stamp = contact.get("TS")
354
+ sect = contact.get("Sect", "")
355
+ band = contact.get("Band", "")
356
+ query = (
357
+ f"select count(*) as sect_count from dxlog where TS < '{time_stamp}' "
358
+ f"and Sect = '{sect}' "
359
+ f"and Band = '{band}' "
360
+ f"and ContestNR = {self.pref.get('contest', '1')};"
361
+ )
362
+ result = self.database.exec_sql(query)
363
+ count = result.get("sect_count", 1)
364
+ if count == 0 and contact.get("Points", 0) == 1 and sect != "DX":
365
+ contact["IsMultiplier1"] = 1
366
+ else:
367
+ contact["IsMultiplier1"] = 0
368
+ self.database.change_contact(contact)
369
+ cmd = {}
370
+ cmd["cmd"] = "UPDATELOG"
371
+ cmd["station"] = platform.node()
372
+ self.multicast_interface.send_as_json(cmd)