This commit is contained in:
William Henderson
2023-07-11 15:40:19 +01:00
parent 8e91fc2fe3
commit a529b1890a
15 changed files with 174 additions and 90 deletions
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
+7
View File
@@ -0,0 +1,7 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\beeptimes.py",
"PreviewInSolutionExplorer": false
}
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
[GENERAL]
BeepDetailsDirectory = \\0.0.0.0\RealTimeTennis\DataBridge1\Logs\BounceDetails_1.log
CourtName = CHANGE ME
[THRESHOLDS]
Thresh1 = 120
Thresh1str = Cheating?
Thresh2 = 150
Thresh2str = Looking good
Thresh3 = 250
Thresh3str = Little slow
Thresh4 = 350
Thresh4str = Noticeable slow
Thresh5 = 351
Thresh5str = Help!!!
+15
View File
@@ -0,0 +1,15 @@
[GENERAL]
BeepDetailsDirectory = \\192.168.0.133\RealTimeTennis\DataBridge1\Logs\BounceDetails_1.log
CourtName = CHANGE ME
[THRESHOLDS]
Thresh1 = 120
Thresh1str = Cheating?
Thresh2 = 150
Thresh2str = Looking good
Thresh3 = 250
Thresh3str = Little slow
Thresh4 = 350
Thresh4str = Noticeable slow
Thresh5 = 351
Thresh5str = Help!!!
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

