mailCore changes to the GUI internals (Re: r10439 - /branches/bieri_gui/gui_bieri/relax_gui.py)


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

Header


Content

Posted by Edward d'Auvergne on January 27, 2010 - 16:00:
Hi Michael,

I was just wondering if you are understanding all these changes?
Specifically the one below is very important.  If you have any
questions, please don't hesitate to ask.  What I'm doing at the moment
is integrating the GUI strongly into relax and converting the clay-like
monolithic current design to a more modular lego-like design.  This will
make changing the GUI structure extremely trivial.  And it will allow
for better code re-usage.  Of note of these infrastructural changes is
the modularisation of frames of the automatic analysis protocols, the
relax data store integration, and the use of the compressed relax save
file (state.bz2) rather than the relax GUI save file (save.relaxGUI).

Regards,

Edward



On Wed, 2010-01-27 at 14:50 +0000, edward@xxxxxxxxxxxxx wrote:
Author: bugman
Date: Wed Jan 27 15:50:12 2010
New Revision: 10439

URL: http://svn.gna.org/viewcvs/relax?rev=10439&view=rev
Log:
Added the initial code for data synchronisation between the GUI and the 
relax data store.

The state_load() and state_save() methods now call the new sync_ds() method 
of the main GUI class,
as well as sync_ds() methods for each analysis type.

The analysis specific synchronisation is performed as follows.  There will 
be a list in the main
class called self.analysis_frames.  This list will contain all the analysis 
frame objects open in
the GUI.  Each analysis type is expected to be a class instance, all 
located in
gui_bieri/auto_analyses/.  As these frames are initialised, they are 
appended to the main GUI
self.analysis_frames list.  Initialisation also creates a container in 
ds.relax_gui.analyses and
this is stored in the analysis class namespace as self.data.

Therefore if the model-free analysis is the 7th analysis opened, from 
within the main relax GUI
class the frame can be reached as:

self.analysis_frames[6]

Its method sync_ds() is reachable as:

self.analysis_frames[6].sync_ds()

The relax data store element for that analysis is reachable as:

ds.relax_gui.analyses[6]

or as an alias as:

self.analysis_frames[6].data

Within the frame instance namespace (in the class), the main GUI object is 
reachable as:

self.gui

This object oriented design will allow easy integration between the main 
window and the analysis
frames, however they may be laid out, and easy integration between analyses 
and the relax data
store.


Modified:
    branches/bieri_gui/gui_bieri/relax_gui.py

Modified: branches/bieri_gui/gui_bieri/relax_gui.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/relax_gui.py?rev=10439&r1=10438&r2=10439&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/relax_gui.py (original)
+++ branches/bieri_gui/gui_bieri/relax_gui.py Wed Jan 27 15:50:12 2010
@@ -2564,13 +2564,30 @@
         # Open the dialog.
         filename = openfile(msg='Select file to open', 
filetype='state.bz2', default='relax save files (*.bz2)|*.bz2|all files 
(*.*)|*.*')
 
-        # A file has been selected.
-        if filename:
-            # Reset the relax data store.
-            reset()
-
-            # Load the relax state.
-            state.load_state(filename)
+        # No file has been selected.
+        if not filename:
+            # Skip the event.
+            event.Skip()
+
+            # Don't do anything.
+            return
+
+        # Reset the relax data store.
+        reset()
+
+        # Load the relax state.
+        state.load_state(filename)
+
+        # Update the core of the GUI to match the new data store.
+        self.sync_ds(upload=False)
+
+        # Build and upload the data to the analysis frames.
+        for i in range(len(ds.relax_gui.analyses)):
+            # Build the frame.
+            analysis = self.create_frame(i)
+
+            # Execute the analysis frame specific update methods.
+            analysis.sync_ds(upload=False)
 
         # Skip the event.
         event.Skip()
@@ -2586,8 +2603,28 @@
         # Open the dialog.
         filename = savefile(msg='Select file to save', 
filetype='state.bz2', default='relax save files (*.bz2)|*.bz2|all files 
(*.*)|*.*')
 
+        # Update the data store to match the GUI.
+        self.sync_ds(upload=True)
+
+        # Analyses updates of the new data store.
+        for i in range(len(self.analysis_frames)):
+            # Execute the analysis frame specific update methods.
+            self.analysis_frames[i].sync_ds(upload=True)
+
         # Save the relax state.
         state.save_state(filename, force=True)
 
         # Skip the event.
         event.Skip()
+
+
+    def sync_ds(self, upload=False):
+        """Synchronise the GUI and the relax data store, both ways.
+
+        This method allows the GUI information to be uploaded into the 
relax data store, or for the information in the relax data store to be 
downloaded by the GUI.
+
+        @keyword upload:    A flag which if True will cause the GUI to 
send data to the relax data store.  If False, data will be downloaded from 
the relax data store to update the GUI.
+        @type upload:       bool
+        """
+
+        # Dummy function (for the time being).


_______________________________________________
relax (http://nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits





Related Messages


Powered by MHonArc, Updated Thu Jan 28 18:40:16 2010