Skip to content

Commit 0a51fe3

Browse files
committed
@mbridak Add CW, PH, and DI fields to the statistics window.
1 parent b34e1dd commit 0a51fe3

File tree

5 files changed

+38
-5
lines changed

5 files changed

+38
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Changelog
22

3+
- [25-3-24] Add CW, PH, DI counts to the statistics window.
34
- [25-3-23] Add a statistics window.
45
- [25-3-19-1] Add EA His Maj King of Spain SSB.
56
- [25-3-19] Merged PR from @DD5ML Adding DARC VHF.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ generated, 'cause I'm lazy, list of those who've submitted PR's.
215215

216216
## Recent Changes
217217

218+
- [25-3-24] Add CW, PH, DI counts to the statistics window.
218219
- [25-3-23] Add a statistics window.
219220
- [25-3-19-1] Add EA His Maj King of Spain SSB.
220221
- [25-3-19] Merged PR from @DD5ML Adding DARC VHF.

not1mm/lib/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""It's the version"""
22

3-
__version__ = "25.3.23"
3+
__version__ = "25.3.24"

not1mm/statistics.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
from PyQt6 import uic, QtWidgets
88
from PyQt6.QtWidgets import QDockWidget
9+
from PyQt6.QtCore import pyqtSignal, QTimer
910

1011
# from PyQt6.QtGui import QColorConstants, QPalette, QColor
11-
from PyQt6.QtCore import pyqtSignal
1212

1313
import not1mm.fsutils as fsutils
1414
from not1mm.lib.database import DataBase
@@ -43,6 +43,9 @@ def __init__(self):
4343
self.database = DataBase(self.dbname, fsutils.APP_DATA_PATH)
4444
self.database.current_contest = self.pref.get("contest", 0)
4545
uic.loadUi(fsutils.APP_DATA_PATH / "statistics.ui", self)
46+
self.timer = QTimer()
47+
self.timer.timeout.connect(self.get_run_and_total_qs)
48+
self.timer.start(5000)
4649

4750
def msg_from_main(self, packet):
4851
""""""
@@ -100,9 +103,13 @@ def load_pref(self) -> None:
100103

101104
def get_run_and_total_qs(self):
102105
"""get numbers"""
106+
if self.active is False:
107+
return
103108
self.tableWidget.clear()
104-
self.tableWidget.setColumnCount(4)
105-
self.tableWidget.setHorizontalHeaderLabels(["BAND", "QSO", "CALLS", "POINTS"])
109+
self.tableWidget.setColumnCount(7)
110+
self.tableWidget.setHorizontalHeaderLabels(
111+
["BAND", "QSO", "CALLS", "CW", "PH", "DI", "PTS"]
112+
)
106113
self.tableWidget.verticalHeader().setVisible(False)
107114
self.tableWidget.setEditTriggers(
108115
QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers
@@ -128,7 +135,19 @@ def get_run_and_total_qs(self):
128135
self.tableWidget.setItem(row, 2, item)
129136
item = QtWidgets.QTableWidgetItem(str(result["points"]))
130137
item.setTextAlignment(0x0002)
138+
self.tableWidget.setItem(row, 6, item)
139+
query = f"select sum(sortedmode.mode == 'CW') as CW, sum(sortedmode.mode == 'PH') as PH, sum(sortedmode.mode == 'DI') as DI from (select CASE Mode WHEN 'LSB' THEN 'PH' WHEN 'USB' THEN 'PH' WHEN 'CW' THEN 'CW' WHEN 'RTTY' THEN 'DI' ELSE 'OTHER' END mode from DXLOG where ContestNR = {self.database.current_contest} and Band = '{band['band']}') as sortedmode;"
140+
result = self.database.exec_sql(query)
141+
item = QtWidgets.QTableWidgetItem(str(result["CW"]))
142+
item.setTextAlignment(0x0002)
131143
self.tableWidget.setItem(row, 3, item)
144+
item = QtWidgets.QTableWidgetItem(str(result["PH"]))
145+
item.setTextAlignment(0x0002)
146+
self.tableWidget.setItem(row, 4, item)
147+
item = QtWidgets.QTableWidgetItem(str(result["DI"]))
148+
item.setTextAlignment(0x0002)
149+
self.tableWidget.setItem(row, 5, item)
150+
132151
row += 1
133152
query = f"select count(*) as qs, count(DISTINCT(Call)) as calls, sum(Points) as points from DXLOG where ContestNR = {self.database.current_contest};"
134153
result = self.database.exec_sql(query)
@@ -143,7 +162,19 @@ def get_run_and_total_qs(self):
143162
self.tableWidget.setItem(row, 2, item)
144163
item = QtWidgets.QTableWidgetItem(str(result["points"]))
145164
item.setTextAlignment(0x0002)
165+
self.tableWidget.setItem(row, 6, item)
166+
167+
query = f"select sum(sortedmode.mode == 'CW') as CW, sum(sortedmode.mode == 'PH') as PH, sum(sortedmode.mode == 'DI') as DI from (select CASE Mode WHEN 'LSB' THEN 'PH' WHEN 'USB' THEN 'PH' WHEN 'CW' THEN 'CW' WHEN 'RTTY' THEN 'DI' ELSE 'OTHER' END mode from DXLOG where ContestNR = {self.database.current_contest}) as sortedmode;"
168+
result = self.database.exec_sql(query)
169+
item = QtWidgets.QTableWidgetItem(str(result["CW"]))
170+
item.setTextAlignment(0x0002)
146171
self.tableWidget.setItem(row, 3, item)
172+
item = QtWidgets.QTableWidgetItem(str(result["PH"]))
173+
item.setTextAlignment(0x0002)
174+
self.tableWidget.setItem(row, 4, item)
175+
item = QtWidgets.QTableWidgetItem(str(result["DI"]))
176+
item.setTextAlignment(0x0002)
177+
self.tableWidget.setItem(row, 5, item)
147178
self.tableWidget.resizeColumnsToContents()
148179
self.tableWidget.resizeRowsToContents()
149180

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "not1mm"
7-
version = "25.3.23"
7+
version = "25.3.24"
88
description = "NOT1MM Logger"
99
license = "GPL-3.0-or-later"
1010
readme = "README.md"

0 commit comments

Comments
 (0)