Implimented Timer and started GUI
This commit is contained in:
27
GUI.py
27
GUI.py
@@ -1,20 +1,19 @@
|
|||||||
from Rewrite import *
|
from Rewrite import *
|
||||||
import time
|
import time
|
||||||
|
|
||||||
link = ""
|
print(fetchGonogo())
|
||||||
fetchGonogo()
|
print(fetchMajorConcerns())
|
||||||
fetchMajorConcerns()
|
|
||||||
|
|
||||||
print(updateGonogo())
|
structTime = time.strptime("1 1 1970 0 0 10", "%d %m %Y %H %M %S")
|
||||||
print(updateMajorConcerns())
|
isDate = False
|
||||||
|
inputTime = convertEpoch(structTime, isDate)
|
||||||
|
|
||||||
#T and L toggle
|
onHold = False
|
||||||
#Scrub
|
for returned in countdownTime(inputTime, onHold):
|
||||||
|
print(returned)
|
||||||
|
|
||||||
structTime = time.strptime("29 January 2026 20 21 0", "%d %B %Y %H %M %S")
|
# Time Tell launch
|
||||||
getLaunchTime(structTime)
|
# input in
|
||||||
while True:
|
|
||||||
t1 = time.monotonic()
|
# Date Time
|
||||||
print(updateCountdown())
|
#current time - epoch
|
||||||
t2 = time.monotonic()
|
|
||||||
sleep(1.0 - (t2 - t1))
|
|
||||||
50
Rewrite.py
50
Rewrite.py
@@ -26,14 +26,13 @@ def fetchGonogo(Manual = False, GUIVariables = ["N/A", "N/A", "N/A"], link = Non
|
|||||||
vehicle = pullSpreedsheet(16, 2, link)
|
vehicle = pullSpreedsheet(16, 2, link)
|
||||||
return[Range, weather, vehicle]
|
return[Range, weather, vehicle]
|
||||||
|
|
||||||
def fetchMajorConcerns(Manual = True, GUIVariables = "N/A", link = None):
|
def fetchMajorConcerns(Manual = False, GUIVariables = "N/A", link = None):
|
||||||
global concerns
|
|
||||||
# if GUI controlled
|
# if GUI controlled
|
||||||
if Manual:
|
if Manual:
|
||||||
# Get Major Concerns from GUI
|
# Get Major Concerns from GUI
|
||||||
try:
|
try:
|
||||||
concerns = GUIVariables
|
concerns = GUIVariables
|
||||||
return[concerns]
|
return concerns
|
||||||
except:
|
except:
|
||||||
print("YOU IDIOT, YOU DIDNT DECLARE THE VARIABLES")
|
print("YOU IDIOT, YOU DIDNT DECLARE THE VARIABLES")
|
||||||
return[None]
|
return[None]
|
||||||
@@ -42,12 +41,6 @@ def fetchMajorConcerns(Manual = True, GUIVariables = "N/A", link = None):
|
|||||||
concerns = pullSpreedsheet(11, 4, link)
|
concerns = pullSpreedsheet(11, 4, link)
|
||||||
return concerns
|
return concerns
|
||||||
|
|
||||||
def updateGonogo():
|
|
||||||
return[Range, weather, vehicle]
|
|
||||||
|
|
||||||
def updateMajorConcerns():
|
|
||||||
return concerns
|
|
||||||
|
|
||||||
def pullSpreedsheet(inputCol, inputRow, link):
|
def pullSpreedsheet(inputCol, inputRow, link):
|
||||||
col = int(inputCol) - 1
|
col = int(inputCol) - 1
|
||||||
rows = [
|
rows = [
|
||||||
@@ -69,18 +62,29 @@ def pullSpreedsheet(inputCol, inputRow, link):
|
|||||||
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 "N/A"
|
return "N/A"
|
||||||
|
|
||||||
def getLaunchTime(structTime):
|
def countdownTime(countTime, onHold):
|
||||||
global launchTime
|
TimeNow = countTime
|
||||||
launchTime = timegm(structTime)
|
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?
|
def convertEpoch(inputTime, isDate):
|
||||||
if time() > launchTime:
|
inputTime = timegm(inputTime)
|
||||||
countUp = False
|
if isDate:
|
||||||
else: countUp = True
|
inputTime - time()
|
||||||
# return the secconds till or after launchTime
|
return int(inputTime)
|
||||||
# possible overflow, may need to swap time() with monotonic()
|
|
||||||
if countUp:
|
|
||||||
return int(launchTime - time() + 1)
|
|
||||||
else:
|
|
||||||
return int(time() - launchTime)
|
|
||||||
28
TinkerTest.py
Normal file
28
TinkerTest.py
Normal 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()
|
||||||
Reference in New Issue
Block a user