def Build( self, projDirPath ): # Clear all widgets from the sizer self.bs1.Clear( True ) if projDirPath is not None and os.path.isdir( projDirPath ): # Build tree control and add it to the sizer self.dtc = DirTreeCtrl( self, -1, style= wx.NO_BORDER | wx.TR_DEFAULT_STYLE | wx.TR_EDIT_LABELS ) self.dtc.SetRootDir( projDirPath ) self.dtc.Expand( self.dtc.GetRootItem() ) self.bs1.Add( self.dtc, 1, wx.EXPAND ) # Bind tree control events self.dtc.Bind( wx.EVT_KEY_UP, p3d.wx.OnKeyUp ) self.dtc.Bind( wx.EVT_KEY_DOWN, p3d.wx.OnKeyDown ) self.dtc.Bind( wx.EVT_LEFT_UP, p3d.wx.OnLeftUp ) self.dtc.Bind( wx.EVT_RIGHT_DOWN, self.OnRightDown ) self.dtc.Bind( wx.EVT_RIGHT_UP, self.OnRightUp ) self.dtc.Bind( wx.EVT_MIDDLE_DOWN, self.OnMiddleDown ) self.dtc.Bind( wx.EVT_LEFT_DCLICK, self.OnLeftDClick ) self.dtc.Bind( wx.EVT_TREE_END_LABEL_EDIT, self.OnTreeEndLabelEdit ) else: # Build and display "project not set" warning tc = wx.StaticText( self, -1, 'Project directory not set', style=wx.ALIGN_CENTER ) font = tc.GetFont() font.SetWeight( wx.FONTWEIGHT_BOLD ) tc.SetFont( font ) self.bs1.AddSpacer( 10 ) self.bs1.Add( tc, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 2 ) self.bs1.Layout()