Package gui :: Package user_functions :: Module bruker
[hide private]
[frames] | no frames]

Source Code for Module gui.user_functions.bruker

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2010-2012 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax is free software; you can redistribute it and/or modify               # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation; either version 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax is distributed in the hope that it will be useful,                    # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Module docstring. 
24  """The Bruker Dynamics Center user function GUI elements.""" 
25   
26  # Python module imports. 
27  from string import split 
28  import wx 
29   
30  # relax module imports. 
31  from generic_fns import pipes 
32   
33  # GUI module imports. 
34  from base import UF_base, UF_page 
35  from gui.paths import WIZARD_IMAGE_PATH 
36  from gui.misc import gui_to_float, gui_to_int, gui_to_str, str_to_gui 
37   
38   
39  # The container class. 
40 -class Bruker(UF_base):
41 """The container class for holding all GUI elements.""" 42
43 - def read(self):
44 """The bruker.read user function.""" 45 46 # Execute the wizard. 47 wizard = self.create_wizard(size_x=800, size_y=500, name='bruker.read', uf_page=Read_page) 48 wizard.run()
49 50 51
52 -class Read_page(UF_page):
53 """The bruker.read() user function page.""" 54 55 # Some class variables. 56 height_desc = 140 57 image_path = WIZARD_IMAGE_PATH + 'bruker.png' 58 uf_path = ['bruker', 'read'] 59
60 - def add_contents(self, sizer):
61 """Add the Bruker Dynamics Center reading specific GUI elements. 62 63 @param sizer: A sizer object. 64 @type sizer: wx.Sizer instance 65 """ 66 67 # Add a file selection. 68 self.file = self.file_selection(sizer, "The Bruker Dynamics Center file:", message="Bruker Dynamics Center file selection", style=wx.FD_OPEN, tooltip=self.uf._doc_args_dict['file']) 69 70 # The labels. 71 self.ri_id = self.input_field(sizer, "The relaxation data ID:", tooltip=self.uf._doc_args_dict['ri_id'])
72 73
74 - def on_execute(self):
75 """Execute the user function.""" 76 77 # The labels and frq. 78 ri_id = gui_to_str(self.ri_id.GetValue()) 79 80 # The file name. 81 file = gui_to_str(self.file.GetValue()) 82 83 # No file. 84 if not file: 85 return 86 87 # Read the Bruker data. 88 self.execute('bruker.read', ri_id=ri_id, file=file)
89