Very nicely designed! This will allow maximal flexibility in changing and expanding this frame in the future!
Cheers, Edward On 22 April 2010 09:08, <[email protected]> wrote: > Author: michaelbieri > Date: Thu Apr 22 09:08:04 2010 > New Revision: 11123 > > URL: http://svn.gna.org/viewcvs/relax?rev=11123&view=rev > Log: > Frame to display generated results is created. > > Modified: > branches/bieri_gui/gui_bieri/analyses/results.py > > Modified: branches/bieri_gui/gui_bieri/analyses/results.py > URL: > http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/analyses/results.py?rev=11123&r1=11122&r2=11123&view=diff > ============================================================================== > --- branches/bieri_gui/gui_bieri/analyses/results.py (original) > +++ branches/bieri_gui/gui_bieri/analyses/results.py Thu Apr 22 09:08:04 2010 > @@ -1,0 +1,201 @@ > +############################################################################### > +# > # > +# Copyright (C) 2010 Michael Bieri > # > +# > # > +# This file is part of the program relax. > # > +# > # > +# relax is free software; you can redistribute it and/or modify > # > +# it under the terms of the GNU General Public License as published by > # > +# the Free Software Foundation; either version 2 of the License, or > # > +# (at your option) any later version. > # > +# > # > +# relax is distributed in the hope that it will be useful, > # > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > # > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > # > +# GNU General Public License for more details. > # > +# > # > +# You should have received a copy of the GNU General Public License > # > +# along with relax; if not, write to the Free Software > # > +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > # > +# > # > +############################################################################### > + > +# Module docstring. > +"""Module containing the base class for the results frame.""" > + > +# Python module imports. > +from os import sep > +import sys > +import wx > + > +# relax module imports. > +from data import Relax_data_store; ds = Relax_data_store() > + > +# relaxGUI module imports. > +from gui_bieri.paths import IMAGE_PATH > + > + > + > +class Results_summary: > + """The base class for the noe frames.""" > + > + def __init__(self, gui, notebook): > + """Build the results frame. > + > + �...@param gui: The main GUI class. > + �...@type gui: gui_bieri.relax_gui.Main instance > + �...@param notebook: The notebook to pack this frame into. > + �...@type notebook: wx.Notebook instance > + """ > + > + # Store the main class. > + self.gui = gui > + > + # Synchronize results. > + self.sync_results() > + > + # The parent GUI element for this class. > + self.parent = notebook > + > + # Build and pack the main sizer box. > + main_box = self.build_results_box() > + self.parent.SetSizer(main_box) > + > + # Set the frame font size. > + self.parent.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, > "")) > + > + > + def add_model_free_results(self, box): > + """Function to pack rx results.""" > + > + # Use a vertical packing of elements. > + sizer = wx.BoxSizer(wx.VERTICAL) > + > + # Add Title. > + title = wx.StaticText(self.parent, -1, "\nModel-Free Results:", > style=wx.ALIGN_RIGHT) > + sizer.Add(title, 0, > wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) > + > + # Selection to open. > + sizer1 = wx.BoxSizer(wx.HORIZONTAL) > + > + # Add results list box. > + self.gui.list_modelfree = wx.ListBox(self.parent, -1, choices=[]) > + self.gui.list_modelfree.SetMinSize((800, 130)) > + sizer1.Add(self.gui.list_modelfree, 0, wx.EXPAND, 0) > + > + # Add open button. > + button_modelfree = wx.Button(self.parent, -1, "Open") > + button_modelfree.SetMinSize((103, 27)) > + self.gui.Bind(wx.EVT_BUTTON, self.gui.open_model_results_exe, > button_modelfree) > + sizer1.Add(button_modelfree, 0, wx.LEFT, 5) > + > + # Add selection. > + sizer.Add(sizer1, 0, wx.EXPAND, 0) > + > + # Add the element to the box. > + box.Add(sizer, 0, wx.EXPAND|wx.SHAPED, 0) > + > + > + def add_noe_results(self, box): > + """Function to pack noe results.""" > + > + # Use a vertical packing of elements. > + sizer = wx.BoxSizer(wx.VERTICAL) > + > + # Add Title. > + title = wx.StaticText(self.parent, -1, "steady-state NOE Results:", > style=wx.ALIGN_RIGHT) > + sizer.Add(title, 0, > wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) > + > + # Selection to open. > + sizer1 = wx.BoxSizer(wx.HORIZONTAL) > + > + # Add results list box. > + self.gui.list_noe = wx.ListBox(self.parent, -1, choices=[]) > + self.gui.list_noe.SetMinSize((800, 130)) > + sizer1.Add(self.gui.list_noe, 0, wx.EXPAND, 0) > + > + # Add open button. > + button_noe = wx.Button(self.parent, -1, "Open") > + button_noe.SetMinSize((103, 27)) > + self.gui.Bind(wx.EVT_BUTTON, self.gui.open_noe_results_exe, > button_noe) > + sizer1.Add(button_noe, 0, wx.LEFT, 5) > + > + # Add selection. > + sizer.Add(sizer1, 0, wx.EXPAND, 0) > + > + # Add the element to the box. > + box.Add(sizer, 0, wx.EXPAND|wx.SHAPED, 0) > + > + > + def add_rx_results(self, box): > + """Function to pack rx results.""" > + > + # Use a vertical packing of elements. > + sizer = wx.BoxSizer(wx.VERTICAL) > + > + # Add Title. > + title = wx.StaticText(self.parent, -1, "\nRelaxation Results:", > style=wx.ALIGN_RIGHT) > + sizer.Add(title, 0, > wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) > + > + # Selection to open. > + sizer1 = wx.BoxSizer(wx.HORIZONTAL) > + > + # Add results list box. > + self.gui.list_rx = wx.ListBox(self.parent, -1, choices=[]) > + self.gui.list_rx.SetMinSize((800, 130)) > + sizer1.Add(self.gui.list_rx, 0, wx.EXPAND, 0) > + > + # Add open button. > + button_rx = wx.Button(self.parent, -1, "Open") > + button_rx.SetMinSize((103, 27)) > + self.gui.Bind(wx.EVT_BUTTON, self.gui.open_rx_results_exe, button_rx) > + sizer1.Add(button_rx, 0, wx.LEFT, 5) > + > + # Add selection. > + sizer.Add(sizer1, 0, wx.EXPAND, 0) > + > + > + # Add the element to the box. > + box.Add(sizer, 0, wx.EXPAND|wx.SHAPED, 0) > + > + > + def build_results_box(self): > + """Function to pack results frame.""" > + > + # Use a vertical packing of elements. > + box = wx.BoxSizer(wx.VERTICAL) > + > + # Add the title. > + self.add_title(box) > + > + # Add Noe results. > + self.add_noe_results(box) > + > + # Add rx results. > + self.add_rx_results(box) > + > + # Add model-free results. > + self.add_model_free_results(box) > + > + return box > + > + def sync_results(self): > + """Function to synchronize results with relax data storage""" > + > + # load results from data store. > + self.results_noe = ds.relax_gui.results_noe > + self.results_rx = ds.relax_gui.results_rx > + self.results_modelfree = ds.relax_gui.results_model_free > + > + > + def add_title(self, box): > + """Create and add the frame title to the given box.""" > + > + # The title. > + label = wx.StaticText(self.parent, -1, "Results:") > + > + # The font properties. > + label.SetFont(wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, > "Sans")) > + > + # Pack the title. > + box.Add(label, 0, wx.BOTTOM|wx.ADJUST_MINSIZE, 18) > > > _______________________________________________ > relax (http://nmr-relax.com) > > This is the relax-commits mailing list > [email protected] > > 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 > _______________________________________________ relax (http://nmr-relax.com) This is the relax-devel mailing list [email protected] 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

