Implimented Timer and started GUI

This commit is contained in:
Brightbites
2026-02-01 23:01:24 +00:00
parent 7e5b5a8ab2
commit f78bef58c5
3 changed files with 68 additions and 37 deletions

27
GUI.py
View File

@@ -1,20 +1,19 @@
from Rewrite import *
import time
link = ""
fetchGonogo()
fetchMajorConcerns()
print(fetchGonogo())
print(fetchMajorConcerns())
print(updateGonogo())
print(updateMajorConcerns())
structTime = time.strptime("1 1 1970 0 0 10", "%d %m %Y %H %M %S")
isDate = False
inputTime = convertEpoch(structTime, isDate)
#T and L toggle
#Scrub
onHold = False
for returned in countdownTime(inputTime, onHold):
print(returned)
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))
# Time Tell launch
# input in
# Date Time
#current time - epoch

View File

@@ -26,14 +26,13 @@ def fetchGonogo(Manual = False, GUIVariables = ["N/A", "N/A", "N/A"], link = Non
vehicle = pullSpreedsheet(16, 2, link)
return[Range, weather, vehicle]
def fetchMajorConcerns(Manual = True, GUIVariables = "N/A", link = None):
global concerns
def fetchMajorConcerns(Manual = False, GUIVariables = "N/A", link = None):
# if GUI controlled
if Manual:
# Get Major Concerns from GUI
try:
concerns = GUIVariables
return[concerns]
return concerns
except:
print("YOU IDIOT, YOU DIDNT DECLARE THE VARIABLES")
return[None]
@@ -42,12 +41,6 @@ def fetchMajorConcerns(Manual = True, GUIVariables = "N/A", link = None):
concerns = pullSpreedsheet(11, 4, link)
return concerns
def updateGonogo():
return[Range, weather, vehicle]
def updateMajorConcerns():
return concerns
def pullSpreedsheet(inputCol, inputRow, link):
col = int(inputCol) - 1
rows = [
@@ -69,18 +62,29 @@ def pullSpreedsheet(inputCol, inputRow, link):
print(f"[ERROR] Failed to fetch Go/No-Go from sheet: {e}")
return "N/A"
def getLaunchTime(structTime):
global launchTime
launchTime = timegm(structTime)
def countdownTime(countTime, onHold):
TimeNow = countTime
while True:
while onHold == False:
t1 = monotonic()
TimeNow = TimeNow - 1
if TimeNow <= 0: # are we counting up?
countUp = True
else: countUp = False
yield(abs(TimeNow), countUp)
t2 = monotonic()
sleep(1.0 - (t2 - t1)) # sleep till next seccond
HoldTime = 0
while onHold:
t1 = monotonic()
HoldTime = HoldTime + 1
yield(HoldTime, True)
t2 = monotonic()
sleep(1.0 - (t2 - t1)) # sleep till next seccond
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)
def convertEpoch(inputTime, isDate):
inputTime = timegm(inputTime)
if isDate:
inputTime - time()
return int(inputTime)

28
TinkerTest.py Normal file
View File

@@ -0,0 +1,28 @@
import tkinter as tk
root = tk.Tk()
root.title("RocketLaunchCountdown")
root.configure(bg="Black")
tk.Grid.rowconfigure(root,0,weight=1)
tk.Grid.columnconfigure(root,0,weight=1)
tk.Grid.rowconfigure(root,2,weight=1)
label = tk.Label(root, text="hewwo")
label.grid(row=0,column=0, columnspan=7, sticky="nsew")
var1 = tk.IntVar()
tk.Checkbutton(root, text="TimeTill", variable=var1, fg="White", bg="Black").grid(row=1,column=6, padx=5, sticky="nsew")
tk.Text(root, height = 1, width = 4, bg = "White").grid(row=1,column=0, padx=5, sticky="nsew")
tk.Text(root, height = 1, width = 4, bg = "White").grid(row=1,column=1, padx=5, sticky="nsew")
tk.Text(root, height = 1, width = 4, bg = "White").grid(row=1,column=2, padx=5, sticky="nsew")
tk.Text(root, height = 1, width = 4, bg = "White").grid(row=1,column=3, padx=5, sticky="nsew")
tk.Text(root, height = 1, width = 4, bg = "White").grid(row=1,column=4, padx=5, sticky="nsew")
tk.Text(root, height = 1, width = 4, bg = "White").grid(row=1,column=5, padx=5, sticky="nsew")
button = tk.Button(root, text="Exit", width=20, command=root.destroy)
button.grid(row=2,column=0, columnspan=7, sticky="nsew")
root.mainloop()