Skip to content

Commit

Permalink
update GUI with time estimates
Browse files Browse the repository at this point in the history
  • Loading branch information
james-s-w-clark committed Feb 13, 2022
1 parent 8324983 commit df8d976
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import time
from datetime import datetime, timedelta

QUEUE_TIME_LABEL = 'Queue time remaining:'
ETA_LABEL = 'Queue finished ETA:'


def calculate_queue_seconds(t1, t2):
update_time_seconds = 15
Expand All @@ -17,8 +20,8 @@ def calculate_queue_seconds(t1, t2):
[sg.Text('What is the queue count now? (e.g. 5762)'), sg.InputText()],
[sg.Text('What is the next queue count? (e.g. 5734'), sg.InputText()],
[sg.Button('Calculate'), sg.Button('Exit')],
[sg.Text('Remaining queue time:')],
[sg.Text('Queue finished ETA:')]]
[sg.Text('Remaining queue time:', key=QUEUE_TIME_LABEL)],
[sg.Text('Queue finished ETA:', key=ETA_LABEL)]]

# Create the Window
window = sg.Window('Lost Ark Queue Time Calculator', layout)
Expand All @@ -33,12 +36,12 @@ def calculate_queue_seconds(t1, t2):
queue_seconds = calculate_queue_seconds(t1, t2)

formatted_time_remaining = time.strftime('%H:%M:%S', time.gmtime(queue_seconds))
print(formatted_time_remaining)
window[QUEUE_TIME_LABEL].update(QUEUE_TIME_LABEL + ' ' + formatted_time_remaining)

now = datetime.now()
finish_time = now + timedelta(0, queue_seconds)
formatted_finish_time = finish_time.strftime('%H:%M:%S')
print(formatted_finish_time)
window[ETA_LABEL].update(ETA_LABEL + ' ' + formatted_finish_time)

window.close()

0 comments on commit df8d976

Please sign in to comment.