summaryrefslogtreecommitdiff
path: root/sys/lib/python/plat-mac/terminalcommand.py
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-05-03 15:16:20 +0000
committercinap_lenrek <cinap_lenrek@localhost>2011-05-03 15:16:20 +0000
commit5976fdfe42ecdee07df0621d9323c2790b23eb5d (patch)
treee399aa4b8bb7c6d5d2eb8267cf9a2904370a046a /sys/lib/python/plat-mac/terminalcommand.py
parent1665b57e14f8637569e52f8752cc9dd1672a5cfb (diff)
remove stuff
Diffstat (limited to 'sys/lib/python/plat-mac/terminalcommand.py')
-rw-r--r--sys/lib/python/plat-mac/terminalcommand.py47
1 files changed, 0 insertions, 47 deletions
diff --git a/sys/lib/python/plat-mac/terminalcommand.py b/sys/lib/python/plat-mac/terminalcommand.py
deleted file mode 100644
index 292f09c7d..000000000
--- a/sys/lib/python/plat-mac/terminalcommand.py
+++ /dev/null
@@ -1,47 +0,0 @@
-"""terminalcommand.py -- A minimal interface to Terminal.app.
-
-To run a shell command in a new Terminal.app window:
-
- import terminalcommand
- terminalcommand.run("ls -l")
-
-No result is returned; it is purely meant as a quick way to run a script
-with a decent input/output window.
-"""
-
-#
-# This module is a fairly straightforward translation of Jack Jansen's
-# Mac/OSX/PythonLauncher/doscript.m.
-#
-
-import time
-import os
-from Carbon import AE
-from Carbon.AppleEvents import *
-
-
-TERMINAL_SIG = "trmx"
-START_TERMINAL = "/usr/bin/open /Applications/Utilities/Terminal.app"
-SEND_MODE = kAENoReply # kAEWaitReply hangs when run from Terminal.app itself
-
-
-def run(command):
- """Run a shell command in a new Terminal.app window."""
- termAddress = AE.AECreateDesc(typeApplSignature, TERMINAL_SIG)
- theEvent = AE.AECreateAppleEvent(kAECoreSuite, kAEDoScript, termAddress,
- kAutoGenerateReturnID, kAnyTransactionID)
- commandDesc = AE.AECreateDesc(typeChar, command)
- theEvent.AEPutParamDesc(kAECommandClass, commandDesc)
-
- try:
- theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout)
- except AE.Error, why:
- if why[0] != -600: # Terminal.app not yet running
- raise
- os.system(START_TERMINAL)
- time.sleep(1)
- theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout)
-
-
-if __name__ == "__main__":
- run("ls -l")