mailr16755 - in /branches/uf_redesign: gui/__init__.py gui/relax_gui.py relax.py


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

Header


Content

Posted by edward on June 08, 2012 - 12:08:
Author: bugman
Date: Fri Jun  8 12:08:39 2012
New Revision: 16755

URL: http://svn.gna.org/viewcvs/relax?rev=16755&view=rev
Log:
Bug fix for running a script when launching the GUI.

This was completely failing.  Now the script is executed prior to the 
launching of the GUI.


Modified:
    branches/uf_redesign/gui/__init__.py
    branches/uf_redesign/gui/relax_gui.py
    branches/uf_redesign/relax.py

Modified: branches/uf_redesign/gui/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/__init__.py?rev=16755&r1=16754&r2=16755&view=diff
==============================================================================
--- branches/uf_redesign/gui/__init__.py (original)
+++ branches/uf_redesign/gui/__init__.py Fri Jun  8 12:08:39 2012
@@ -36,12 +36,14 @@
     import wx
 
 # relax module imports.
+from generic_fns.script import script
+from graphics import IMAGE_PATH
 from relax_errors import RelaxError
 from relax_gui import Main
 from status import Status; status = Status()
 
 # relax GUI module imports.
-from paths import IMAGE_PATH
+from gui.uf_objects import Uf_storage; uf_store = Uf_storage()
 
 
 __all__ = ['about',
@@ -69,7 +71,7 @@
 class App(wx.App):
     """The relax GUI wx application."""
 
-    def __init__(self, script=None, redirect=False, filename=None, 
useBestVisual=False, clearSigInt=True):
+    def __init__(self, script_file=None, redirect=False, filename=None, 
useBestVisual=False, clearSigInt=True):
         """Initialise the wx.App.
 
         @keyword redirect:      Should sys.stdout and sys.stderr be 
redirected? Defaults to True on Windows and Mac, False otherwise. If filename 
is None then output will be redirected to a window that pops up as needed. 
(You can control what kind of window is created for the output by resetting 
the class variable outputWindowClass to a class of your choosing.)
@@ -80,25 +82,26 @@
         @type useBestVisual:    bool
         @keyword clearSigInt:   Should SIGINT be cleared? This allows the 
app to terminate upon a Ctrl-C in the console like other GUI apps will.
         @type clearSigInt:      bool
-        @keyword script:        The path of a relax script to execute.
-        @type script:           str
+        @keyword script_file:   The path of a relax script to execute.
+        @type script_file:      str
         """
 
-        # Store the script.
-        self.script = script
+        # First run the script before the GUI is built.
+        if script_file:
+            script(script_file)
 
         # Execute the base class method.
         super(App, self).__init__(redirect=redirect, filename=filename, 
useBestVisual=useBestVisual, clearSigInt=clearSigInt)
 
 
-    def OnInit(self, script_file=None):
+    def OnInit(self):
         """Build the application, showing a splash screen first."""
 
         # Show the splash screen.
         self.show_splash()
 
         # Build the GUI.
-        self.gui = Main(parent=None, id=-1, title="", script=self.script)
+        self.gui = Main(parent=None, id=-1, title="")
 
         # Make it the main application component.
         self.SetTopWindow(self.gui)

Modified: branches/uf_redesign/gui/relax_gui.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/relax_gui.py?rev=16755&r1=16754&r2=16755&view=diff
==============================================================================
--- branches/uf_redesign/gui/relax_gui.py (original)
+++ branches/uf_redesign/gui/relax_gui.py Fri Jun  8 12:08:39 2012
@@ -58,7 +58,7 @@
 from gui.interpreter import Interpreter
 from gui.menu import Menu
 from gui.message import error_message, Question
-from gui.misc import open_file, protected_exec
+from gui.misc import gui_raise, open_file, protected_exec
 from gui import paths
 from gui.pipe_editor import Pipe_editor
 from gui.references import References
@@ -76,7 +76,7 @@
     min_width = 1000
     min_height = 600
 
-    def __init__(self, parent=None, id=-1, title="", script=None):
+    def __init__(self, parent=None, id=-1, title=""):
         """Initialise the main relax GUI frame."""
 
         # Store the wxPython info for os/machine/version specific hacks.
@@ -170,10 +170,6 @@
         status.observers.result_file.register('gui', 
self.show_results_viewer_no_warn)
         status.observers.exec_lock.register('gui', self.enable)
 
-        # Run a script.
-        if script:
-            wx.CallAfter(uf_store['script'](script))
-
 
     def about_gui(self, event=None):
         """The about message for the relax GUI.

Modified: branches/uf_redesign/relax.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/relax.py?rev=16755&r1=16754&r2=16755&view=diff
==============================================================================
--- branches/uf_redesign/relax.py (original)
+++ branches/uf_redesign/relax.py Fri Jun  8 12:08:39 2012
@@ -196,7 +196,7 @@
             status.show_gui = True
 
             # Start the relax GUI wx application.
-            app = gui.App(script=self.script_file)
+            app = gui.App(script_file=self.script_file)
             app.MainLoop()
 
         # Execute the relax test suite




Related Messages


Powered by MHonArc, Updated Fri Jun 08 12:40:01 2012