In a plugin, I try to have an alternative Menu Entry when the Option key is pressed.
newMenuItem = NSMenuItem(self.name, self.callbackA)
newMenuItemAlt = NSMenuItem(self.nameAlt, self.callbackB)
newMenuItemAlt.setAlternate_(True) # A Boolean value that marks the menu item as an alternate to the previous menu item.
Glyphs.menu[SCRIPT_MENU].append(newMenuItem)
Glyphs.menu[SCRIPT_MENU].append(newMenuItemAlt)
What is wrong that it doesn’t appear with the option key? When I remove the setAlternate_
line, both entries appear. Do I have to pass the other menu item as a parameter? I tired, doesn’t work, too.
When I put it into the [WINDOW_MENU] instead (where I need it to be later), it overwrites the “Kerning” Menu entry there. And when I hit the option key in that case, the “Kerning” entry appears instead of my entry. This seems to be a bug with the Glyphs.menu[SCRIPT_MENU].append()
method?!
I solved this issue by adding a separator. So that’s not too important, just maybe good to know for you.