rv menu toggle doesn't work


I'm having trouble getting the toggle feature working on menu items corresponding to an rv packages. I've explained a simple repro case below and I would appreciate if someone could help identify what I'm missing.

1. Contents of PACKAGE file -
- file: browser.py
  menu: 'MyMenu/Browser'
  shortcut: control f1
  load: lazy

2. Contents of browser.py

import rv.rvtypes

class Browser(rv.rvtypes.MinorMode):
    def __init__(self):
    super(Browser, self).__init__()
    self.init("my_test_browser", None, None, None)

    def activate(self):
        print "activating"

    def deactivate(self):
        print "deactivating"

def createMode():
    return Browser()

When I open RV, I can see the Browser menu under MyMenu on the menubar and when I press Control+F1, the activate() gets called and it prints "activate" as expected. All good so far! Now when I press Control+F1 again, instead of calling deactivate() and toggling the menu OFF, it again calls "activate". No matter how many times I use the hot key, it always calls activate(). Another thing I notice is that there is no check-mark on the menu that I would see when its active and not see when its inactive. Basically the toggle isn't working.

Then I removed activate() and deactivate() methods from browser.py and tried the hotkey again, and the toggle works! I can see the check-mark go ON and OFF suggesting its actually toggling.

So I think for some reason the activate() and deactivate() methods disable the toggle feature.

Can someone explain what's happening here? Am I missing something?

Thanks in advance!


  • Avatar
    (Michael) Kessler Official comment


    It appears that you are blocking the execution from reaching the parent class.

    If you check out the pyside_example.py that ships with RV, you'll see that the activate method calls the MinorMode's activate so that it can do the regular processing required.

        def activate(self):




    And similarly the deactivate does the same thing:

        def deactivate(self):



    Try adding those to your activate/deactivate.

  • 0
    Venu Krishnamurthy

    Awesome Michael!! Thanks for the quick response. That makes sense. I tried it and it works!!

    Thanks again!

Please sign in to leave a comment.