mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-25 12:30:15 +10:00
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:
@@ -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.")
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user