mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
On OSX the finder will return from an open() event before the application
has actually entered its event loop. As a stopgap, allow for a 10 second grace period.
This commit is contained in:
parent
d4885f87fa
commit
d6ab153e5a
1 changed files with 12 additions and 0 deletions
|
@ -26,12 +26,16 @@ from Carbon import AE
|
||||||
from Carbon import AppleEvents
|
from Carbon import AppleEvents
|
||||||
import MacOS
|
import MacOS
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
from aetypes import *
|
from aetypes import *
|
||||||
from aepack import packkey, pack, unpack, coerce, AEDescType
|
from aepack import packkey, pack, unpack, coerce, AEDescType
|
||||||
|
|
||||||
Error = 'aetools.Error'
|
Error = 'aetools.Error'
|
||||||
|
|
||||||
|
# Amount of time to wait for program to be launched
|
||||||
|
LAUNCH_MAX_WAIT_TIME=10
|
||||||
|
|
||||||
# Special code to unpack an AppleEvent (which is *not* a disguised record!)
|
# Special code to unpack an AppleEvent (which is *not* a disguised record!)
|
||||||
# Note by Jack: No??!? If I read the docs correctly it *is*....
|
# Note by Jack: No??!? If I read the docs correctly it *is*....
|
||||||
|
|
||||||
|
@ -174,6 +178,14 @@ class TalkTo:
|
||||||
self.send('ascr', 'noop')
|
self.send('ascr', 'noop')
|
||||||
except AE.Error:
|
except AE.Error:
|
||||||
_launch(self.target_signature)
|
_launch(self.target_signature)
|
||||||
|
for i in range(LAUNCH_MAX_WAIT_TIME):
|
||||||
|
try:
|
||||||
|
self.send('ascr', 'noop')
|
||||||
|
except AE.Error:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""Deprecated, used _start()"""
|
"""Deprecated, used _start()"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue