mailr16150 - /branches/uf_redesign/gui/uf_objects.py


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

Header


Content

Posted by edward on May 09, 2012 - 15:03:
Author: bugman
Date: Wed May  9 15:03:50 2012
New Revision: 16150

URL: http://svn.gna.org/viewcvs/relax?rev=16150&view=rev
Log:
The Uf_page.on_display() method now gracefully handles RelaxErrors from the 
uf arg iterators.

This now catches the error and uses gui_raise to report to the user.


Modified:
    branches/uf_redesign/gui/uf_objects.py

Modified: branches/uf_redesign/gui/uf_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/uf_objects.py?rev=16150&r1=16149&r2=16150&view=diff
==============================================================================
--- branches/uf_redesign/gui/uf_objects.py (original)
+++ branches/uf_redesign/gui/uf_objects.py Wed May  9 15:03:50 2012
@@ -33,10 +33,11 @@
 # relax module imports.
 import arg_check
 from prompt.base_class import _strip_lead
-from relax_errors import RelaxError
+from relax_errors import AllRelaxErrors, RelaxError
 from user_functions.data import Uf_info; uf_info = Uf_info()
 
 # relax GUI imports.
+from gui.errors import gui_raise
 from gui.fonts import font
 from gui.interpreter import Interpreter; interpreter = Interpreter()
 from gui.wizard import Wiz_page, Wiz_window
@@ -416,16 +417,25 @@
             if iterator == None:
                 continue
 
-            # Get the new choices and data.
-            choices = []
-            data = []
-            for vals in iterator():
-                if arg_check.is_tuple(vals, size=2, raise_error=False):
-                    choices.append(vals[0])
-                    data.append(vals[1])
-                else:
-                    choices.append(vals)
-                    data.append(vals)
+            # Get the new choices and data (in a safe way).
+            try:
+                choices = []
+                data = []
+                for vals in iterator():
+                    if arg_check.is_tuple(vals, size=2, raise_error=False):
+                        choices.append(vals[0])
+                        data.append(vals[1])
+                    else:
+                        choices.append(vals)
+                        data.append(vals)
+
+            # Catch all RelaxErrors.
+            except AllRelaxErrors, instance:
+                # Display a dialog with the error.
+                gui_raise(instance)
+
+                # Return as a failure.
+                return False
 
             # Reset.
             self.ResetChoices(name, combo_choices=choices, combo_data=data)




Related Messages


Powered by MHonArc, Updated Wed May 09 15:20:02 2012