Ask Your Question

Adding item to editor 'Right-click Editor Menu'

asked 2019-01-27 06:42:00 -0500

iainrs gravatar image

updated 2019-03-13 10:27:21 -0500

I am running Wing-Pro 6.4.1 on a xubuntu 16.04  Linux system.

I would like to add an option to the 'Right-click Editor Menu' which would generate the 'Super+Z' key combination.('Super' key === 'Windows' key)

This would display my clipboard manager (xfce Clipman) and enable me to paste miscellaneous clipboard data.

The documentation says that the menu can be modified using a script but I'm not sure what command to use.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-01-27 09:05:00 -0500

updated 2019-03-06 21:44:24 -0500

Wingware Admin gravatar image

You need to create a script in a directory called 'scripts' inside your user settings directory, which is listed 5th in Wing's About box.  Then add a *.py file there with the code, which would be something like:

import wingapi
def my_new_command():
    # implementation here

# Add this command to the editor context menu
my_new_command.contexts = [wingapi.kContextEditor()]

The first time it's added, you need to do Reload All Scripts in the Edit menu.  After that, Wing auto-reloads scripts if you edit them in Wing.  Output/errors are shown in the Messages tool under the Scripts channel.I'm not sure how you would implement showing the clipboard manager, but if there's a command line you can call to show it then it might be something like this in the body of the def:

cmdline = 'clipman'
cmd_id = wingapi.gApplication.AddOSCommand(cmdline, None, None, {})

You can bind commands you add to Wing's command set with scripts like this by using the User Interface > Keyboard > Custom Key Bindings preference, same as for any other command.Scripting to extend Wing is documented here:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-01-27 06:42:00 -0500

Seen: 28 times

Last updated: Mar 06