Skip to content

Commit 4a28528

Browse files
committed
minor improvements
1 parent f83d594 commit 4a28528

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Scripts/TCT.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def frame(num):
404404

405405
# Global window events
406406

407-
if event in [sg.WIN_CLOSED, tr.gui_exit[lang]]:
407+
if event == sg.WIN_CLOSED or event == tr.gui_exit[lang]:
408408
break
409409

410410
elif event in tr.lang_list[lang]:
@@ -881,7 +881,10 @@ def frame(num):
881881
T2_temp_time = time.monotonic_ns()
882882
T2_counter += 1
883883
if T2_counter % 2048 == 0:
884-
sg.Print(f'{time.strftime("%H:%M:%S")} {round(T2_counter/T2_px_num * 100)}%, {round(T2_counter/(time.monotonic()-T2_time))} px/sec')
884+
try:
885+
sg.Print(f'{time.strftime("%H:%M:%S")} {round(T2_counter/T2_px_num * 100)}%, {round(T2_counter/(time.monotonic()-T2_time))} px/sec')
886+
except ZeroDivisionError:
887+
sg.Print(f'{time.strftime("%H:%M:%S")} {round(T2_counter/T2_px_num * 100)}% (ZeroDivisionError)')
885888
T2_progress_bar_time += time.monotonic_ns() - T2_temp_time
886889

887890
T2_end_time = time.monotonic()
@@ -899,7 +902,7 @@ def frame(num):
899902
if event == "T2_preview":
900903
window["T2_image"].update(data=convert_to_bytes(T2_img))
901904
else:
902-
T2_img.save(f'{values["T2_folder"]}/TCT-result_{time.strftime("%Y-%m-%d_%H-%M")}.png')
905+
T2_img.save(f'{values["T2_folder"]}/TCT_{time.strftime("%Y-%m-%d_%H-%M")}.png')
903906

904907
#except Exception as e:
905908
# print(e)
@@ -1115,5 +1118,4 @@ def frame(num):
11151118
window["T4_rgb"].update(T4_rgb)
11161119
window["T4_hex"].update(T4_rgb_show)
11171120

1118-
1119-
window.Close()
1121+
window.close()

0 commit comments

Comments
 (0)