@@ -88,8 +88,7 @@ def fetch_installers():
8888 thread = threading .Thread (target = fetch_installers )
8989 thread .start ()
9090
91- while thread .is_alive ():
92- wx .Yield ()
91+ gui_support .wait_for_thread (thread )
9392
9493 frame_modal = wx .Dialog (self , title = self .title , size = (350 , 200 ))
9594
@@ -180,8 +179,7 @@ def _fetch_disks():
180179 thread = threading .Thread (target = _fetch_disks )
181180 thread .start ()
182181
183- while thread .is_alive ():
184- wx .Yield ()
182+ gui_support .wait_for_thread (thread )
185183
186184 self .frame_modal = wx .Dialog (self , title = self .title , size = (350 , 200 ))
187185
@@ -317,7 +315,9 @@ def _flash():
317315 except :
318316 bytes_written = 0
319317 wx .CallAfter (progress_bar .SetValue , bytes_written )
318+
320319 wx .Yield ()
320+ time .sleep (self .constants .thread_sleep_interval )
321321
322322 if self .result is False :
323323 logging .error ("Failed to flash installer, cannot continue." )
@@ -370,8 +370,7 @@ def prepare_script(self, installer_path: str, disk: str, constants: constants.Co
370370 thread = threading .Thread (target = prepare_script , args = (self , installer_path , disk , self .constants ))
371371 thread .start ()
372372
373- while thread .is_alive ():
374- wx .Yield ()
373+ gui_support .wait_for_thread (thread )
375374
376375 return self .prepare_result
377376
@@ -399,10 +398,11 @@ def _flash_installer(self, disk) -> bool:
399398 return False
400399
401400 logging .info ("Successfully created macOS installer" )
402- while thread .is_alive ():
403- # wait for download_thread to finish
404- # though highly unlikely this thread is still alive (flashing an Installer will take a while)
405- time .sleep (0.1 )
401+
402+ # wait for download_thread to finish
403+ # though highly unlikely this thread is still alive (flashing an Installer will take a while)
404+ gui_support .wait_for_thread (thread )
405+
406406 logging .info ("Installing Root Patcher to drive" )
407407 self ._install_installer_pkg (disk )
408408
@@ -617,8 +617,7 @@ def _integrity_check():
617617
618618 thread = threading .Thread (target = _integrity_check )
619619 thread .start ()
620- while thread .is_alive ():
621- wx .Yield ()
620+ gui_support .wait_for_thread (thread )
622621
623622 if error_message == "" :
624623 logging .info ("Installer pkg validated" )
0 commit comments