mailr14654 - /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 September 16, 2011 - 10:05:
Author: bugman
Date: Fri Sep 16 10:05:56 2011
New Revision: 14654

URL: http://svn.gna.org/viewcvs/relax?rev=14654&view=rev
Log:
The peak list GUI element now has a delete button which launches the 
spectrum.delete user function.


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=14654&r1=14653&r2=14654&view=diff
==============================================================================
--- 1.3/gui/components/spectrum.py (original)
+++ 1.3/gui/components/spectrum.py Fri Sep 16 10:05:56 2011
@@ -34,8 +34,9 @@
 
 # relax GUI module imports.
 from gui.fonts import font
-from gui.misc import add_border, float_to_gui, str_to_gui
+from gui.misc import add_border, float_to_gui, gui_to_str, str_to_gui
 from gui import paths
+from gui.user_functions import User_functions; user_functions = 
User_functions()
 
 
 class Spectra_list:
@@ -116,6 +117,7 @@
 
         # Call the button's method.
         self.button_add.Enable(enable)
+        self.button_delete.Enable(enable)
 
 
     def add_buttons(self, sizer):
@@ -138,6 +140,15 @@
         self.gui.Bind(wx.EVT_BUTTON, self.fn_add, self.button_add)
         self.button_add.SetToolTipString("Read a spectral data file.")
 
+        # Delete button.
+        self.button_delete = 
wx.lib.buttons.ThemedGenBitmapTextButton(self.panel, -1, None, " Delete")
+        
self.button_delete.SetBitmapLabel(wx.Bitmap(paths.icon_22x22.list_remove, 
wx.BITMAP_TYPE_ANY))
+        self.button_delete.SetFont(font.normal)
+        self.button_delete.SetSize((80, self.height_buttons))
+        button_sizer.Add(self.button_delete, 0, 0, 0)
+        self.gui.Bind(wx.EVT_BUTTON, self.data_delete, self.button_delete)
+        self.button_delete.SetToolTipString("Delete loaded relaxation data 
from the relax data store.")
+
 
     def build_element(self):
         """Build the spectra listing GUI element."""
@@ -204,6 +215,29 @@
         self.element.Thaw()
 
 
+    def data_delete(self, event):
+        """Launch the spectrum.delete user function.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # The current selection.
+        item = self.element.GetFocusedItem()
+
+        # No selection.
+        if item == -1:
+            id = None
+
+        # Selected item.
+        else:
+            # The spectrum ID.
+            id = gui_to_str(self.element.GetItemText(item))
+
+        # Launch the dialog.
+        user_functions.spectrum.delete(spectrum_id=id)
+
+
     def delete(self):
         """Unregister the class."""
 




Related Messages


Powered by MHonArc, Updated Fri Sep 16 10:20:01 2011