Changeset 1493

Show
Ignore:
Timestamp:
07/11/08 19:36:32 (8 weeks ago)
Author:
rob
Message:

Added actions to hide all minor modes and sidebars

Location:
trunk/peppy
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/peppy/mainmenu.py

    r1481 r1493  
    711711 
    712712 
     713class HideSidebars(SelectAction): 
     714    """Close all sidebars""" 
     715    name = "All Sidebars" 
     716    default_menu = (("View/Hide", 991), 100) 
     717    key_bindings = {'emacs': "C-x 4 1", } 
     718 
     719    def action(self, index=-1, multiplier=1): 
     720        for m in self.frame.sidebar_panes: 
     721            m.Show(False) 
     722        self.frame._mgr.Update() 
     723 
     724class HideMinorModes(SelectAction): 
     725    """Close all minor modes""" 
     726    name = "All Minor Modes" 
     727    default_menu = ("View/Hide", 110) 
     728    key_bindings = {'emacs': "C-x 4 2", } 
     729 
     730    def action(self, index=-1, multiplier=1): 
     731        self.mode.wrapper.minors.hideAll() 
     732 
     733class HideAll(SelectAction): 
     734    """Close all sidebars and minor modes""" 
     735    name = "All Sidebars and Minor Modes" 
     736    default_menu = ("View/Hide", 120) 
     737    key_bindings = {'emacs': "C-x 1", } 
     738 
     739    def action(self, index=-1, multiplier=1): 
     740        for m in self.frame.sidebar_panes: 
     741            m.Show(False) 
     742        self.frame._mgr.Update() 
     743        self.mode.wrapper.minors.hideAll() 
     744 
     745 
    713746class ToolbarShow(ToggleAction): 
    714747    alias = "show-toolbar" 
     
    921954                RunScript, RunScriptWithArgs, RunFilter, StopScript, 
    922955 
    923                 MajorModeSelect, MinorModeShow, SidebarShow, 
     956                MajorModeSelect, MinorModeShow, 
     957                 
     958                SidebarShow, HideSidebars, HideMinorModes, HideAll, 
     959                 
    924960                ToolbarShow,  
    925961 
  • trunk/peppy/minor.py

    r1157 r1493  
    219219        self.mgr.Update() 
    220220 
     221    def hideAll(self): 
     222        """Toggle the shown state, or create the minor mode if necessary. 
     223         
     224        Minor modes are created on demand if not speficied as one of the modes 
     225        to load at mode startup time.  If an entry doesn't exist and it is 
     226        attempted to be toggled, it is created and shown. 
     227        """ 
     228        for entry in self.map.itervalues(): 
     229            if entry.win: 
     230                entry.win.paneinfo.Show(False) 
     231        self.mgr.Update() 
     232 
    221233    def create(self, keyword): 
    222234        """Create the minor mode.