def ConfigureViewTypeChoices( self, event=None ):
        """Configure the set of View types in the toolbar (and menus)"""
        self.viewTypeTool.SetItems( getattr( self.loader, 'ROOTS', [] ))
        if self.loader and self.viewType in self.loader.ROOTS:
            self.viewTypeTool.SetSelection( self.loader.ROOTS.index( self.viewType ))
            
        # configure the menu with the available choices...
        def chooser( typ ):
            def Callback( event ):
                if typ != self.viewType:
                    self.viewType = typ 
                    self.OnRootView( event )
            return Callback
        # Clear all previous items
        for item in self.viewTypeMenu.GetMenuItems():
            self.viewTypeMenu.DeleteItem( item )
        if self.loader and self.loader.ROOTS:
            for root in self.loader.ROOTS:
                item = wx.MenuItem( 
                    self.viewTypeMenu, -1, root.title(), 
                    _("View hierarchy by %(name)s")%{
                        'name': root.title(),
                    },
                    kind=wx.ITEM_RADIO,
                )
                item.SetCheckable( True )
                self.viewTypeMenu.AppendItem( item )
                item.Check( root == self.viewType )
                wx.EVT_MENU( self, item.GetId(), chooser( root ))
def ConfigureViewTypeChoices ( self , event = None ) : self . viewTypeTool . SetItems ( getattr ( self . loader , 'ROOTS' , [ ] ) ) if self . loader and self . viewType in self . loader . ROOTS : self . viewTypeTool . SetSelection ( self . loader . ROOTS . index ( self . viewType ) ) def chooser ( typ ) : def Callback ( event ) : if typ != self . viewType : self . viewType = typ self . OnRootView ( event ) return Callback for item in self . viewTypeMenu . GetMenuItems ( ) : self . viewTypeMenu . DeleteItem ( item ) if self . loader and self . loader . ROOTS : for root in self . loader . ROOTS : item = wx . MenuItem ( self . viewTypeMenu , - 1 , root . title ( ) , _ ( "View hierarchy by %(name)s" ) % { 'name' : root . title ( ) , } , kind = wx . ITEM_RADIO , ) item . SetCheckable ( True ) self . viewTypeMenu . AppendItem ( item ) item . Check ( root == self . viewType ) wx . EVT_MENU ( self , item . GetId ( ) , chooser ( root ) )
Configure the set of View types in the toolbar (and menus)