0

"inactiveState" equivalent in Python?

Hi all,

how can I create an inactive menu item in python?

The Mu equivalent is:

MenuItem( "File to Linear Conversion", nil, nil, inactiveState )

In Python I tried:

( "File to Linear Conversion", nil, nil, 'inactiveState' )

and

( "File to Linear Conversion", nil, nil, rv.rvui.inactiveState )

but none of those work (despite the mu api browser claiming that rvui.inactiveState exists).

 

It would be so nice if menus/menu items could be proper python objects with dedicated methods rather than just tuples!!

 

Cheers,

frank

 

2 条评论

  • 0
    Avatar
    Jon Morley

    Hi Frank,

    rvui.inactiveState is a special method in Mu that returns commands.DisabledMenuState. In Python you can use the following:

    from rv import commands
    ( "File to Linear Conversion", nil, nil, lambda: commands.DisabledMenuState )

    Please let me know if that works for you.

    Thanks,
    Jon

  • 0
    Avatar
    Frank Rueter

    Ah, thanks, that works. I didn't realise the state hooks had to be callables.

请先登录再写评论。