mailRe: Box layouts.


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 - 10:16:
Hi,

Unfortunately Australia day is not a holiday in Deutschland - not even
in Bayern!  If you carefully study the code changes I have made, that
would be a quick crash course on how to program.  My programming
abilities are theoretically not the best as I learnt coding in the
same way as you now are, though they are very practical and get the
job done cleanly.  From the variable name duplication, and also the
massive code block duplications, it was clear that this was a result
of a large expansion from a small starting point into one large blob
of code.

If you look at what I have done with the model-free code, you'll see
how I have separated this out from the rest of relax_gui.py.  The same
should be done with the other analyses.  Then there would be a single
module for the NOE, eliminating the 3 times duplicated code base (the
same with R1 and R2).  From relax_gui, you pass in 'self' into the
analysis class __init__() methods and store this as 'self.gui'.  If
necessary for communication within the GUI, the analysis classes can
be stored in 'self.analyses' (accessible as 'self.gui.analyses' in the
other analysis classes).

I still have to look into creating some base classes for basic GUI
elements that can then be inherited (i.e. 'class
Auto_model_free(Base_class):').  Or converting entire blocks of a
frame into a different class - this allows the methods bound to GUI
events (like model_*() in auto_model_free) to be written once and then
used everywhere.  The point of breaking the code into blocks of
methods or classes is that building the GUI then becomes like playing
with lego.  With all the analyses in relax_gui.py, this was more like
a sculpture you made out of clay.  But if we convert this to lego
form, then a block needs to be only written once and reused
everywhere.  In the end, radical redesigns of the GUI layout simply
require a few line changes in the top level block!

Regards,

Edward




2010/1/26 Michael Bieri <michael.bieri@xxxxxx>:
Hi Edward

I am just back from the prolonged Australia day weekend. You obviously
worked hard on the GUI, so let me reorientated in the code.

I will rename all the copy_copy... elements into logical naming (these are
all from the beginning, where I was quite fresh in programming).

I will also have a look at the modelfree calculation, but I think the GUI
needs an owns script, as we need a feedback to the GUI elements during
calculations, which is not necessary for the other UIs. But maybe you
already made them separate.

I will have some time today to understand the new structure you've created
and give some feedbacks later.

Cheers
Michael

Edward d'Auvergne schrieb:

Hi Michael,

I am in the process of trying to fix the automatic model-free protocol
execution in the GUI.  I have successfully spun out all of this code
into its own module, gui_bieri.auto_analyses.auto_model_free.  I will
now try to shift each model-free GUI out into separate functions, and
thereby eliminate names such as
'results_dir_copy_copy_copy_copy_copy_1_copy' which I am totally lost
with!  These functions will return the elements they create so that
they can be placed in the box layout that you have defined in the
sizer_* objects.  For me to get this back into order, would you be
able to describe - maybe with an SVG diagram to include with the code
- of your box layout for the different frames?

Also note that the automatic protocol code from full_analysis.py that
was duplicated has been deleted!  I shifted the code from the
full_analysis.py script into the relax module
auto_analyses.dauvergne_protocol.  Both the full_analysis.py script
and the model-free GUI now uses this code, although not all the data
is sent in (the web interface will eventually also use this).  This is
why I am hacking apart your model-free GUI code, to be able to
understand and obtain all the data we need to send into the
dAuvergne_protocol class.  I would highly recommend that you perform
similar code clean ups for the rest of the GUI - one module per
analysis frame.  Just watch what I am doing for ideas.

Cheers,

Edward

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

This is the relax-devel mailing list
relax-devel@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-devel






Related Messages


Powered by MHonArc, Updated Wed Jan 27 11:40:20 2010