From e1f4840ce7c65809fd620a6a6b2cc0b0c82ed3de Mon Sep 17 00:00:00 2001 From: Brightbites <45047787+Brightbites@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:57:05 +0000 Subject: [PATCH] GoNoGo and Major Concerns reimplemented --- GUI.py | 11 +++++++++ Rewrite.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ config.py | 31 ++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 GUI.py create mode 100644 Rewrite.py create mode 100644 config.py diff --git a/GUI.py b/GUI.py new file mode 100644 index 0000000..90d180d --- /dev/null +++ b/GUI.py @@ -0,0 +1,11 @@ +from Rewrite import * + +link = "" +fetch_gonogo() +fetch_major_concerns() + +print(update_gonogo()) +print(update_major_concerns()) + +#T and L toggle +#Scrub \ No newline at end of file diff --git a/Rewrite.py b/Rewrite.py new file mode 100644 index 0000000..09c37aa --- /dev/null +++ b/Rewrite.py @@ -0,0 +1,70 @@ +import csv +import io +import requests + +session = requests.Session() + +def fetch_gonogo(Manual, GUIVariables, link): + # Make GoNoGo Global + global weather, Range, vehicle + # if GUI controlled + if Manual: + try: + # Get Range, Weather and vehicle from GUI + Range = GUIVariables[0] + weather = GUIVariables[1] + vehicle = GUIVariables[2] + return[Range, weather, vehicle] + except: + print("YOU IDIOT, YOU DIDNT DECLARE THE VARIABLES") + return[None, None, None] + else: + # Get Range, Weather and vehicle from spreadsheet + Range = pullSpreedsheet(12, 2, link) + weather = pullSpreedsheet(14, 2, link) + vehicle = pullSpreedsheet(16, 2, link) + return[Range, weather, vehicle] + +def fetch_major_concerns(Manual = False, GUIVariables = None, link = None): + # Make concerns global + global concerns + # if GUI controlled + if Manual: + # Get Major Concerns from GUI + try: + concerns = GUIVariables + return[concerns] + except: + print("YOU IDIOT, YOU DIDNT DECLARE THE VARIABLES") + return[None] + else: + # Get Major Concerns from spreadsheet + concerns = pullSpreedsheet(11, 4, link) + return concerns + +def update_gonogo(): + return[Range, weather, vehicle] + +def update_major_concerns(): + return concerns + +def pullSpreedsheet(inputCol, inputRow, link): + col = int(inputCol) - 1 + rows = [ + int(inputRow) - 1, + ] + try: + resp = session.get(link, timeout=3) + resp.raise_for_status() + reader = csv.reader(io.StringIO(resp.text)) + data = list(reader) + pulledcell = [] + for r in rows: + val = "N/A" + if 0 <= r < len(data) and len(data[r]) > col: + val = data[r][col] + pulledcell.append(val.strip().upper()) + return pulledcell[0] + except Exception as e: + print(f"[ERROR] Failed to fetch Go/No-Go from sheet: {e}") + return None \ No newline at end of file diff --git a/config.py b/config.py new file mode 100644 index 0000000..bd1fc12 --- /dev/null +++ b/config.py @@ -0,0 +1,31 @@ +import tomllib + +toml_str = """ +[Appearance] +Background_Color = "#484D66" +Text_Color = "#FFFFFF" +Font = "Consolas" +Mission_Font_Size = 24 +Timer_Font_Size = 80 + +[Go_No-Go_Appearance] +Background_Color = "#111111" +Border_Color = "#FFFFFF" +Go_Color = "#00FF00" +No-Go_Color = "#FF0000" +Caution_Color = "#FFA500" +Font_Size = 20 + +[Other] +Mode = "Spreadsheet" +# Sheet_Link = "" +Range_Row = 2 +Weather_Row = 3 +Vehicle_Row = 4 +Major_Concerns_Row = 9 +Column = 12 +Hide_Mission_Name = true +Timezone = "System" # timezone used, example: UTC, Europe/Paris +""" + +data = tomllib.loads(toml_str) \ No newline at end of file