From f78bef58c59007cbd67b300af3d0ac5178fd69e6 Mon Sep 17 00:00:00 2001 From: Brightbites <45047787+Brightbites@users.noreply.github.com> Date: Sun, 1 Feb 2026 23:01:24 +0000 Subject: [PATCH] Implimented Timer and started GUI --- GUI.py | 27 +++++++++++++-------------- Rewrite.py | 50 +++++++++++++++++++++++++++----------------------- TinkerTest.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 37 deletions(-) create mode 100644 TinkerTest.py diff --git a/GUI.py b/GUI.py index 30245e8..ca0023a 100644 --- a/GUI.py +++ b/GUI.py @@ -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)) \ No newline at end of file +# Time Tell launch +# input in + +# Date Time +#current time - epoch \ No newline at end of file diff --git a/Rewrite.py b/Rewrite.py index 1b203aa..2d0ac14 100644 --- a/Rewrite.py +++ b/Rewrite.py @@ -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) \ No newline at end of file + +def convertEpoch(inputTime, isDate): + inputTime = timegm(inputTime) + if isDate: + inputTime - time() + return int(inputTime) \ No newline at end of file diff --git a/TinkerTest.py b/TinkerTest.py new file mode 100644 index 0000000..fc5abb3 --- /dev/null +++ b/TinkerTest.py @@ -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()