mailr13882 - /branches/gui_testing/gui/analyses/auto_model_free.py


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

Header


Content

Posted by edward on July 26, 2011 - 12:45:
Author: bugman
Date: Tue Jul 26 12:45:52 2011
New Revision: 13882

URL: http://svn.gna.org/viewcvs/relax?rev=13882&view=rev
Log:
The model-free model list GUI elements are now properly updated when loading 
a saved state.

The text field now has the previously selected models and the selector window 
now has only these
models ticked.


Modified:
    branches/gui_testing/gui/analyses/auto_model_free.py

Modified: branches/gui_testing/gui/analyses/auto_model_free.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/auto_model_free.py?rev=13882&r1=13881&r2=13882&view=diff
==============================================================================
--- branches/gui_testing/gui/analyses/auto_model_free.py (original)
+++ branches/gui_testing/gui/analyses/auto_model_free.py Tue Jul 26 12:45:52 
2011
@@ -384,9 +384,11 @@
 
         # Add the local tau_m models GUI element, with spacing.
         self.local_tm_model_field = Local_tm_list(self, box)
+        self.local_tm_model_field.SetValue(self.data.local_tm_models)
 
         # Add the model-free models GUI element, with spacing.
         self.mf_model_field = Mf_list(self, box)
+        self.mf_model_field.SetValue(self.data.mf_models)
 
         # The optimisation settings.
         self.grid_inc = self.add_spin_element(box, self, text="Grid search 
increments:", default=11, min=1, max=100, tooltip="This is the number of 
increments per dimension of the grid search performed prior to numerical 
optimisation.")
@@ -725,6 +727,9 @@
             # Set the selected flag.
             self.select[index] = True
 
+        # Update the button.
+        self.update_button()
+
         # Update the GUI element.
         self.field.SetValue(list_to_gui(self.GetValue()))
 
@@ -741,6 +746,9 @@
         if not question(msg, caption="Warning - do not change!", 
default=False):
             return
 
+        # Set the model selector window selections.
+        self.model_win.set_selection(self.select)
+
         # Show the model selector window.
         if status.show_gui:
             self.model_win.ShowModal()
@@ -749,6 +757,16 @@
         # Set the values.
         self.select = self.model_win.get_selection()
 
+        # Update the button.
+        self.update_button()
+
+        # Update the GUI element.
+        self.field.SetValue(list_to_gui(self.GetValue()))
+
+
+    def update_button(self):
+        """Update the button bitmap as needed."""
+
         # Change the flag to red to indicate to the user that changing the 
models is a bad thing!
         if False in self.select:
             self.button.SetBitmapLabel(wx.Bitmap(paths.icon_16x16.flag_red, 
wx.BITMAP_TYPE_ANY))
@@ -756,9 +774,6 @@
         # Otherwise set it to blue (in case all models are selected again).
         else:
             self.button.SetBitmapLabel(wx.Bitmap(paths.icon_16x16.flag_blue, 
wx.BITMAP_TYPE_ANY))
-
-        # Update the GUI element.
-        self.field.SetValue(list_to_gui(self.GetValue()))
 
 
 
@@ -884,6 +899,18 @@
         self.Hide()
 
 
+    def set_selection(self, select):
+        """Set the selection.
+
+        @param select:  The list of selections.
+        @type select:   list of bool
+        """
+
+        # Loop over the entries.
+        for i in range(self.model_list.GetItemCount()):
+            self.model_list.CheckItem(i, check=select[i])
+
+
 
 class ModelSelListCtrl(wx.ListCtrl, 
wx.lib.mixins.listctrl.CheckListCtrlMixin):
     """A special list control with checkboxes."""




Related Messages


Powered by MHonArc, Updated Tue Jul 26 14:00:02 2011