diff --git a/.vs/Beeps/FileContentIndex/64ca765c-fc48-47bc-bf1d-2797c72c8c81.vsidx b/.vs/Beeps/FileContentIndex/64ca765c-fc48-47bc-bf1d-2797c72c8c81.vsidx new file mode 100644 index 0000000..f6502ed Binary files /dev/null and b/.vs/Beeps/FileContentIndex/64ca765c-fc48-47bc-bf1d-2797c72c8c81.vsidx differ diff --git a/.vs/Beeps/FileContentIndex/d2c2ba6f-3637-4137-8270-d5a92b3ece01.vsidx b/.vs/Beeps/FileContentIndex/d2c2ba6f-3637-4137-8270-d5a92b3ece01.vsidx new file mode 100644 index 0000000..fafd197 Binary files /dev/null and b/.vs/Beeps/FileContentIndex/d2c2ba6f-3637-4137-8270-d5a92b3ece01.vsidx differ diff --git a/.vs/Beeps/FileContentIndex/d68d27a1-8cc5-4b02-91ca-0f22f7065fab.vsidx b/.vs/Beeps/FileContentIndex/d68d27a1-8cc5-4b02-91ca-0f22f7065fab.vsidx new file mode 100644 index 0000000..9d13705 Binary files /dev/null and b/.vs/Beeps/FileContentIndex/d68d27a1-8cc5-4b02-91ca-0f22f7065fab.vsidx differ diff --git a/.vs/Beeps/FileContentIndex/fb84a6ae-4ad9-4462-827b-1eda8da2a2de.vsidx b/.vs/Beeps/FileContentIndex/fb84a6ae-4ad9-4462-827b-1eda8da2a2de.vsidx new file mode 100644 index 0000000..e5ed5e9 Binary files /dev/null and b/.vs/Beeps/FileContentIndex/fb84a6ae-4ad9-4462-827b-1eda8da2a2de.vsidx differ diff --git a/.vs/Beeps/FileContentIndex/read.lock b/.vs/Beeps/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/.vs/Beeps/v17/.wsuo b/.vs/Beeps/v17/.wsuo new file mode 100644 index 0000000..c1c7b40 Binary files /dev/null and b/.vs/Beeps/v17/.wsuo differ diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 0000000..f8b4888 --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": null +} \ No newline at end of file diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..133e90f --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,7 @@ +{ + "ExpandedNodes": [ + "" + ], + "SelectedNode": "\\beeptimes.py", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..d72c5a5 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/Builds/Beeps V2.2.exe b/Builds/Beeps V2.2.exe new file mode 100644 index 0000000..467cd31 Binary files /dev/null and b/Builds/Beeps V2.2.exe differ diff --git a/Builds/Beeps V2.3.exe b/Builds/Beeps V2.3.exe new file mode 100644 index 0000000..90e976d Binary files /dev/null and b/Builds/Beeps V2.3.exe differ diff --git a/Builds/Configuration.ini b/Builds/Configuration.ini new file mode 100644 index 0000000..1bcd07f --- /dev/null +++ b/Builds/Configuration.ini @@ -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!!! \ No newline at end of file diff --git a/Configuration.ini b/Configuration.ini new file mode 100644 index 0000000..db0c54d --- /dev/null +++ b/Configuration.ini @@ -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!!! \ No newline at end of file diff --git a/beeps.ico b/beeps.ico new file mode 100644 index 0000000..7ce0854 Binary files /dev/null and b/beeps.ico differ diff --git a/beeptimes.py b/beeptimes.py index 1a05f48..fdc88ad 100644 --- a/beeptimes.py +++ b/beeptimes.py @@ -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,121 +179,128 @@ 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 + except: + print(chr(27) + "[2J") + print("#################################################################################") + print(filePath + "Is not reachable, please check its accessible through file explorer") + input() + exit() - else: - pass -