countdown
This commit is contained in:
19
GUI.py
19
GUI.py
@@ -1,11 +1,20 @@
|
|||||||
from Rewrite import *
|
from Rewrite import *
|
||||||
|
import time
|
||||||
|
|
||||||
link = ""
|
link = ""
|
||||||
fetch_gonogo()
|
fetchGonogo()
|
||||||
fetch_major_concerns()
|
fetchMajorConcerns()
|
||||||
|
|
||||||
print(update_gonogo())
|
print(updateGonogo())
|
||||||
print(update_major_concerns())
|
print(updateMajorConcerns())
|
||||||
|
|
||||||
#T and L toggle
|
#T and L toggle
|
||||||
#Scrub
|
#Scrub
|
||||||
|
|
||||||
|
structTime = time.strptime("29 January 2026 20 21 0", "%d %B %Y %H %M %S")
|
||||||
|
getLaunchTime(structTime)
|
||||||
|
while True:
|
||||||
|
t1 = time.monotonic()
|
||||||
|
print(updateCountdown())
|
||||||
|
t2 = time.monotonic()
|
||||||
|
sleep(1.0 - (t2 - t1))
|
||||||
32
Rewrite.py
32
Rewrite.py
@@ -1,17 +1,18 @@
|
|||||||
import csv
|
import csv
|
||||||
import io
|
import io
|
||||||
import requests
|
import requests
|
||||||
|
from time import *
|
||||||
|
from calendar import timegm
|
||||||
|
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
|
|
||||||
def fetch_gonogo(Manual, GUIVariables, link):
|
def fetchGonogo(Manual = False, GUIVariables = ["N/A", "N/A", "N/A"], link = None):
|
||||||
# Make GoNoGo Global
|
|
||||||
global weather, Range, vehicle
|
global weather, Range, vehicle
|
||||||
# if GUI controlled
|
# if GUI controlled
|
||||||
if Manual:
|
if Manual:
|
||||||
try:
|
try:
|
||||||
# Get Range, Weather and vehicle from GUI
|
# Get Range, Weather and vehicle from GUI
|
||||||
Range = GUIVariables[0]
|
Range = GUIVariables[0]
|
||||||
weather = GUIVariables[1]
|
weather = GUIVariables[1]
|
||||||
vehicle = GUIVariables[2]
|
vehicle = GUIVariables[2]
|
||||||
return[Range, weather, vehicle]
|
return[Range, weather, vehicle]
|
||||||
@@ -25,8 +26,7 @@ def fetch_gonogo(Manual, GUIVariables, link):
|
|||||||
vehicle = pullSpreedsheet(16, 2, link)
|
vehicle = pullSpreedsheet(16, 2, link)
|
||||||
return[Range, weather, vehicle]
|
return[Range, weather, vehicle]
|
||||||
|
|
||||||
def fetch_major_concerns(Manual = False, GUIVariables = None, link = None):
|
def fetchMajorConcerns(Manual = True, GUIVariables = "N/A", link = None):
|
||||||
# Make concerns global
|
|
||||||
global concerns
|
global concerns
|
||||||
# if GUI controlled
|
# if GUI controlled
|
||||||
if Manual:
|
if Manual:
|
||||||
@@ -42,10 +42,10 @@ def fetch_major_concerns(Manual = False, GUIVariables = None, link = None):
|
|||||||
concerns = pullSpreedsheet(11, 4, link)
|
concerns = pullSpreedsheet(11, 4, link)
|
||||||
return concerns
|
return concerns
|
||||||
|
|
||||||
def update_gonogo():
|
def updateGonogo():
|
||||||
return[Range, weather, vehicle]
|
return[Range, weather, vehicle]
|
||||||
|
|
||||||
def update_major_concerns():
|
def updateMajorConcerns():
|
||||||
return concerns
|
return concerns
|
||||||
|
|
||||||
def pullSpreedsheet(inputCol, inputRow, link):
|
def pullSpreedsheet(inputCol, inputRow, link):
|
||||||
@@ -67,4 +67,20 @@ def pullSpreedsheet(inputCol, inputRow, link):
|
|||||||
return pulledcell[0]
|
return pulledcell[0]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[ERROR] Failed to fetch Go/No-Go from sheet: {e}")
|
print(f"[ERROR] Failed to fetch Go/No-Go from sheet: {e}")
|
||||||
return None
|
return "N/A"
|
||||||
|
|
||||||
|
def getLaunchTime(structTime):
|
||||||
|
global launchTime
|
||||||
|
launchTime = timegm(structTime)
|
||||||
|
|
||||||
|
def updateCountdown():
|
||||||
|
# are we counting up yet?
|
||||||
|
if time() > launchTime:
|
||||||
|
countUp = False
|
||||||
|
else: countUp = True
|
||||||
|
# return the secconds till or after launchTime
|
||||||
|
# possible overflow, may need to swap time() with monotonic()
|
||||||
|
if countUp:
|
||||||
|
return int(launchTime - time() + 1)
|
||||||
|
else:
|
||||||
|
return int(time() - launchTime)
|
||||||
Reference in New Issue
Block a user