GUI: Unify Yield() calls

This commit is contained in:
Mykola Grymalyuk
2023-05-18 16:06:33 -06:00
parent 300726ea96
commit 11bc64f8e6
7 changed files with 12 additions and 13 deletions

View File

@@ -79,7 +79,7 @@ class DownloadFrame(wx.Frame):
)
progress_bar.SetValue(int(self.download_obj.get_percent()))
wx.GetApp().Yield()
wx.Yield()
if self.download_obj.download_complete is False and self.user_cancelled is False:
wx.MessageBox(f"Download failed: \n{self.download_obj.error_msg}", "Error", wx.OK | wx.ICON_ERROR)

View File

@@ -83,7 +83,7 @@ class EntryPoint:
logging.info("- Cleaning up wxPython GUI")
self.frame.SetTransparent(0)
wx.GetApp().Yield()
wx.Yield()
self.frame.DestroyChildren()
self.frame.Destroy()

View File

@@ -263,7 +263,7 @@ class InstallOCFrame(wx.Frame):
thread.start()
while thread.is_alive():
wx.GetApp().Yield()
wx.Yield()
if self.result is True:
if self.constants.update_stage != gui_support.AutoUpdateStages.INACTIVE:

View File

@@ -1,7 +1,6 @@
# Generate GUI for main menu
import wx
import sys
import time
import logging
import threading

View File

@@ -9,7 +9,7 @@ import applescript
from pathlib import Path
from resources import constants
from data import model_array, os_data, cpu_data, smbios_data
from data import model_array, os_data, smbios_data
class AutoUpdateStages:
@@ -194,7 +194,7 @@ class RestartHost:
if answer == wx.ID_YES:
# Reboots with Count Down prompt (user can still dismiss if needed)
self.frame.Hide()
wx.GetApp().Yield()
wx.Yield()
try:
applescript.AppleScript('tell app "loginwindow" to «event aevtrrst»').run()
except applescript.ScriptError as e:
@@ -270,13 +270,13 @@ class RelaunchApplicationAsRoot:
# Set size of frame
self.frame.SetSize((-1, countdown_label.GetPosition().y + countdown_label.GetSize().height + 40))
wx.GetApp().Yield()
wx.Yield()
logging.info(f"- Relaunching as root with command: {program_arguments}")
subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while True:
wx.GetApp().Yield()
wx.Yield()
countdown_label.SetLabel(f"Closing old process in {timer} seconds")
time.sleep(1)
timer -= 1

View File

@@ -87,7 +87,7 @@ class SysPatchFrame(wx.Frame):
kdk_thread.start()
while kdk_thread.is_alive():
wx.GetApp().Yield()
wx.Yield()
if self.kdk_obj.success is False:
progress_bar_animation.stop_pulse()
@@ -115,7 +115,7 @@ class SysPatchFrame(wx.Frame):
subheader.SetLabel("Checking if checksum is valid...")
subheader.Center(wx.HORIZONTAL)
wx.GetApp().Yield()
wx.Yield()
progress_bar_animation.stop_pulse()
@@ -372,7 +372,7 @@ class SysPatchFrame(wx.Frame):
thread.start()
while thread.is_alive():
wx.GetApp().Yield()
wx.Yield()
self._post_patch()
self.return_button.Enable()
@@ -397,7 +397,7 @@ class SysPatchFrame(wx.Frame):
thread.start()
while thread.is_alive():
wx.GetApp().Yield()
wx.Yield()
self._post_patch()
self.return_button.Enable()

View File

@@ -147,7 +147,7 @@ class UpdateFrame(wx.Frame):
while True:
launch_label.SetLabel(f"Closing old process in {timer} seconds")
launch_label.Center(wx.HORIZONTAL)
wx.GetApp().Yield()
wx.Yield()
time.sleep(1)
timer -= 1
if timer == 0: