mailr11789 - in /branches/bieri_gui/gui_bieri: menu.py user_functions/__init__.py user_functions/residue.py


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

Header


Content

Posted by edward on December 13, 2010 - 17:40:
Author: bugman
Date: Mon Dec 13 17:40:30 2010
New Revision: 11789

URL: http://svn.gna.org/viewcvs/relax?rev=11789&view=rev
Log:
Created the residue.create and residue.delete user function windows and menu 
entries.


Added:
    branches/bieri_gui/gui_bieri/user_functions/residue.py
      - copied, changed from r11786, 
branches/bieri_gui/gui_bieri/user_functions/spin.py
Modified:
    branches/bieri_gui/gui_bieri/menu.py
    branches/bieri_gui/gui_bieri/user_functions/__init__.py

Modified: branches/bieri_gui/gui_bieri/menu.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/menu.py?rev=11789&r1=11788&r2=11789&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/menu.py (original)
+++ branches/bieri_gui/gui_bieri/menu.py Mon Dec 13 17:40:30 2010
@@ -199,6 +199,10 @@
                 [id_base + 101, "&create", paths.icon_16x16.add, 
self.gui.user_functions.pipes.create],
                 [id_base + 102, "&delete", paths.icon_16x16.cancel, 
self.gui.user_functions.pipes.delete]
             ]],
+            [id_base + 000, "&residue", paths.icon_16x16.residue, None, [
+                [id_base + 001, "&create", paths.icon_16x16.add, 
self.gui.user_functions.residue.create],
+                [id_base + 002, "&delete", paths.icon_16x16.cancel, 
self.gui.user_functions.residue.delete]
+            ]],
             [id_base + 200, "&script",   paths.icon_16x16.uf_script, 
self.gui.user_functions.script.run, []],
             [id_base + 100, "&spin", paths.icon_16x16.spin, None, [
                 [id_base + 101, "&create", paths.icon_16x16.add, 
self.gui.user_functions.spin.create],

Modified: branches/bieri_gui/gui_bieri/user_functions/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/user_functions/__init__.py?rev=11789&r1=11788&r2=11789&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/user_functions/__init__.py (original)
+++ branches/bieri_gui/gui_bieri/user_functions/__init__.py Mon Dec 13 
17:40:30 2010
@@ -29,6 +29,7 @@
 # GUI module imports.
 from molecule import Molecule
 from pipes import Pipes
+from residue import Residue
 from script import Script
 from spin import Spin
 
@@ -37,6 +38,7 @@
 __all__ = ['base',
            'molecule',
            'pipes',
+           'residue',
            'script',
            'spin']
 
@@ -58,6 +60,7 @@
         # The user functions.
         self.molecule = Molecule(self.gui, self.interpreter)
         self.pipes = Pipes(self.gui, self.interpreter)
+        self.residue = Residue(self.gui, self.interpreter)
         self.script = Script(self.gui, self.interpreter)
         self.spin = Spin(self.gui, self.interpreter)
 
@@ -68,4 +71,5 @@
         # Send the commands onwards to the user function classes.
         self.molecule.destroy()
         self.pipes.destroy()
+        self.residue.destroy()
         self.spin.destroy()

Copied: branches/bieri_gui/gui_bieri/user_functions/residue.py (from r11786, 
branches/bieri_gui/gui_bieri/user_functions/spin.py)
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/user_functions/residue.py?p2=branches/bieri_gui/gui_bieri/user_functions/residue.py&p1=branches/bieri_gui/gui_bieri/user_functions/spin.py&r1=11786&r2=11789&rev=11789&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/user_functions/spin.py (original)
+++ branches/bieri_gui/gui_bieri/user_functions/residue.py Mon Dec 13 
17:40:30 2010
@@ -21,14 +21,14 @@
 
###############################################################################
 
 # Module docstring.
-"""The spin user function GUI elements."""
+"""The residue user function GUI elements."""
 
 # Python module imports.
 from string import split
 import wx
 
 # relax module imports.
-from generic_fns.mol_res_spin import molecule_loop, residue_loop, spin_loop
+from generic_fns.mol_res_spin import molecule_loop, residue_loop
 from generic_fns import pipes
 
 # GUI module imports.
@@ -37,7 +37,7 @@
 
 
 # The container class.
-class Spin(UF_base):
+class Residue(UF_base):
     """The container class for holding all GUI elements."""
 
     def setup(self):
@@ -49,7 +49,7 @@
 
 
     def create(self, event):
-        """The spin.create user function.
+        """The residue.create user function.
 
         @param event:   The wx event.
         @type event:    wx event
@@ -59,7 +59,7 @@
 
 
     def delete(self, event):
-        """The spin.delete user function.
+        """The residue.delete user function.
 
         @param event:   The wx event.
         @type event:    wx event
@@ -77,86 +77,56 @@
 
 
 class Add_window(UF_window):
-    """The spin.create() user function window."""
+    """The residue.create() user function window."""
 
     # Some class variables.
     size_x = 600
     size_y = 400
-    frame_title = 'Add a spin'
-    image_path = WIZARD_IMAGE_PATH + 'spin.png'
-    main_text = 'This dialog allows you to add new spins to the relax data 
store.  The spin will be added to the current data pipe.'
-    title = 'Addition of new spins'
-
-
-    def _update_residues(self, event):
-        """Update the residue combo box.
-
-        @param event:   The wx event.
-        @type event:    wx event
-        """
-
-        # Clear the previous data.
-        self.res.Clear()
-
-        # Clear the text.
-        self.res.SetValue('')
-
-        # The list of residue names.
-        mol_id = '#' + str(self.mol.GetValue())
-        for res in residue_loop(mol_id):
-            self.res.Append("%s %s" % (res.num, res.name))
+    frame_title = 'Add a residue'
+    image_path = WIZARD_IMAGE_PATH + 'residue.png'
+    main_text = 'This dialog allows you to add new residues to the relax 
data store.  The residue will be added to the current data pipe.'
+    title = 'Addition of new residues'
 
 
     def add_uf(self, sizer):
-        """Add the spin specific GUI elements.
+        """Add the residue specific GUI elements.
 
         @param sizer:   A sizer object.
         @type sizer:    wx.Sizer instance
         """
 
         # Molecule and residue selections.
-        self.mol = self.combo_box(sizer, "The molecule:", [], 
self._update_residues)
-        self.res = self.combo_box(sizer, "The residue:", [])
-
-        # The spin name input.
-        self.spin_name = self.input_field(sizer, "The name of the spin:")
+        self.mol = self.combo_box(sizer, "The molecule:", [])
+
+        # The residue name input.
+        self.res_name = self.input_field(sizer, "The name of the residue:")
 
         # The type selection.
-        self.spin_num = self.input_field(sizer, "The spin number:")
+        self.res_num = self.input_field(sizer, "The residue number:")
 
 
     def execute(self):
         """Execute the user function."""
 
-        # Get the spin info.
+        # The molecule name.
         mol_name = str(self.mol.GetValue())
         if mol_name == '':
             mol_name = None
 
-        # The residue info.
-        res = str(self.res.GetValue())
-        res_num, res_name = split(res)
-        if res_name == '':
-            res_name = None
+        # The residue number.
+        res_num = str(self.res_num.GetValue())
         if res_num == '':
             res_num = None
         else:
             res_num = int(res_num)
 
-        # The spin number.
-        spin_num = str(self.spin_num.GetValue())
-        if spin_num == '':
-            spin_num = None
-        else:
-            spin_num = int(spin_num)
-
-        # The spin name.
-        spin_name = str(self.spin_name.GetValue())
-        if spin_num == '':
-            spin_num = None
+        # The residue name.
+        res_name = str(self.res_name.GetValue())
+        if res_num == '':
+            res_num = None
 
         # Set the name.
-        self.interpreter.spin.create(spin_name=spin_name, spin_num=spin_num, 
res_name=res_name, res_num=res_num, mol_name=mol_name)
+        self.interpreter.residue.create(res_name=res_name, res_num=res_num, 
mol_name=mol_name)
 
 
     def update(self, event):
@@ -168,11 +138,9 @@
 
         # Clear the previous data.
         self.mol.Clear()
-        self.res.Clear()
 
         # Clear the text.
         self.mol.SetValue('')
-        self.res.SetValue('')
 
         # The list of molecule names.
         if pipes.cdp_name():
@@ -182,39 +150,39 @@
 
 
 class Delete_window(UF_window):
-    """The spin.delete() user function window."""
+    """The residue.delete() user function window."""
 
     # Some class variables.
     size_x = 600
     size_y = 400
-    frame_title = 'Delete a spin'
-    image_path = WIZARD_IMAGE_PATH + 'spin.png'
-    main_text = 'This dialog allows you to delete spins from the relax data 
store.  The spin will be deleted from the current data pipe.'
-    title = 'Spin deletion'
+    frame_title = 'Delete a residue'
+    image_path = WIZARD_IMAGE_PATH + 'residue.png'
+    main_text = 'This dialog allows you to delete residues from the relax 
data store.  The residue will be deleted from the current data pipe.'
+    title = 'Residue deletion'
 
 
     def add_uf(self, sizer):
-        """Add the spin specific GUI elements.
+        """Add the residue specific GUI elements.
 
         @param sizer:   A sizer object.
         @type sizer:    wx.Sizer instance
         """
 
-        # The spin selection.
-        self.spin_name = self.combo_box(sizer, "The spin:", [])
+        # The residue selection.
+        self.res_name = self.combo_box(sizer, "The residue:", [])
 
 
     def execute(self):
         """Execute the user function."""
 
         # Get the name.
-        spin_name = str(self.spin_name.GetValue())
-
-        # The spin ID.
-        id = '#' + spin_name
-
-        # Delete the spin.
-        self.interpreter.spin.delete(spin_id=id)
+        res_name = str(self.res_name.GetValue())
+
+        # The residue ID.
+        id = ':' + res_name
+
+        # Delete the residue.
+        self.interpreter.residue.delete(res_id=id)
 
         # Update.
         self.update(None)
@@ -228,12 +196,12 @@
         """
 
         # Clear the previous data.
-        self.spin_name.Clear()
-
-        # Clear the spin name.
-        self.spin_name.SetValue('')
-
-        # The list of spin names.
+        self.res_name.Clear()
+
+        # Clear the residue name.
+        self.res_name.SetValue('')
+
+        # The list of residue names.
         if pipes.cdp_name():
-            for spin in spin_loop():
-                self.spin_name.Append(spin.name)
+            for res in res_loop():
+                self.res_name.Append(res.name)




Related Messages


Powered by MHonArc, Updated Tue Dec 14 00:00:02 2010