mailr14759 - /1.3/gui/errors.py


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

Header


Content

Posted by edward on September 26, 2011 - 17:46:
Author: bugman
Date: Mon Sep 26 17:46:15 2011
New Revision: 14759

URL: http://svn.gna.org/viewcvs/relax?rev=14759&view=rev
Log:
Redesigned the gui_raise() function so that it is more user friendly.

The relax controller window with error message is shown first, followed by 
the modal RelaxError
message dialog on top of all other windows.


Modified:
    1.3/gui/errors.py

Modified: 1.3/gui/errors.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/errors.py?rev=14759&r1=14758&r2=14759&view=diff
==============================================================================
--- 1.3/gui/errors.py (original)
+++ 1.3/gui/errors.py Mon Sep 26 17:46:15 2011
@@ -41,19 +41,25 @@
     @raises RelaxError:     This raises all RelaxErrors, if the raise flag 
is given.
     """
 
-    # Show a dialog explaining the error.
-    if status.show_gui:
-        wx.MessageBox(relax_error.text, caption="RelaxError", 
style=wx.OK|wx.ICON_ERROR)
-
     # Turn off the busy cursor if needed.
     if wx.IsBusy():
         wx.EndBusyCursor()
 
+    # Non-fatal - the error is not raised so just send the text to STDERR.
+    if not raise_flag:
+        sys.stderr.write(relax_error.__str__())
+        sys.stderr.write("\n")
+
+    # Show the relax controller (so that the window doesn't hide the dialog).
+    app = wx.GetApp()
+    app.gui.show_controller(None)
+    wx.SafeYield(None, True)
+
+    # Show a dialog explaining the error.
+    dlg = wx.MessageDialog(None, relax_error.text, caption="RelaxError", 
style=wx.OK|wx.ICON_ERROR)
+    if status.show_gui:
+        dlg.ShowModal()
+
     # Throw the error to terminate execution.
     if raise_flag:
         raise relax_error
-
-    # Otherwise, send the text to STDERR.
-    else:
-        sys.stderr.write(relax_error.__str__())
-        sys.stderr.write("\n")




Related Messages


Powered by MHonArc, Updated Mon Sep 26 18:40:02 2011