Skip to content

Commit 9b17959

Browse files
authored
feat: punch system selection in timekeeping properties dialog (#534)
1 parent 8488f4c commit 9b17959

File tree

7 files changed

+67
-54
lines changed

7 files changed

+67
-54
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
+ Competitors' numbers in relay format (e.g., 15.1, [#501](https://github.com/sportorg/pysport/issues/501))
1717
+ Reverse row numbering in the results tab ([#519](https://github.com/sportorg/pysport/issues/519))
1818
+ Templates can compress data (gzip) to reduce the size of html files
19+
+ Punch system selection in timekeeping properties dialog
1920

2021
### Fixes
2122
+ Fixed: multi day race processing - all days are refreshed on the file opening

changelog_ru.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
+ Номера участников в эстафетном формате (15.1, [#501](https://github.com/sportorg/pysport/issues/501))
1616
+ Обратная нумерация строк во вкладке результатов ([#519](https://github.com/sportorg/pysport/issues/519))
1717
+ В шаблонах можно сжимать данные (gzip) для уменьшения размера файлов html файлов
18+
+ Выбор системы отметки в диалоге настроек хронометража
1819

1920
### Исправление
2021
+ Исправлена работа типа соревнований "многодневная гонка" - при открытии базы все дни перепроверяются

languages/ru_RU/LC_MESSAGES/sportorg.po

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,9 @@ msgstr "Ввести Шахматку"
10321032
msgid "Service"
10331033
msgstr "Сервис"
10341034

1035+
msgid "On/Off card readout"
1036+
msgstr "Запустить/остановить чтение чипов"
1037+
10351038
msgid "on/off SPORTident readout"
10361039
msgstr "Запустить/остановить чтение чипов SPORTident"
10371040

@@ -1041,6 +1044,9 @@ msgstr "Запустить/остановить чтение чипов Sportidu
10411044
msgid "on/off SFR readout"
10421045
msgstr "Запустить/остановить чтение чипов SFR"
10431046

1047+
msgid "Punch system"
1048+
msgstr "Система отметки"
1049+
10441050
msgid "Send selected"
10451051
msgstr "Отправить выбранные"
10461052

sportorg/gui/dialogs/timekeeping_properties.py

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from sportorg.gui.global_access import GlobalAccess
3434
from sportorg.gui.utils.custom_controls import AdvComboBox, AdvSpinBox, AdvTimeEdit
3535
from sportorg.language import translate
36-
from sportorg.models.memory import race
36+
from sportorg.models.memory import race, SystemType
3737
from sportorg.models.result.result_tools import recalculate_results
3838
from sportorg.modules.sportident.sireader import SIReaderClient
3939

@@ -70,6 +70,22 @@ def init_ui(self):
7070
self.item_si_port.addItems(SIReaderClient().get_ports())
7171
self.tk_layout.addRow(self.label_si_port, self.item_si_port)
7272

73+
self.punch_system_box = QGroupBox(translate("Punch system"))
74+
self.punch_system_layout = QFormLayout()
75+
self.punch_system_si = QRadioButton(translate("SPORTident"))
76+
self.punch_system_layout.addRow(self.punch_system_si)
77+
self.punch_system_sfr = QRadioButton(translate("SFR"))
78+
self.punch_system_layout.addRow(self.punch_system_sfr)
79+
self.punch_system_sportiduino = QRadioButton(translate("Sportiduino (Clever)"))
80+
self.punch_system_layout.addRow(self.punch_system_sportiduino)
81+
self.punch_system_impinj = QRadioButton(translate("RFID Impinj"))
82+
self.punch_system_layout.addRow(self.punch_system_impinj)
83+
self.punch_system_srpid = QRadioButton(translate("SRPID"))
84+
self.punch_system_layout.addRow(self.punch_system_srpid)
85+
self.punch_system_si.setChecked(True)
86+
self.punch_system_box.setLayout(self.punch_system_layout)
87+
self.tk_layout.addRow(self.punch_system_box)
88+
7389
self.chip_reading_box = QGroupBox(translate("Assigning a chip when reading"))
7490
self.chip_reading_layout = QFormLayout()
7591
self.chip_reading_off = QRadioButton(translate("Off"))
@@ -443,6 +459,8 @@ def set_values_from_model(self):
443459
"ignore_punches_before_start", False
444460
)
445461
si_port = cur_race.get_setting("system_port", "")
462+
punch_system = cur_race.get_punch_system()
463+
446464
readout_duplicate_timeout = OTime(
447465
msec=cur_race.get_setting("readout_duplicate_timeout", 15000)
448466
)
@@ -451,6 +469,17 @@ def set_values_from_model(self):
451469

452470
self.item_si_port.setCurrentText(si_port)
453471

472+
if punch_system == SystemType.SFR:
473+
self.punch_system_sfr.setChecked(True)
474+
elif punch_system == SystemType.SPORTIDUINO:
475+
self.punch_system_sportiduino.setChecked(True)
476+
elif punch_system == SystemType.RFID_IMPINJ:
477+
self.punch_system_impinj.setChecked(True)
478+
elif punch_system == SystemType.SRPID:
479+
self.punch_system_srpid.setChecked(True)
480+
else:
481+
self.punch_system_si.setChecked(True)
482+
454483
if start_source == "protocol":
455484
self.item_start_protocol.setChecked(True)
456485
elif start_source == "station":
@@ -675,6 +704,17 @@ def apply_changes_impl(self):
675704

676705
obj.set_setting("system_port", self.item_si_port.currentText())
677706

707+
if self.punch_system_sfr.isChecked():
708+
obj.set_setting("punch_system", SystemType.SFR.value)
709+
elif self.punch_system_sportiduino.isChecked():
710+
obj.set_setting("punch_system", SystemType.SPORTIDUINO.value)
711+
elif self.punch_system_impinj.isChecked():
712+
obj.set_setting("punch_system", SystemType.RFID_IMPINJ.value)
713+
elif self.punch_system_srpid.isChecked():
714+
obj.set_setting("punch_system", SystemType.SRPID.value)
715+
else:
716+
obj.set_setting("punch_system", SystemType.SPORTIDENT.value)
717+
678718
obj.set_setting("system_start_source", start_source)
679719
obj.set_setting("system_finish_source", finish_source)
680720
obj.set_setting("system_missed_finish", missed_finish)

sportorg/gui/menu/actions.py

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
from sportorg.language import translate
5454
from sportorg.libs.sfr import sfrximporter
5555
from sportorg.libs.winorient.wdb import write_wdb
56-
from sportorg.models.memory import ResultManual, ResultStatus, race
56+
from sportorg.models.memory import ResultManual, ResultStatus, race, SystemType
5757
from sportorg.models.result.result_checker import ResultChecker
5858
from sportorg.models.result.result_tools import recalculate_results
5959
from sportorg.models.start.start_preparation import (
@@ -600,37 +600,19 @@ def execute(self):
600600
self.app.refresh()
601601

602602

603-
class SPORTidentReadoutAction(Action, metaclass=ActionFactory):
603+
class CardReadoutAction(Action, metaclass=ActionFactory):
604604
def execute(self):
605-
SIReaderClient().toggle()
606-
time.sleep(0.5)
607-
self.app.interval()
608-
609-
610-
class SportiduinoReadoutAction(Action, metaclass=ActionFactory):
611-
def execute(self):
612-
SportiduinoClient().toggle()
613-
time.sleep(0.5)
614-
self.app.interval()
615-
616-
617-
class ImpinjReadoutAction(Action, metaclass=ActionFactory):
618-
def execute(self):
619-
ImpinjClient().toggle()
620-
time.sleep(0.5)
621-
self.app.interval()
622-
623-
624-
class SrpidReadoutAction(Action, metaclass=ActionFactory):
625-
def execute(self):
626-
SrpidClient().toggle()
627-
time.sleep(0.5)
628-
self.app.interval()
629-
630-
631-
class SFRReadoutAction(Action, metaclass=ActionFactory):
632-
def execute(self):
633-
SFRReaderClient().toggle()
605+
punch_system = race().get_punch_system()
606+
if punch_system == SystemType.SFR:
607+
SFRReaderClient().toggle()
608+
elif punch_system == SystemType.SPORTIDUINO:
609+
SportiduinoClient().toggle()
610+
elif punch_system == SystemType.RFID_IMPINJ:
611+
ImpinjClient().toggle()
612+
elif punch_system == SystemType.SRPID:
613+
SrpidClient().toggle()
614+
else:
615+
SIReaderClient().toggle()
634616
time.sleep(0.5)
635617
self.app.interval()
636618

sportorg/gui/menu/menu.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -369,30 +369,10 @@ def menu_list():
369369
"title": translate("Service"),
370370
"actions": [
371371
{
372-
"title": translate("on/off SPORTident readout"),
372+
"title": translate("On/Off card readout"),
373373
"icon": config.icon_dir("sportident.png"),
374374
"shortcut": "F8",
375-
"action": "SPORTidentReadoutAction",
376-
},
377-
{
378-
"title": translate("on/off Sportiduino readout"),
379-
"icon": config.icon_dir("sportiduino.png"),
380-
"action": "SportiduinoReadoutAction",
381-
},
382-
{
383-
"title": translate("on/off SFR readout"),
384-
"icon": config.icon_dir("sfr.png"),
385-
"action": "SFRReadoutAction",
386-
},
387-
{
388-
"title": translate("on/off RFID Impinj readout"),
389-
"icon": config.icon_dir("rfid_impinj.png"),
390-
"action": "ImpinjReadoutAction",
391-
},
392-
{
393-
"title": translate("on/off SRPid readout"),
394-
"icon": config.icon_dir("srpid.png"),
395-
"action": "SrpidReadoutAction",
375+
"action": "CardReadoutAction",
396376
},
397377
{
398378
"title": translate("Teamwork"),

sportorg/models/memory.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,6 +1852,9 @@ def get_setting(self, setting, nvl_value=None):
18521852
else:
18531853
return nvl_value
18541854

1855+
def get_punch_system(self):
1856+
return SystemType(self.get_setting("punch_system", SystemType.SPORTIDENT.value))
1857+
18551858
def get_days(self, date_=None):
18561859
return self.data.get_days(date_)
18571860

0 commit comments

Comments
 (0)