0

is it possible to set rv 'Window' menu items to DisabledMenuState?

Hi,

I'm trying to add an option to the Window menu item and disable the other items (except for the Console) in that same menu.

The method used is:

def build_window_menu(self):

    return ('Window', [
                ('Default Size', self.amethodthatworks),
                ('_', None),
                ('Full Screen', self.noactionmethod, '`', lambda: commands.DisabledMenuState),
                ('Fit', self.noactionmethod, 'W', lambda: commands.DisabledMenuState),
                ('Center', self.noactionmethod, None , lambda: commands.DisabledMenuState),
                ('Center Fit', self.noactionmethod, 'shift+W' , lambda: commands.DisabledMenuState),
            ])

The new option ('Default Size') is added and the method ( self.amethodthatworks ) is launched when clicking on the item.

But the other options do not seem to be affected at all:

* the items are not disabled

* and their method (self.noactionmethod) which is meant to do nothing and suppress the event is not picked up. Instead their default behaviour is followed.

So I would like to ask: is it actually possible to update these menu items? Is there something wrong with the menu list above (similar lists seem to work for other menus)? Is there a known event at which the Window menu is redrawn (and commands.defineModeMenu needs to be called again to override items) but the other menus are not?

Thanks,

Aris

 

2 条评论

  • 0
    Avatar
    Jon Morley

    Hi Aris,

    Those menu items are part of the compiled menu and cannot be overwritten in this manner. Even if they were not compiled there would not be a reliable way to overload them. The menu may possibly be rebuilt at any time and in so doing would wipe out this kind of overloading. Can you explain why you want to hide these features from your users? Perhaps there is some other way.

    Thanks,
    Jon

  • 0
    Avatar
    Aris Katzagiannakis

    Hi Jon,

    thanks for the reply. The main concern is to disable the 'Full Screen' item because we use twm and when toggling fullscreen the window geometry (position and dimensions) is slightly changed every time. We have a workaround for it but it can only be triggered when backtick (`) is used to toggle fullscreen. When the menu item is used, the events that seem to be created are 'view-resized' and 'view-size-changed' (and both seem to be used in other events as well - so we cannot use those). Is there some other event that can be used?

    Thanks,

    Aris

    ps. I failed to mention in the original email that we use rv6.2.6 at the moment

请先登录再写评论。