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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
iainrs's avatar
71
iainrs
asked 6 years ago
Wingware Support's avatar
4.3k
Wingware Support
updated 6 years ago

Comments

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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Wingware Support's avatar
4.3k
Wingware Support
answered 6 years ago
Wingware Admin's avatar
255
Wingware Admin
updated 6 years ago
link

Comments

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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)