wch / SendText

A Sublime Text plugin to send text to a terminal or other program
70 stars 13 forks source link

SendText with iPython Qtconsole #9

Open shaunpatel opened 9 years ago

shaunpatel commented 9 years ago

Any idea on the best way to insert code into an iPython Qtconsole window. I have come up with a little hack, by using some AppleScript in the SendText.py function but it is really clunky. I am really unfamiliar with AppleScript.

        subprocess.call(['osascript', '-e', 'set the clipboard to "' + selection + '"',
                '-e', 'tell application "Python" to activate',
                '-e', 'tell application "System Events"',
                '-e', 'tell process "iPython"',
                '-e', 'delay 0.1',
                '-e', 'keystroke "v" using command down',
                '-e', 'keystroke return',
                '-e', 'keystroke return',
                '-e', 'keystroke return',
                '-e', 'end tell',
                '-e', 'end tell',
                '-e', 'tell application "System Events"',
                '-e', 'tell process "Sublime Text"',
                '-e', 'set frontmost to true',
                '-e', 'end tell',
                '-e', 'end tell'])
shaunpatel commented 9 years ago

Possible to send this to the iPython qtconsole directly through zeroMQ?