Show
Ignore:
Timestamp:
07/07/08 12:32:17 (5 months ago)
Author:
rob
Message:

Removed empty label and border from around file and dir browse buttons

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/peppy/lib/userparams.py

    r1457 r1465  
    120120class FileBrowseButton2(FileBrowseButton): 
    121121    """Small enhancements to FileBrowseButton""" 
    122     def createDialog(self, *args, **kwargs): 
    123         """Automatically hide the label because it's not used here""" 
    124         FileBrowseButton.createDialog(self, *args, **kwargs) 
    125         self.label.Hide() 
     122    def createDialog( self, parent, id, pos, size, style, name ): 
     123        """Setup the graphic representation of the dialog""" 
     124        wx.Panel.__init__ (self, parent, id, pos, size, style, name) 
     125        self.SetMinSize(size) # play nice with sizers 
     126 
     127        box = wx.BoxSizer(wx.HORIZONTAL) 
     128 
     129        self.label = self.createLabel( ) 
     130        #box.Add( self.label, 0, wx.CENTER ) 
     131 
     132        self.textControl = self.createTextControl() 
     133        box.Add( self.textControl, 1, wx.LEFT|wx.CENTER, 0) 
     134 
     135        self.browseButton = self.createBrowseButton() 
     136        box.Add( self.browseButton, 0, wx.LEFT|wx.CENTER, 5) 
     137 
     138        # add a border around the whole thing and resize the panel to fit 
     139        outsidebox = wx.BoxSizer(wx.VERTICAL) 
     140        outsidebox.Add(box, 1, wx.EXPAND|wx.ALL, 0) 
     141        outsidebox.Fit(self) 
     142 
     143        self.SetAutoLayout(True) 
     144        self.SetSizer( outsidebox ) 
     145        self.Layout() 
     146        if type( size ) == types.TupleType: 
     147            size = apply( wx.Size, size) 
     148        self.SetDimensions(-1, -1, size.width, size.height, wx.SIZE_USE_EXISTING) 
    126149         
    127150    def SetToolTipString(self, text): 
     
    162185        dlg.Destroy() 
    163186     
    164 class DirBrowseButton2(DirBrowseButton): 
     187class DirBrowseButton2(FileBrowseButton2): 
    165188    """Update to dir browse button to browse to the currently set 
    166189    directory instead of always using the initial directory. 
    167190    """ 
     191    def createDialog(self, *args, **kwargs): 
     192        """Automatically hide the label because it's not used here""" 
     193        FileBrowseButton2.createDialog(self, *args, **kwargs) 
     194        self.dialogClass = wx.DirDialog 
     195        self.newDirectory = False 
     196         
    168197    def OnBrowse(self, ev = None): 
    169198        current = self.GetValue()