First time here? Check out the FAQ!
1

Adding item to editor 'Right-click Editor Menu'

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.

iainrs's avatar
71
iainrs
asked 2019-01-27 06:42:00 -0500
Wingware Support's avatar
4k
Wingware Support
updated 2019-03-13 10:27:21 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

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, {})
wingapi.gApplication.ExecuteOSCommand(cmd_id)

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:  https://wingware.com/doc/scripting

Wingware Support's avatar
4k
Wingware Support
answered 2019-01-27 09:05:00 -0500
Wingware Admin's avatar
231
Wingware Admin
updated 2019-03-06 21:44:24 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer