mailr12056 - in /branches/bieri_gui/gui_bieri: menu.py user_functions/relax_data.py


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

Header


Content

Posted by edward on December 30, 2010 - 23:32:
Author: bugman
Date: Thu Dec 30 23:32:41 2010
New Revision: 12056

URL: http://svn.gna.org/viewcvs/relax?rev=12056&view=rev
Log:
Create the relax_data.delete user function window and menu entry.


Modified:
    branches/bieri_gui/gui_bieri/menu.py
    branches/bieri_gui/gui_bieri/user_functions/relax_data.py

Modified: branches/bieri_gui/gui_bieri/menu.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/menu.py?rev=12056&r1=12055&r2=12056&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/menu.py (original)
+++ branches/bieri_gui/gui_bieri/menu.py Thu Dec 30 23:32:41 2010
@@ -201,10 +201,11 @@
                 [wx.NewId(), "&delete", paths.icon_16x16.remove, 
self.gui.user_functions.pipes.delete],
                 [wx.NewId(), "&switch", paths.icon_16x16.pipe_switch, 
self.gui.user_functions.pipes.switch]
             ]],
-            [wx.NewId(), "relax_data", paths.icon_16x16.relax_data, None, [
+            [wx.NewId(), "&relax_data", paths.icon_16x16.relax_data, None, [
+                [wx.NewId(), "&delete", paths.icon_16x16.remove, 
self.gui.user_functions.relax_data.delete],
                 [wx.NewId(), "&read", paths.icon_16x16.open, 
self.gui.user_functions.relax_data.read]
             ]],
-            [wx.NewId(), "&residue", paths.icon_16x16.residue, None, [
+            [wx.NewId(), "resid&ue", paths.icon_16x16.residue, None, [
                 [wx.NewId(), "&create", paths.icon_16x16.add, 
self.gui.user_functions.residue.create],
                 [wx.NewId(), "&delete", paths.icon_16x16.remove, 
self.gui.user_functions.residue.delete]
             ]],

Modified: branches/bieri_gui/gui_bieri/user_functions/relax_data.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/user_functions/relax_data.py?rev=12056&r1=12055&r2=12056&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/user_functions/relax_data.py (original)
+++ branches/bieri_gui/gui_bieri/user_functions/relax_data.py Thu Dec 30 
23:32:41 2010
@@ -40,6 +40,23 @@
 class Relax_data(UF_base):
     """The container class for holding all GUI elements."""
 
+    def delete(self, event):
+        """The relax_data.delete user function.
+
+        @param event:       The wx event.
+        @type event:        wx event
+        """
+
+        # Initialise the dialog.
+        window = Delete_window(self.gui, self.interpreter)
+
+        # Show the dialog.
+        window.ShowModal()
+
+        # Destroy.
+        window.Destroy()
+
+
     def read(self, event):
         """The relax_data.read user function.
 
@@ -48,13 +65,73 @@
         """
 
         # Initialise the dialog.
-        self._read_window = Read_window(self.gui, self.interpreter)
+        window = Read_window(self.gui, self.interpreter)
 
         # Show the dialog.
-        self._read_window.ShowModal()
+        window.ShowModal()
 
         # Destroy.
-        self._read_window.Destroy()
+        window.Destroy()
+
+
+
+class Delete_window(UF_window):
+    """The relax_data.read() user function window."""
+
+    # Some class variables.
+    size_x = 600
+    size_y = 400
+    frame_title = 'Delete the relaxation data'
+    image_path = WIZARD_IMAGE_PATH + 'fid.png'
+    main_text = 'This dialog allows you to delete read relaxation data.'
+    title = 'Relaxation data deletion'
+
+
+    def add_uf(self, sizer):
+        """Add the relaxation data deletion specific GUI elements.
+
+        @param sizer:   A sizer object.
+        @type sizer:    wx.Sizer instance
+        """
+
+        # The data labels.
+        self.ri_label = self.combo_box(sizer, "The relaxation data label:", 
choices=[])
+        self.frq_label = self.combo_box(sizer, "The frequency label in 
MHz:", choices=[])
+
+
+    def execute(self):
+        """Execute the user function."""
+
+        # The labels and frq.
+        ri_label = gui_to_str(self.ri_label.GetValue())
+        frq_label = gui_to_str(self.frq_label.GetValue())
+
+        # Read the relaxation data.
+        self.interpreter.relax_data.delete(ri_label=ri_label, 
frq_label=frq_label)
+
+
+    def update(self, event):
+        """Update the UI.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Clear the previous data.
+        self.ri_label.Clear()
+        self.frq_label.Clear()
+
+        # No data, so don't try to fill the combo boxes.
+        if not hasattr(cdp, 'ri_labels'):
+            return
+
+        # The relaxation data labels.
+        for i in range(len(cdp.ri_labels)):
+            self.ri_label.Append(cdp.ri_labels[i])
+
+        # The frq labels.
+        for i in range(len(cdp.frq_labels)):
+            self.frq_label.Append(cdp.frq_labels[i])
 
 
 




Related Messages


Powered by MHonArc, Updated Thu Dec 30 23:40:02 2010