+134 -90
View File
@@ -10,31 +10,60 @@ from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import StringProperty
from kivy.core.window import Window
from kivy.config import Config
from tkinter import filedialog
from tkinter import simpledialog
from KivyOnTop import register_topmost, unregister_topmost
import configparser
from tkinter import *
#Configuration loading
config = configparser.ConfigParser()
config.read('Configuration.ini')
# Accessing variables from the 'GENERAL' section
Court_name = str(config['GENERAL']['CourtName'])
filePath = str(config['GENERAL']['BeepDetailsDirectory'])
print(filePath)
if filePath == "\\\\0.0.0.0\\RealTimeTennis\\DataBridge1\\Logs\\BounceDetails_1.log":
print(chr(27) + "[2J")
print("##################################################")
print("You have not changed the default Configuration.ini")
print("Please change the IP")
print("##################################################")
input()
exit()
# Accessing variables from the 'THRESHOLDS' section
Thresh1 = int(config['THRESHOLDS']['Thresh1'])
Thresh2 = int(config['THRESHOLDS']['Thresh2'])
Thresh3 = int(config['THRESHOLDS']['Thresh3'])
Thresh4 = int(config['THRESHOLDS']['Thresh4'])
Thresh5 = int(config['THRESHOLDS']['Thresh5'])
Thresh1str = str(config['THRESHOLDS']['Thresh1str'])
Thresh2str = str(config['THRESHOLDS']['Thresh2str'])
Thresh3str = str(config['THRESHOLDS']['Thresh3str'])
Thresh4str = str(config['THRESHOLDS']['Thresh4str'])
Thresh5str = str(config['THRESHOLDS']['Thresh5str'])
root = Tk()
root.withdraw()
folder_selected = filedialog.askopenfilename()
print(folder_selected)
print("Court Name: " + Court_name)
Court_name = simpledialog.askstring(title="Court Name",prompt="What Court is this?")
print(Court_name)
#Builder.load_file('update_label.kv')
filePath = (folder_selected)
print(filePath)
print("BeepDetails Directory: "+ filePath)
@@ -121,6 +150,14 @@ class MySec(BoxLayout):
info = StringProperty('')
average = StringProperty('')
Court_name = StringProperty('')
Config.set('kivy','window_icon','./beeps.ico')
Config.set('graphics', 'always_on_top','1')
#Config.set('graphics','position', 'custom' )
Config.set('graphics','left',10)
Config.set('graphics','top',50)
Config.set('graphics','height',300)
Config.set('graphics','width',300)
Config.write()
#rgba = StringProperty('')
@@ -128,11 +165,11 @@ class MySec(BoxLayout):
class MyApp(App):
def build(self):
self.title = 'Beeper V2.1'
self.title = 'Beeper V2.3'
register_topmost(Window, 'Beeper V2.1')
Clock.schedule_interval(lambda dt: self.update_time(), 0.5)
return MySec()
@@ -142,120 +179,127 @@ class MyApp(App):
del list[9]
else:
self.root.Court_name = Court_name
with open(filePath,'r') as f:
lastLine = None
lines = f.readlines()
if lines[-1] != lastLine:
lastLine = lines[-1]
BC = lastLine.find("Bounce Count")
BC = lastLine[BC+14:BC+15]
BC = int(BC)
try:
with open(filePath,'r') as f:
lastLine = None
lines = f.readlines()
if lines[-1] != lastLine:
lastLine = lines[-1]
BC = lastLine.find("Bounce Count")
BC = lastLine[BC+14:BC+15]
BC = int(BC)
if BC == 0:
if BC == 0:
CN = lastLine.find("Crosses Net")
CN = lastLine[CN+13:CN+17]
CN = lastLine.find("Crosses Net")
CN = lastLine[CN+13:CN+17]
if CN == 'true':
if CN == 'true':
diff = lastLine.find("Time Diff")
diff = lastLine[diff+11:diff+19]
diff = float(diff)
diff = round((diff * 1000),1)
diff = lastLine.find("Time Diff")
diff = lastLine[diff+11:diff+19]
diff = float(diff)
diff = round((diff * 1000),1)
if diff <= 120:
diff1 = (str(diff)+'ms')
self.root.seconds_string = diff1
self.root.info = 'Cheating?'
if diff <= Thresh1:
diff1 = (str(diff)+'ms')
self.root.seconds_string = diff1
self.root.info = Thresh1str
if list[0] != diff:
list.insert(0,diff)
avg = str(round((sum(list)/10),1))
self.root.average = ('10 beep average:' + avg)
self.root.rgba = [218/255,165/255,32/255,1]
if list[0] != diff:
list.insert(0,diff)
avg = str(round((sum(list)/10),1))
self.root.average = ('10 beep average:' + avg)
self.root.rgba = [218/255,165/255,32/255,1]
else:
pass
else:
pass
elif ((diff > 120) and (diff <= 150)):
diff1 = (str(diff)+'ms')
self.root.seconds_string = diff1
self.root.info = 'Looking good'
elif ((diff > Thresh1) and (diff <= Thresh2)):
diff1 = (str(diff)+'ms')
self.root.seconds_string = diff1
self.root.info = Thresh2str
if list[0] != diff:
list.insert(0,diff)
avg = str(round((sum(list)/10),1))
if list[0] != diff:
list.insert(0,diff)
avg = str(round((sum(list)/10),1))
self.root.average = ('10 beep average:' + avg)
self.root.rgba = [19/255,229/255,19/255,1]
else:
pass
self.root.average = ('10 beep average:' + avg)
self.root.rgba = [19/255,229/255,19/255,1]
else:
pass
elif ((diff > 150) and (diff <= 250)):
diff1 = (str(diff)+'ms')
self.root.seconds_string = diff1
self.root.info = 'Little slow'
elif ((diff > Thresh2) and (diff <= Thresh3)):
diff1 = (str(diff)+'ms')
self.root.seconds_string = diff1
self.root.info = Thresh3str
if list[0] != diff:
list.insert(0,diff)
avg = str(round((sum(list)/10),1))
self.root.average = ('10 beep average:' + avg)
self.root.rgba = [235/255,116/255,19/255,1]
else:
pass
if list[0] != diff:
list.insert(0,diff)
avg = str(round((sum(list)/10),1))
self.root.average = ('10 beep average:' + avg)
self.root.rgba = [235/255,116/255,19/255,1]
else:
pass
elif ((diff > 250) and (diff <= 350)):
diff1 = (str(diff)+'ms')
self.root.seconds_string = diff1
self.root.info = 'Noticeable slow'
elif ((diff > Thresh3) and (diff <= Thresh4)):
diff1 = (str(diff)+'ms')
self.root.seconds_string = diff1
self.root.info = Thresh4str
if list[0] != diff:
list.insert(0,diff)
avg = str(round((sum(list)/10),1))
self.root.average = ('10 beep average:' + avg)
self.root.rgba = [219/255,0/255,0/255,1]
else:
pass
if list[0] != diff:
list.insert(0,diff)
avg = str(round((sum(list)/10),1))
self.root.average = ('10 beep average:' + avg)
self.root.rgba = [219/255,0/255,0/255,1]
else:
pass
elif diff > 351:
diff1 = (str(diff)+'ms')
self.root.seconds_string = diff1
self.root.info = 'Help!!!'
elif diff > Thresh5:
diff1 = (str(diff)+'ms')
self.root.seconds_string = diff1
self.root.info = Thresh5str
if list[0] != diff:
list.insert(0,diff)
avg = str(round((sum(list)/10),1))
self.root.average = ('10 beep average:' + avg)
self.root.rgba = [90/255,4/255,4/255,1]
else:
pass
if list[0] != diff:
list.insert(0,diff)
avg = str(round((sum(list)/10),1))
self.root.average = ('10 beep average:' + avg)
self.root.rgba = [90/255,4/255,4/255,1]
else:
pass
else:
pass
else:
pass
else:
pass
except:
print(chr(27) + "[2J")
print("#################################################################################")
print(filePath + "Is not reachable, please check its accessible through file explorer")
input()
exit()