mirror of
https://github.com/python/cpython.git
synced 2025-11-17 01:25:57 +00:00
some old changes to this unused module
This commit is contained in:
parent
35b50e2683
commit
ac8657bb0e
1 changed files with 6 additions and 13 deletions
|
|
@ -28,26 +28,19 @@ SEND_MODE = kAENoReply # kAEWaitReply hangs when run from Terminal.app itself
|
||||||
def run(command):
|
def run(command):
|
||||||
"""Run a shell command in a new Terminal.app window."""
|
"""Run a shell command in a new Terminal.app window."""
|
||||||
termAddress = AE.AECreateDesc(typeApplSignature, TERMINAL_SIG)
|
termAddress = AE.AECreateDesc(typeApplSignature, TERMINAL_SIG)
|
||||||
theEvent = AE.AECreateAppleEvent(kAEMiscStandards, kAEActivate,
|
theEvent = AE.AECreateAppleEvent(kAECoreSuite, kAEDoScript, termAddress,
|
||||||
termAddress, kAutoGenerateReturnID,
|
kAutoGenerateReturnID, kAnyTransactionID)
|
||||||
kAnyTransactionID)
|
commandDesc = AE.AECreateDesc(typeChar, command)
|
||||||
|
theEvent.AEPutParamDesc(kAECommandClass, commandDesc)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
theEvent.AESend(SEND_MODE, kAENormalPriority,
|
theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout)
|
||||||
kAEDefaultTimeout)
|
|
||||||
except AE.Error, why:
|
except AE.Error, why:
|
||||||
if why[0] != -600: # Terminal.app not yet running
|
if why[0] != -600: # Terminal.app not yet running
|
||||||
raise
|
raise
|
||||||
os.system(START_TERMINAL)
|
os.system(START_TERMINAL)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
theEvent.AESend(SEND_MODE, kAENormalPriority,
|
theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout)
|
||||||
kAEDefaultTimeout)
|
|
||||||
|
|
||||||
theEvent = AE.AECreateAppleEvent(kAECoreSuite, kAEDoScript, termAddress,
|
|
||||||
kAutoGenerateReturnID, kAnyTransactionID)
|
|
||||||
commandDesc = AE.AECreateDesc(typeChar, command)
|
|
||||||
theEvent.AEPutParamDesc(kAECommandClass, commandDesc)
|
|
||||||
theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue