Skip to content

Commit

Permalink
Release v3.1.47-20240418094244
Browse files Browse the repository at this point in the history
  • Loading branch information
esitarski committed Apr 18, 2024
2 parents 3f47a65 + 1f0d457 commit 2ba0301
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 15 deletions.
19 changes: 6 additions & 13 deletions CrossMgrHtml/TTCountdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@

var maxNext = 8000;
var resetSecond = 20;
var enableBeeps = true;
var enableBeeps = false;
var turnOnSoundFlag = 12; // Make a low sound to turn on the browser audio. Otherwise the first beep will be late.
var beepTimes = [resetSecond, turnOnSoundFlag, 10, 5, 4, 3, 2, 1, 0, -3];

Expand Down Expand Up @@ -439,21 +439,19 @@
function initiateSound() {
if( enableBeeps )
return;
enableBeeps = true;

let beep_btn = document.getElementById('beep-btn')
beep_btn.innerHTML = '';
beep_btn.className = '';
beep_btn.removeEventListener( 'click', initiateSound );
beep_btn.hidden = true;

openFullscreen();

// Resume the context as we now have a user gesture.
audioCtx.resume();

// Play some beeps to set the volume.
for( let i = 0; i < 8; ++i )
setTimeout(function() { playBeep(i%4); }, 250*i);
enableBeeps = true;
for( let i = 0; i < 5; ++i )
setTimeout(function() { playBeep(i%5); }, 250*i);
}

// Use Cristian's Algorithm (https://en.wikipedia.org/wiki/Cristian%27s_algorithm).
Expand Down Expand Up @@ -576,12 +574,7 @@

// The first sound must be triggered by a user action.
isDevice = true;
enableBeeps = false;
let countdown_clock = document.getElementById('countdown-clock');
let beep_btn = document.getElementById('beep-btn');
beep_btn.innerHTML = 'Press for Beeps';
beep_btn.className = 'btn';
beep_btn.addEventListener( 'mousedown', initiateSound );

tServer = ServerDate();
if( raceStartTuple != null ) {
Expand Down Expand Up @@ -738,7 +731,7 @@
<span id="team-starting">CrossMgr Time Trial Starter</span>
</div>
<div id="countdown-clock-div">
<span id="beep-btn"></span><br/>
<button id="beep-btn" class="btn" onmousedown="initiateSound();">Press for Beeps</button><br/>
<span id="countdown-clock">&nbsp;&nbsp;</span>
</div>
<div id="rider-next">
Expand Down
37 changes: 37 additions & 0 deletions SeriesMgr/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,48 @@
import wx.grid as gridlib
import wx.lib.agw.floatspin as FS
import os
import io
import re
import sys
import base64
import SeriesModel
import Utils

def fileToResource( fname ):
# Get the file type.
ext = os.path.splitext( fname )[1:].lower()
# Convert the file contents to base64.
with open(fname, 'rb') as f:
b64 = base64.encode( f.read() )
return 'data:image/{};base64,{}'.format( ext, b64.decode('utf-9') )

ext_to_bmp_type = {
'bmp': wx.BITMAP_TYPE_BMP, # Load a Windows bitmap file.
'gif': wx.BITMAP_TYPE_GIF, # Load a GIF bitmap file.
'jpeg': wx.BITMAP_TYPE_JPEG, # Load a JPEG bitmap file.
'jpg': wx.BITMAP_TYPE_JPEG, # Load a JPEG bitmap file.
'png': wx.BITMAP_TYPE_PNG, # Load a PNG bitmap file.
}

def resourceToImage( imageResource ):
header, data = imageResource.split( ';', 1 )
bitmap_type = ext_to_bmp_type[header.split( '/', 1 )[1]]
b64 = base64.decode( data.split( ',', 1 )[1] )
return wx.Image( io.BytesIO(b64), bitmap_type )

def getBitmap( model ):
if model.imageResource is None:
image = wx.Image( os.path.join(Utils.getImageFolder(), 'SeriesMgr128.png') )
else:
image = resourceToImage( model.imageResource )
return wx.Bitmap( image )

def getImageResource( model ):
if model.imageResource:
return model.imageResource
else:
return fileToResource( os.path.join(Utils.getImageFolder(), 'SeriesMgr128.png') )

class Options(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
Expand Down
3 changes: 3 additions & 0 deletions SeriesMgr/SeriesModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ class SeriesModel:
KeyByName, KeyByUciId, KeyByLicense = list(range(3))
riderKey = KeyByName

imageResource = None # Display Logo (None uses default logo). In base64.

@property
def scoreByPoints( self ):
return not (self.scoreByTime or self.scoreByPercent or self.scoreByTrueSkill)
Expand All @@ -273,6 +275,7 @@ def __init__( self ):
self.numPlacesTieBreaker = 5
self.errors = []
self.changed = False
imageResource = None

def postReadFix( self ):
memoize.clear()
Expand Down
2 changes: 1 addition & 1 deletion SprintMgr/Model.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def __init__( self, name, systems ):
rrCount += 1
e.others[i] = '{}RR_{}_{}'.format(rrCount, iSystem+1, i+2) # Label is nnRR_ro_fo where nn=unique#, ro=round, fo=finishOrder

print( 'Event:', ' - '.join(e.composition), ' -> ', e.winner, e.others )
# print( 'Event:', ' - '.join(e.composition), ' -> ', e.winner, e.others )

for c in e.composition:
assert c not in inLabels, '{}-{} c={}, outLabels={}'.format(e.competition.name, e.system.name, c, ','.join( sorted(outLabels) ))
Expand Down
2 changes: 1 addition & 1 deletion Version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
AppVerName="CrossMgr 3.1.46-private"
AppVerName="CrossMgr 3.1.47-private"

0 comments on commit 2ba0301

Please sign in to comment.