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