canopyepd-python

Keyboard shortcut to switch between the code editor and ipython console using the Canopy


How can I create a keyboard shortcut to switch between the code editor and ipython console using the Canopy IDE?

I have tried writing a macro according to the documentation for code editing (http://docs.enthought.com/canopy/configure/editor-scripting-api.html#code-editor-scripting-commands) and the ipython pane scripting commands (http://docs.enthought.com/canopy/configure/ipython-scripting-api.html#ipython-pane-scripting-commands, but do not see a solution.

As an example, I have a macro that will execute the current line of code (without having to select it), but it would be nice to be able to switch the cursor back to the code editor after execution without touching the mouse/trackpad.

def run():
    code_task = get_active_task()
    code_editor = code_task.active_editor
    cursor = code_editor.cursor
    cursor.start_of_line()
    cursor.next_line(select=True)
    code_task.run_selection()

Using Canopy Version: 1.1.1 (64 bit) on Mac OS X 10.7.5


Solution

  • Thanks, great suggestion. Added to Canopy wish list. (You can use the keyboard shortcut Control+Tab to cycle among File Browser, Editor, and IPython, but this is not yet macro-able.)