mailr15750 - in /1.3/gui/user_functions: mol_res_spin.py spin.py


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

Header


Content

Posted by edward on April 17, 2012 - 15:27:
Author: bugman
Date: Tue Apr 17 15:27:22 2012
New Revision: 15750

URL: http://svn.gna.org/viewcvs/relax?rev=15750&view=rev
Log:
Bug fix for the spin.create user function GUI interface for when molecules or 
residues are not named.

Unnamed molecules are now properly handled in the GUI page, and the residue 
name of None is properly
converted into a NoneType prior to executing the back end.


Modified:
    1.3/gui/user_functions/mol_res_spin.py
    1.3/gui/user_functions/spin.py

Modified: 1.3/gui/user_functions/mol_res_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/mol_res_spin.py?rev=15750&r1=15749&r2=15750&view=diff
==============================================================================
--- 1.3/gui/user_functions/mol_res_spin.py (original)
+++ 1.3/gui/user_functions/mol_res_spin.py Tue Apr 17 15:27:22 2012
@@ -87,7 +87,7 @@
             res_num, res_name = split(res)
 
             # Convert.
-            if res_name == '':
+            if res_name in ['', 'None']:
                 res_name = None
             if res_num == '':
                 res_num = None
@@ -193,8 +193,14 @@
         # Clear the text.
         self.res.SetValue(str_to_gui(''))
 
+        # The molecule ID.
+        mol = gui_to_str(self.mol.GetValue())
+        if mol:
+            mol_id = generate_spin_id(mol)
+        else:
+            mol_id = None
+
         # The list of residue names.
-        mol_id = generate_spin_id(str(self.mol.GetValue()))
         if cdp_name():
             for res in residue_loop(mol_id):
                 self.res.Append(str_to_gui("%s %s" % (res.num, res.name)))

Modified: 1.3/gui/user_functions/spin.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/spin.py?rev=15750&r1=15749&r2=15750&view=diff
==============================================================================
--- 1.3/gui/user_functions/spin.py (original)
+++ 1.3/gui/user_functions/spin.py Tue Apr 17 15:27:22 2012
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2011 Edward d'Auvergne                                       
 #
+# Copyright (C) 2011-2012 Edward d'Auvergne                                  
 
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -339,7 +339,8 @@
         # The list of molecule names.
         if cdp_name():
             for mol in molecule_loop():
-                self.mol.Append(str_to_gui(mol.name))
+                if mol.name != None:
+                    self.mol.Append(str_to_gui(mol.name))
 
         # The default molecule.
         if self.defaults.has_key('mol') and self.defaults['mol']:
@@ -363,18 +364,13 @@
 
         # The residue info.
         res_num, res_name = self._get_res_info()
+        print "%s, %s" % (`res_num`, `res_name`)
 
         # The spin number.
-        spin_num = str(self.spin_num.GetValue())
-        if spin_num == '':
-            spin_num = None
-        else:
-            spin_num = int(spin_num)
+        spin_num = gui_to_int(self.spin_num.GetValue())
 
         # The spin name.
-        spin_name = str(self.spin_name.GetValue())
-        if spin_num == '':
-            spin_num = None
+        spin_name = gui_to_str(self.spin_name.GetValue())
 
         # Set the name.
         self.execute('spin.create', spin_name=spin_name, spin_num=spin_num, 
res_name=res_name, res_num=res_num, mol_name=mol_name)




Related Messages


Powered by MHonArc, Updated Tue Apr 17 15:40:01 2012