Contextual Menu in font view?



  • I saw this in the RF 1.7 release notes:

    Add contextual menu event in font overview with this notification: fontOverviewAdditionContextualMenuItems

    Could you give an example of how it’s used?

    Thanks,
    Jens


  • admin

    this should work in RoboFont 1.7

    good luck

    from mojo.events import addObserver
    
    class test(object):
        
        def __init__(self):
            
            addObserver(self, "fontOverviewAdditionContextualMenuItems", "fontOverviewAdditionContextualMenuItems")
            
        def fontOverviewAdditionContextualMenuItems(self, notification):
            myMenuItems = [
                ("Hello", self.sayHello), 
                ("World", self.sayWorld),
                ("submenu", [("an item", self.sayAnItem)])
                ]
            notification["additionContextualMenuItems"].extend(myMenuItems)
        
        def sayHello(self, sender):
            print "Hello"
        
        def sayWorld(self, sender):
            print "World"
        
        def sayAnItem(self, sender):
            print "an item"
    
    test()
    


  • Nice, thank you!


Log in to reply
 

Looks like your connection to RoboFont ● Forum was lost, please wait while we try to reconnect.