Contextual menu in a plugin

Hi! I have a “selection tool” plugin, and it doesn’t show this alternative contextual menu when some nodes are selected:

Instead it just shows the default one:

Is there a way to add that alternative menu? Thanks!

Is this plugin written in Python?


Then you need to overwrite

def addMenuItemsForEvent_toMenu_(self, event, contextMenu):
    self = objc.super(YouClassName, self).addMenuItemsForEvent_toMenu_(event, contextMenu)

Thank you! But is there a way to set it to the same alternative menu (when nodes are selected) as the original selection tool has?

What do you use as base class? And what is the tool supposed to do?

SelectTool; it just adds some extra functionality to the select tool, but for things like contextual menus I’d like to keep it the same, otherwise I have to switch to the default tool to access that.

What kind of functionality is that? (we can switch to private messages if you can’t tell in the open).

Because it might be better to add a reporter plugin that has some editing capabilities. You can see what is possible with the “Show Master Compatibility” reporter. The dragging of the connection lines is done in the reporter. That way you can just use the default tool and en/disable your functionality from the view menu.

I see! In this case it really is a variation of the selection tool that manipulates the actual nodes / curves as you drag some of them. I think turning it on and off from a menu would be not very intuitive (or at least require some kind of indication).

So is there no simple way to add that alternative menu? I guess, no worries in that case, I just thought there’s an elegant way (since with Glyphs usually there are nice solutions :smiley: )

The it might be better if you overwrite GSToolSelect. Have a look at GlyphsSDK/ at 28fb77f79f71a8829e840685cabdf290738f2364 · schriftgestalt/GlyphsSDK · GitHub to see what you might like to overwrite or not.