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

Source Code for Module gui.user_functions.bmrb

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 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 BMRB user function GUI elements.""" 
 25   
 26  # Python module imports. 
 27  import wx 
 28   
 29  # GUI module imports. 
 30  from base import UF_base, UF_page 
 31  from gui.paths import WIZARD_IMAGE_PATH 
 32  from gui.misc import gui_to_float, gui_to_int, gui_to_str, str_to_gui 
 33   
 34   
 35  # The container class. 
36 -class Bmrb(UF_base):
37 """The container class for holding all GUI elements.""" 38
39 - def citation(self):
40 """The bmrb.citation user function.""" 41 42 # Execute the wizard. 43 wizard = self.create_wizard(size_x=1000, size_y=800, name='bmrb.citation', uf_page=Citation_page) 44 wizard.run()
45 46 47
48 -class Citation_page(UF_page):
49 """The bmrb.citation() user function page.""" 50 51 # Some class variables. 52 height_desc = 140 53 image_path = WIZARD_IMAGE_PATH + 'bmrb.png' 54 uf_path = ['bmrb', 'citation'] 55
56 - def add_contents(self, sizer):
57 """Add the specific GUI elements. 58 59 @param sizer: A sizer object. 60 @type sizer: wx.Sizer instance 61 """ 62 63 # The fields. 64 self.element_string(key='cite_id', sizer=sizer, desc="The citation ID:", tooltip=self.uf._doc_args_dict['cite_id']) 65 self.element_string_list_of_lists(key='authors', titles=["First name", "Last name", "First initial", "Middle initials"], sizer=sizer, desc="The author list:", tooltip=self.uf._doc_args_dict['authors']) 66 self.element_string(key='doi', sizer=sizer, desc="The DOI number:", tooltip=self.uf._doc_args_dict['doi']) 67 self.element_string(key='pubmed_id', sizer=sizer, desc="The Pubmed ID number:", tooltip=self.uf._doc_args_dict['pubmed_id']) 68 self.element_string(key='full_citation', sizer=sizer, desc="The full citation:", tooltip=self.uf._doc_args_dict['full_citation']) 69 self.element_string(key='title', sizer=sizer, desc="The title:", tooltip=self.uf._doc_args_dict['title']) 70 self.element_string(key='status', sizer=sizer, desc="The status:", tooltip=self.uf._doc_args_dict['status']) 71 self.element_string(key='type', sizer=sizer, desc="The type:", tooltip=self.uf._doc_args_dict['type']) 72 self.element_string(key='journal_abbrev', sizer=sizer, desc="The journal abbreviation:", tooltip=self.uf._doc_args_dict['journal_abbrev']) 73 self.element_string(key='journal_full', sizer=sizer, desc="The full journal name:", tooltip=self.uf._doc_args_dict['journal_full']) 74 self.element_int(key='volume', sizer=sizer, desc="The volume:", tooltip=self.uf._doc_args_dict['volume']) 75 self.element_int(key='issue', sizer=sizer, desc="The issue:", tooltip=self.uf._doc_args_dict['issue']) 76 self.element_int(key='page_first', sizer=sizer, desc="The first page:", tooltip=self.uf._doc_args_dict['page_first']) 77 self.element_int(key='page_last', sizer=sizer, desc="The last page:", tooltip=self.uf._doc_args_dict['page_last']) 78 self.element_int(key='year', sizer=sizer, desc="The year:", tooltip=self.uf._doc_args_dict['year'])
79 80
81 - def on_execute(self):
82 """Execute the user function.""" 83 84 # The data. 85 cite_id = self.GetValue('cite_id') 86 authors = self.GetValue('authors') 87 doi = self.GetValue('doi') 88 pubmed_id = self.GetValue('pubmed_id') 89 full_citation = self.GetValue('full_citation') 90 title = self.GetValue('title') 91 status = self.GetValue('status') 92 type = self.GetValue('type') 93 journal_abbrev = self.GetValue('journal_abbrev') 94 journal_full = self.GetValue('journal_full') 95 volume = self.GetValue('volume') 96 issue = self.GetValue('issue') 97 page_first = self.GetValue('page_first') 98 page_last = self.GetValue('page_last') 99 year = self.GetValue('year') 100 101 # Execute the user function. 102 self.execute('bmrb.citation', cite_id=cite_id, authors=authors, doi=doi, pubmed_id=pubmed_id, full_citation=full_citation, title=title, status=status, type=type, journal_abbrev=journal_abbrev, journal_full=journal_full, volume=volume, issue=issue, page_first=page_first, page_last=page_last, year=year)
103