mailRe: r10897 - /branches/bieri_gui/gui_bieri/analyses/auto_noe.py


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

Header


Content

Posted by Edward d'Auvergne on February 24, 2010 - 18:47:
Hi,

You might be able to make all these text input fields stretchable so
that in the future, the GUI can be resized.  I would suggest a cleaner
alternative for this change.  Rather than having both
add_reference_peak_list() and add_saturated_peak_list(), these could
be combined into add_peak_list().  I would actually highly recommend
that this converted into the Peak_intensity_single class in
gui_bieri.components.spectrum.  This class __init__() method can
perform the action of the add_*_peak_list() methods - no other methods
are needed.  The key here would be that the __init__() method returns
the text input field.  And you pass the name into the class.  So the
line:

self.add_saturated_peak_list(box)

in build_right_box() would be replaced by:

self.field_sat_noe = Peak_intensity_single(box=box, label="Saturated
NOE peak list")

The rest of the code is the same in add_reference_peak_list() and
add_saturated_peak_list(), so nothing else needs to be passed into the
class.  This is a very simple exercise for you to practice both the
spinning out of isolated GUI elements into gui_bieri.components and in
code re-usage.  Another benefit is that if you change this GUI element
in the future, with one change, both parts of the NOE frame will
instantly see the improvement.

Cheers,

Edward



On 24 February 2010 06:01,  <michael.bieri@xxxxxx> wrote:
Author: michaelbieri
Date: Wed Feb 24 06:01:39 2010
New Revision: 10897

URL: http://svn.gna.org/viewcvs/relax?rev=10897&view=rev
Log:
New function for the GUI element for choosing saturated NOE peaklists was 
added.


Modified:
   branches/bieri_gui/gui_bieri/analyses/auto_noe.py

Modified: branches/bieri_gui/gui_bieri/analyses/auto_noe.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/analyses/auto_noe.py?rev=10897&r1=10896&r2=10897&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/analyses/auto_noe.py (original)
+++ branches/bieri_gui/gui_bieri/analyses/auto_noe.py Wed Feb 24 06:01:39 
2010
@@ -233,6 +233,36 @@
        box.Add(sizer, 0, wx.EXPAND|wx.SHAPED, 0)


+    def add_saturated_peak_list(self, box):
+        """Create and add the saturated file selection GUI element to the 
given box.
+
+        @param box:     The box element to pack the structure file 
selection GUI element into.
+        @type box:      wx.BoxSizer instance
+        """
+
+        # Horizontal packing for this element.
+        sizer = wx.BoxSizer(wx.HORIZONTAL)
+
+        # The label.
+        label = wx.StaticText(self.parent, -1, "Saturated NOE peak list:", 
style=wx.ALIGN_RIGHT)
+        label.SetMinSize((230, 17))
+        sizer.Add(label, 0, 
wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
+
+        # The text input field.
+        self.field_sat_noe = wx.TextCtrl(self.parent, -1, 
self.data.sat_file)
+        self.field_sat_noe.SetMinSize((350, 27))
+        sizer.Add(self.field_sat_noe, 0, 
wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
+
+        # The button.
+        button = wx.Button(self.parent, -1, "Change")
+        button.SetMinSize((103, 27))
+        self.gui.Bind(wx.EVT_BUTTON, self.sat_file, button)
+        sizer.Add(button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 
10)
+
+        # Add the element to the box.
+        box.Add(sizer, 0, wx.EXPAND|wx.SHAPED, 0)
+
+
    def add_structure_selection(self, box):
        """Create and add the structure file selection GUI element to the 
given box.



_______________________________________________
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 Wed Feb 24 19:00:16 2010