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
+5 -2
View File
@@ -1195,12 +1195,15 @@ class wx_python_gui:
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',
'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: