GoNoGo and Major Concerns reimplemented
This commit is contained in:
11
GUI.py
Normal file
11
GUI.py
Normal file
@@ -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
|
||||
70
Rewrite.py
Normal file
70
Rewrite.py
Normal file
@@ -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
|
||||
31
config.py
Normal file
31
config.py
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user