GUI: Reduce CPU usage II - have smoother UX with faster refresh rate

* Set thread_sleep_interval to 0.01s for better UI responsiveness
* Improve thread waiting with thread.join() where applicable (thanks to @sbytnar)
This commit is contained in:
Gonen
2025-04-05 11:20:39 +03:00
parent d41d19b3e1
commit 9ac02b0f6b
3 changed files with 4 additions and 6 deletions

View File

@@ -3,7 +3,6 @@ gui_macos_installer_flash.py: macOS Installer Flash Frame
"""
import wx
import time
import logging
import plistlib
import tempfile
@@ -317,7 +316,7 @@ class macOSInstallerFlashFrame(wx.Frame):
wx.CallAfter(progress_bar.SetValue, bytes_written)
wx.Yield()
time.sleep(self.constants.thread_sleep_interval)
thread.join(timeout=self.constants.thread_sleep_interval)
if self.result is False:
logging.error("Failed to flash installer, cannot continue.")

View File

@@ -273,7 +273,7 @@ def wait_for_thread(thread: threading.Thread, sleep_interval=None):
while thread.is_alive():
wx.Yield()
time.sleep(interval)
thread.join(timeout=interval)
class RestartHost: