Author: bugman Date: Tue Jun 7 14:49:40 2011 New Revision: 12876 URL: http://svn.gna.org/viewcvs/relax?rev=12876&view=rev Log: Double clicking on the peak list cells in the Rx frames now runs openfile(). Modified: 1.3/gui/components/spectrum.py Modified: 1.3/gui/components/spectrum.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/components/spectrum.py?rev=12876&r1=12875&r2=12876&view=diff ============================================================================== --- 1.3/gui/components/spectrum.py (original) +++ 1.3/gui/components/spectrum.py Tue Jun 7 14:49:40 2011 @@ -127,11 +127,41 @@ self.peaklist.SetColLabelValue(1, "Relaxation time [s]") self.peaklist.SetColSize(1, 150) + # Bind some events. + self.peaklist.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN, self.editor) + # Add grid to sizer sizer.Add(self.peaklist, -1, wx.EXPAND, 0) # Pack box box.Add(sizer, 0, wx.EXPAND, 0) + + + def editor(self, event): + """Cell editing. + + @param event: The wx event. + @type event: wx event + """ + + # The row and column. + row = event.GetRow() + col = event.GetCol() + + # File selection. + if col == 0: + # The file + filename = openfile(msg='Select file.', filetype='*.*', default='all files (*.*)|*') + + # Abort if nothing selected + if not filename: + return + + # Set the file name. + self.peaklist.SetCellValue(row, col, str(filename)) + + # Veto the event so the cell is not editable. + event.Veto() def load_delay(self, event, vc=False):