gui_main.py: add error handling for unaccelerated AppleScript

This commit is contained in:
Mykola Grymalyuk
2022-05-30 21:38:51 -06:00
parent 1888ef7b89
commit 22369cd1a8

View File

@@ -1194,13 +1194,16 @@ class wx_python_gui:
if answer == wx.ID_YES:
output =subprocess.run(
[
"osascript", "-e",
'tell app "System Preferences" to reveal anchor "General" of pane id "com.apple.preference.security"',
"-e", 'tell app "System Preferences" to activate',
"osascript", "-e",
'tell app "System Preferences" to activate',
"-e", 'tell app "System Preferences" to reveal anchor "General" of pane id "com.apple.preference.security"',
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
if output.returncode != 0:
# Some form of fallback if unaccelerated state errors out
subprocess.run(["open", "-a", "System Preferences"])
time.sleep(5)
self.OnCloseFrame(None)
else: