DuathlonStarter for small sport events

This is a program designed for small Du/Tri-athlon sporting events (but probably more for tri-) where running and biking (and swimming?) can’t be done in the same place, so this program helps with that, and usually for swimming, the pool is not at the same place…

I did this when some guy approached me with such a problem he had when organizing these events, and the solution he was using was rather… poor (though he had no choice at the time). He was using some Excel document which looked like it was made by a mad man. You’d paste in the times and press the start button. Then Excel would freeze completely and eat up 100% CPU for no reason like wtf.

In essence how this works is, when athletes go through one section (i.e. running), the times are recorded in some time-logging program, like a spreadsheet maybe, athletes relocate to where they’ll be doing the next section (i.e. biking or swimming), recorded times are loaded into the program and the program counts down time difference and beeps when it reaches zero for each athlete.

This program is written in “Python 3” with PyQt5, therefore it’s cross-platform. To use on other systems (Linux, Mac) the below requirements should be met.

The program interface (and commit messages) are in Lithuanian language, but they can be easily translated if you prefer another language.

Now this project is very simple from a user’s perspective. But for some parts under the hood it was very complicated… Mainly I did this project to learn Qt, it was all done in about 2 months of on and off work (would be about 1 month if I’d compress the time) and when I started I knew nothing about Qt and later I realized how awesome and easy to learn it is. It’s very well documented, very easy and straightforward to use, and once you get the hang of it (few weeks of constant work) it just becomes as easy as Python itself.

All glory to Python and Qt!!!

Features

Anyway, here are the features:

  • Data loading
    • From file (text) – Select a text file containing logged times
    • From memory – Can be pasted from time-logging programs (i.e. spreadsheets), either from two side-by-side columns, or different columns
  • Additional screens
    • Runner list – Show a whole list of loaded athletes and their status
    • Big clock – Show a big clock, current and next athletes. This is to be dragged to a second monitor for everyone to see the time and who will be next
  • Settings
    • Change sound file – Users can use their own for a start, or select from a few included sounds
    • Delay first – Choose a delay in seconds before first athlete
    • Big clock size – Change big clock size in percents

Requirements

There are some requirements to this program:

  • To run the program
    • Python 3.6+
    • PyQt5
    • OR

    • Just a Windows machine, if using the standalone binary
  • To use the program
    • Times has to be in format: 1337[tab]1:07,2
      Which translates to: athlete_nr[tab]minute:seconds,millis – this time format can be changed easily in a spreadsheet program, tab is automatically inserted when copying from there

Known problems

I made this program as much bullet-proof as I could, it will not crash due to bugs, I am not liable for anything if your system is full of sh*t :) that said…

On a Windows system (can’t say for others), when the clock is running and you press on a titlebar to move the window, the clock (or more precisely the thread that the clock runs in) pauses for a second, or until you move the window, or when you release the titlebar. This is by design on system level and can’t be overridden or otherwise changed.

More on this: https://stackoverflow.com/questions/35180772/pyqt4-qtimer-stops-when-close-button-is-held

Also, pywin32 doesn’t change anything.

Technical stuff

The code is very well documented and easy to read (at least I think so :P).
All generated UI files are named *Dialog.py and *Window.py and placed in the root folder.
GUIs folder contain the XML UI files needed for editing in QtDesigner.
sounds folder contains sample sound files.
images folder contains a program icon.
start.py is where the fun begins. This is, as the name suggests, the file to run to start it all.

This project is available on my github.

Leave a Reply

Your email address will not be published. Required fields are marked *