Author: bugman Date: Fri Jul 22 11:57:22 2011 New Revision: 13825 URL: http://svn.gna.org/viewcvs/relax?rev=13825&view=rev Log: Converted the spectra list GUI element to behave the same way as the relaxation data list element. The size is now fixed, and the entire thing is packed into a single panel. Modified: branches/gui_testing/gui/components/spectrum.py Modified: branches/gui_testing/gui/components/spectrum.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/components/spectrum.py?rev=13825&r1=13824&r2=13825&view=diff ============================================================================== --- branches/gui_testing/gui/components/spectrum.py (original) +++ branches/gui_testing/gui/components/spectrum.py Fri Jul 22 11:57:22 2011 @@ -70,14 +70,23 @@ # GUI variables. self.spacing = 5 self.border = 5 + self.height_buttons = 40 + + # First create a panel (to allow for tooltips on the buttons). + self.panel = wx.Panel(self.parent) + box.Add(self.panel, 0, wx.ALL|wx.EXPAND, 0) + + # Add a sizer to the panel. + panel_sizer = wx.BoxSizer(wx.VERTICAL) + self.panel.SetSizer(panel_sizer) # A static box to hold all the widgets, and its sizer. - stat_box = wx.StaticBox(self.parent, -1, "Spectra list") + stat_box = wx.StaticBox(self.panel, -1, "Spectra list") stat_box.SetFont(self.gui.font_subtitle) sub_sizer = wx.StaticBoxSizer(stat_box, wx.VERTICAL) # Add the sizer to the static box and the static box to the main box. - box.Add(sub_sizer, 1, wx.ALL|wx.EXPAND, 0) + panel_sizer.Add(sub_sizer, 0, wx.ALL|wx.EXPAND, 0) # Add a border. box_centre = add_border(sub_sizer, border=self.border) @@ -108,18 +117,14 @@ @type box: wx.BoxSizer instance """ - # A panel for the buttons (to allow for tooltips). - panel = wx.Panel(self.parent, -1) - sizer.Add(panel, 0, wx.ALL|wx.EXPAND, 0) - # Button Sizer button_sizer = wx.BoxSizer(wx.HORIZONTAL) - panel.SetSizer(button_sizer) + sizer.Add(button_sizer, 0, wx.ALL|wx.EXPAND, 0) # Add button. - button = wx.lib.buttons.ThemedGenBitmapTextButton(panel, -1, None, " Add") + button = wx.lib.buttons.ThemedGenBitmapTextButton(self.panel, -1, None, " Add") button.SetBitmapLabel(wx.Bitmap(paths.icon_22x22.add, wx.BITMAP_TYPE_ANY)) - button.SetSize((80, 40)) + button.SetSize((80, self.height_buttons)) button_sizer.Add(button, 0, 0, 0) self.gui.Bind(wx.EVT_BUTTON, self.fn_add, button) button.SetToolTipString("Read a spectral data file.") @@ -200,7 +205,7 @@ """ # Grid of peak list file names and relaxation time. - self.grid = wx.grid.Grid(self.parent, -1) + self.grid = wx.grid.Grid(self.panel, -1) # Initialise to a single row and column. self.grid.CreateGrid(1, 1) @@ -219,8 +224,8 @@ # Bind some events. self.grid.Bind(wx.EVT_SIZE, self.resize) - # Add grid to sizer, with spacing. - sizer.Add(self.grid, 1, wx.ALL|wx.EXPAND, 0) + # Add grid to sizer. + sizer.Add(self.grid, 0, wx.ALL|wx.EXPAND, 0) def resize(self, event):