[wingide-users] Assigning shortcuts
Wing IDE Support
support at wingware.com
Thu Feb 3 15:15:11 EST 2005
On Thu, 3 Feb 2005, Andrew Wheeler wrote:
> Is there a way to map a key and/or add a menu item to an
> external tool? e.g., I want to launch ActiveState's compiled
> HTML help from w/in Wing.
In Wing 2.0.1, sort of (but w/o ability to add menu items). In
the next release we're exposing and documenting the scripting API
so this will be better supported.
If you want to add a key-bound command in Wing 2.0.1, you'll need
to define a script to do the action you want. Place it into
'scripts' in the IDE installation or 'scripts' inside your user
settings directory, which is listed as the 5th item in the About
box. See the examples already in the 'scripts' directory.
Basically what you want is:
cmd = "whatever &"
I'm assuming Linux here by use of '&' -- gets more complicated
if that isn't available because you'll need to use fork/exec or
other way to not hang up the script until the external command
Also, if you want to get into feeding args to the sub-process
based on context in the source code you can do it by modeling
on the editor_extensions.py script, although note that this is
somewhat of a mess in 2.0.1 due to bugs in the scripting API.
Once that's added you need to restart Wing to get it to see
the script file the first time. After that it should reload
automatically when edited and saved but beware 2.0.1 has bugs w/
In 2.0.1 errors are printed to stderr so you'll need to run
wing --verbose or console_wing.exe on Windows to see any messages
from the script manager (this will change in next release).
Then go into the User Interface / Keyboard / Custom Key Binding
preference and select Insert. Press the binding you want while
focus is in the Key field and type "mydoclaunch" in the command
field (it should show autocompletion list w/ that command
Hopefully that will work for you. If you run into problems and
you're not in a rush, I'd say just wait for 2.0.2 but I'm not
sure yet of the release date for that.
Wing IDE for Python
Advancing Software Development
More information about the wingide-users