Skip to content

Commit 6de9274

Browse files
ItsSimkoCopilot
andauthored
refactor(LoadingWindow): changed timer to use time.time() instead of a counter variable
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9ea592f commit 6de9274

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/FreeScribe.client/UI/LoadingWindow.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,13 @@ def destroy(self):
185185
"""
186186
# wait for the UI to be built
187187
def _destroy_ui():
188-
time_counter = 0
188+
start_time = time.time()
189189
logger.debug("Waiting for LoadingWindow UI to be built")
190190
while not self.ui_built:
191-
if time_counter % 2 == 0 or time_counter == 0:
192-
logger.info(f"LoadingWindow UI not built yet, waiting for it to be built... time_counter{time_counter} to self.ui_built: {self.ui_built}")
191+
elapsed_time = time.time() - start_time
192+
if int(elapsed_time) % 2 == 0 or elapsed_time < 1:
193+
logger.info(f"LoadingWindow UI not built yet, waiting for it to be built... elapsed_time: {elapsed_time:.1f} to self.ui_built: {self.ui_built}")
193194
time.sleep(0.1)
194-
time_counter += 0.09
195-
# roudn the time counter to the nearest tenth of a second
196-
time_counter = round(time_counter, 1)
197195

198196
logger.debug("LoadingWindow UI is built, proceeding to destroy it")
199197
if self.popup:

0 commit comments

Comments
 (0)