mailr13000 - /1.3/gui/components/spectrum.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on June 14, 2011 - 17:44:
Author: bugman
Date: Tue Jun 14 17:44:00 2011
New Revision: 13000

URL: http://svn.gna.org/viewcvs/relax?rev=13000&view=rev
Log:
Better handling of changes in the relaxation peak list grid.


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=13000&r1=12999&r2=13000&view=diff
==============================================================================
--- 1.3/gui/components/spectrum.py (original)
+++ 1.3/gui/components/spectrum.py Tue Jun 14 17:44:00 2011
@@ -371,6 +371,7 @@
         # Bind some events.
         self.grid.GetGridWindow().Bind(wx.EVT_LEFT_DCLICK, 
self.event_left_dclick)
         self.grid.Bind(wx.EVT_KEY_DOWN, self.event_key_down)
+        self.grid.Bind(wx.EVT_KEY_UP, self.event_key_up)
         self.grid.Bind(wx.EVT_SIZE, self.resize)
 
         # Add grid to sizer, with spacing.
@@ -479,6 +480,20 @@
         event.Skip()
 
 
+    def event_key_up(self, event):
+        """Control what happens when a key is released.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Update the grid.
+        self.update_grid()
+
+        # Skip the event to allow for normal operation.
+        event.Skip()
+
+
     def get_all_coordinates(self, top_left, bottom_right):
         """Convert the cell range into a coordinate list.
 
@@ -771,3 +786,10 @@
             # Update the relaxation time.
             if time != '' and ncyc not in ['', '0']:
                 self.grid.SetCellValue(i, 1, str(int(ncyc) * time))
+
+            # The relaxation time and number of cycles.
+            relax_time = str(self.grid.GetCellValue(i, 1))
+
+            # Clear the relaxation time if set to zero.
+            if relax_time == '0.0':
+                self.grid.SetCellValue(i, 1, '')




Related Messages


Powered by MHonArc, Updated Tue Jun 14 18:00:02 2011