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

StackOverflow https://stackoverflow.com/questions/20907113

  •  24-09-2022
  •  | 
  •  

Frage

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

War es hilfreich?

Lösung

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.)

Andere Tipps

(on Mac) -> Better Touch Tool. This is a macro that is only active while i'm in emacs, which does the following:

  • save the current buffer (set to F1 in my emacs)
  • cmd-tab to last other window (terminal)
  • 'Up' arrow (to reload last compile/run cmd)
  • 'Enter' key
  • cmd-tab to last other window (emacs), once process terminates

Has saved me thousands of keypresses today.

screenshot

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top