Contextual Menu in Glyph View

  • Is there any way to build my own contextual menu in the Glyph View?

    I'm looking for similar solution as the one given in the example:

    Thanks in advance for your help.

  • admin

    A tool can have his own contextual menu item:

    from import EditingTool, installTool
    class MyTool(EditingTool):
        def additionContextualMenuItems(self):
            return [
                ("Hello", self.sayHello), 
                ("World", self.sayWorld),
                ("submenu", [("an item", self.sayAnItem)])
        def sayHello(self, sender):
        def sayWorld(self, sender):
        def sayAnItem(self, sender):
            print("an item")

    0_1517341664440_Screen Shot 2018-01-30 at 20.47.05.png

    It not possible to directly inject menu item into the each menu for each tool. I will think about this and take it with me of the upcoming release.

  • Thanks for the response. I will wait for new solutions then :)

  • Hey @frederik, Is it possible to add additional-contextual-menu-item that will look/work like a checkbox to the BaseEventTool? (like the "lock image" checkbox in the example-screenshot that you shared?)

    (I know I can easily go around it and do it without a check sign. But I consider the check sign more practical)

  • admin

    mmm, RF could use the changes I’ve committed to vanilla.


    for vanilla you can also provide the state, image and if the menu item is enabled.