diff --git a/Builds/Sunny V1.1.zip b/Builds/Sunny V1.1.zip new file mode 100644 index 0000000..4d7a982 Binary files /dev/null and b/Builds/Sunny V1.1.zip differ diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 009883f..846049c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -11,4 +11,9 @@ Sunny V1.0 - 05/07/2023 -- Initial release \ No newline at end of file +- Initial release + +Sunny V1.1 - 25/07/2023 + +- Variables are now read in through a Configuration.ini +- Customisable thresholds \ No newline at end of file diff --git a/Configuration.ini b/Configuration.ini new file mode 100644 index 0000000..5c7e8ba --- /dev/null +++ b/Configuration.ini @@ -0,0 +1,13 @@ +[GENERAL] +ControlConfigDirectory = \\0.0.0.0\ExecutorShare\Working\Tennis\TennisBallTrackControl\TennisBallTrackControl1\ControlConfig.json +CourtName = CHANGE ME + +[THRESHOLDS] +Thresh1 = 0.0 +Thresh2 = 0.1 +Thresh3 = 0.3 +Thresh4 = 0.6 +Thresh5 = 0.9 +Thresh6 = 1.0 + + diff --git a/Sunny V1.1.exe b/Sunny V1.1.exe new file mode 100644 index 0000000..8ec2d10 Binary files /dev/null and b/Sunny V1.1.exe differ diff --git a/Sunny.py b/Sunny.py index d8b1032..d5f89de 100644 --- a/Sunny.py +++ b/Sunny.py @@ -19,28 +19,46 @@ from datetime import datetime from tkinter import * +import configparser -folder_selected = filedialog.askopenfilename() -print(folder_selected) +#Configuration loading +config = configparser.ConfigParser() +config.read("Configuration.ini") -Court_name = simpledialog.askstring(title="Court Name",prompt="What Court is this?\t\t\t") +# Accessing variables from the 'GENERAL' section +folder_selected = str(config['GENERAL']['ControlConfigDirectory']) +Court_name = str(config['GENERAL']['CourtName']) -print(Court_name) -#Builder.load_file('update_label.kv') +if folder_selected == "\\\\0.0.0.0\\ExecutorShare\Working\Tennis\TennisBallTrackControl\TennisBallTrackControl1\ControlConfig.json": + print(chr(27) + "[2J") + print("##################################################") + print("You have not changed the default Configuration.ini") + print("Please change the IP") + print("##################################################") + input() + exit() +print("Control Config Directory: " + folder_selected) +print("Court Name: " + Court_name) + filePath = (folder_selected) -print(filePath) +# Accessing variables from the 'THRESHOLDS' section +Thresh1 = float(config['THRESHOLDS']['Thresh1']) +Thresh2 = float(config['THRESHOLDS']['Thresh2']) +Thresh3 = float(config['THRESHOLDS']['Thresh3']) +Thresh4 = float(config['THRESHOLDS']['Thresh4']) +Thresh5 = float(config['THRESHOLDS']['Thresh5']) +Thresh6 = float(config['THRESHOLDS']['Thresh6']) + + root = Tk() root.withdraw() - -#f = open(r"C:\Users\William\Documents\University\BeepDetails.log", "r") - Builder.load_string(""" : rgba: (1,.2,.2,.2) @@ -175,11 +193,9 @@ class MySec(BoxLayout): class MyApp(App): def build(self): - self.title = 'Sunny V1.0' + self.title = 'Sunny V1.1' - - #register_topmost(Window, 'Sunny V1.0') Clock.schedule_interval(lambda dt: self.update_time(), 5) return MySec() @@ -215,14 +231,14 @@ class MyApp(App): - if Average == 0.0: + if Average == Thresh1: XNeg = str(XNeg) XPos = str(XPos) self.root.Negative = XNeg self.root.Positive = XPos - self.root.rgba = [0/255, 10/255, 10/255, 1.0] + self.root.rgba = [0/255, 10/255, 10/255, 1.0] - elif Average <= 0.1: + elif Average <= Thresh2: XNeg = str(XNeg) XPos = str(XPos) self.root.Negative = XNeg @@ -231,7 +247,7 @@ class MyApp(App): - elif ((Average > 0.1) and (Average <= 0.3)): + elif ((Average > Thresh2) and (Average <= Thresh3)): XNeg = str(XNeg) XPos = str(XPos) self.root.Negative = XNeg @@ -240,7 +256,7 @@ class MyApp(App): - elif ((Average > 0.3) and (Average <= 0.6)): + elif ((Average > Thresh3) and (Average <= Thresh4)): XNeg = str(XNeg) XPos = str(XPos) self.root.Negative = XNeg @@ -249,7 +265,7 @@ class MyApp(App): - elif ((Average > 0.6) and (Average <= 0.9)): + elif ((Average > Thresh4) and (Average <= Thresh5)): XNeg = str(XNeg) XPos = str(XPos) self.root.Negative = XNeg @@ -259,7 +275,7 @@ class MyApp(App): - elif Average > 0.9: + elif Average >= Thresh6: XNeg = str(XNeg) XPos = str(XPos) self.root.Negative = XNeg