Author: bugman Date: Mon Jul 18 12:09:44 2011 New Revision: 13681 URL: http://svn.gna.org/viewcvs/relax?rev=13681&view=rev Log: The column widths of the Spectrum_list GUI element are now set on resize and when updated. This was previously only set on a resize. 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=13681&r1=13680&r2=13681&view=diff ============================================================================== --- branches/gui_testing/gui/components/spectrum.py (original) +++ branches/gui_testing/gui/components/spectrum.py Mon Jul 18 12:09:44 2011 @@ -162,21 +162,8 @@ @type event: wx event """ - # The new grid size. - x, y = event.GetSize() - - # The expandable column width. - width = x - self.col_label_width - 20 - - # Number of columns. - n = self.grid.GetNumberCols() - - # Set to equal sizes. - width = int(width / n) - # Set the column sizes. - for i in range(n): - self.grid.SetColSize(i, width) + self.size_cols() # Continue with the normal resizing. event.Skip() @@ -221,6 +208,26 @@ flag = True + def size_cols(self): + """Set the column sizes.""" + + # The grid size. + x, y = self.grid.GetSize() + + # The expandable column width. + width = x - self.col_label_width - 20 + + # Number of columns. + n = self.grid.GetNumberCols() + + # Set to equal sizes. + width = int(width / n) + + # Set the column sizes. + for i in range(n): + self.grid.SetColSize(i, width) + + def update(self): """Update the spectra listing.""" @@ -263,5 +270,8 @@ # Cell properties. self.grid.SetReadOnly(i, j) + # Size the columns. + self.size_cols() + # Unfreeze. self.grid.Thaw()