mailr16191 - /branches/uf_redesign/gui/wizard_elements.py


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

Header


Content

Posted by edward on May 10, 2012 - 15:09:
Author: bugman
Date: Thu May 10 15:09:27 2012
New Revision: 16191

URL: http://svn.gna.org/viewcvs/relax?rev=16191&view=rev
Log:
Read only args as combo boxes can now be set to None, if allowed, in the GUI 
user functions.

The empty string and None are prepended to the combo box choices and data 
respectively.


Modified:
    branches/uf_redesign/gui/wizard_elements.py

Modified: branches/uf_redesign/gui/wizard_elements.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/wizard_elements.py?rev=16191&r1=16190&r2=16191&view=diff
==============================================================================
--- branches/uf_redesign/gui/wizard_elements.py (original)
+++ branches/uf_redesign/gui/wizard_elements.py Thu May 10 15:09:27 2012
@@ -24,6 +24,7 @@
 """Module containing a set of special GUI elements to be used in the relax 
wizards."""
 
 # Python module imports.
+from copy import deepcopy
 from string import upper
 import sys
 import wx
@@ -1240,6 +1241,7 @@
         self.name = name
         self.default = default
         self.element_type = element_type
+        self.can_be_none = can_be_none
 
         # The value types.
         if value_type in ['float', 'num']:
@@ -1422,9 +1424,14 @@
             # First clear all data.
             self.Clear()
 
-            # The data.
+            # Set the data if needed.
             if combo_data == None:
-                combo_data = combo_choices
+                combo_data = deepcopy(combo_choices)
+
+            # Handle None in combo boxes by prepending a None element to the 
lists.
+            if self.can_be_none:
+                combo_choices.insert(0, '')
+                combo_data.insert(0, None)
 
             # Loop over the choices and data, adding both to the end.
             for i in range(len(combo_choices)):




Related Messages


Powered by MHonArc, Updated Thu May 10 16:20:02 2012