implemented the timer into the gui (controls still needed)

This commit is contained in:
Brightbites
2026-02-26 14:17:41 +00:00
parent 45d4786e26
commit 507b36250f
2 changed files with 24 additions and 20 deletions

35
GUI.py
View File

@@ -22,7 +22,7 @@ def toggleDate():
dpg.configure_item("yearTooltip", show=True) dpg.configure_item("yearTooltip", show=True)
dpg.create_context() dpg.create_context()
dpg.create_viewport(title='RocketLaunchCountdown', min_width=600, min_height=400, width=600, height=400) dpg.create_viewport(title='RocketLaunchCountdown', min_width=900, min_height=300, width=900, height=400)
with dpg.font_registry(): with dpg.font_registry():
# first argument ids the path to the .ttf or .otf file # first argument ids the path to the .ttf or .otf file
@@ -77,6 +77,8 @@ dpg.set_primary_window("Primary Window", True)
currentViewportSize = 0 currentViewportSize = 0
seccondPassed = 0 seccondPassed = 0
dateInputVisable = True dateInputVisable = True
onHold = False
Ltoggle = False
while dpg.is_dearpygui_running(): # on every frame while dpg.is_dearpygui_running(): # on every frame
@@ -95,17 +97,26 @@ while dpg.is_dearpygui_running(): # on every frame
dpg.configure_item("Seconds", width=int((currentViewportSize / 4) - 10)) dpg.configure_item("Seconds", width=int((currentViewportSize / 4) - 10))
dpg.configure_item("toggleDate",width=int((currentViewportSize / 4) - 10)) dpg.configure_item("toggleDate",width=int((currentViewportSize / 4) - 10))
#if seccondPassed == abs(time.monotonic()): # has a seccond passed since last run if seccondPassed == int(time.monotonic()): # has a seccond passed since last run
# seccondPassed = abs(time.monotonic() + 1) seccondPassed = int(time.monotonic() + 1)
# if not onHold: if not onHold:
# countTime = backend.countTime(countTime) launchTime = launchTime - 1
# displayTime = abs(countTime) if launchTime <= 0: # are we counting up?
# holdTime = 0 if Ltoggle:
# else: countUp = "L+"
# holdTime = backend.holdTime(holdTime) else: countUp = "T+"
# displayTime = abs(countTime) else:
if Ltoggle:
#update button to display time countUp = "L-"
else: countUp = "T-"
absTime = abs(launchTime)
displayTime = time.gmtime(absTime)
dpg.configure_item("text item", label=f"{countUp} {displayTime.tm_hour}:{displayTime.tm_min}:{displayTime.tm_sec}")
else:
holdTime = holdTime + 1
absTime = abs(holdTime)
displayTime = time.gmtime(absTime)
dpg.configure_item("text item", label=f"H+ {displayTime.tm_hour}:{displayTime.tm_min}:{displayTime.tm_sec}")
dpg.render_dearpygui_frame() dpg.render_dearpygui_frame()

View File

@@ -62,13 +62,6 @@ 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 countTime(timeNow):
pass
def holdTime(timeNow):
pass
def convertEpoch(inputTime, isDate): def convertEpoch(inputTime, isDate):
inputTime = timegm(inputTime) inputTime = timegm(inputTime)
if isDate: if isDate: