Package gui :: Package components :: Module citations
[hide private]
[frames] | no frames]

Source Code for Module gui.components.citations

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2009-2011 Michael Bieri                                       # 
 4  # Copyright (C) 2010-2012 Edward d'Auvergne                                   # 
 5  #                                                                             # 
 6  # This file is part of the program relax.                                     # 
 7  #                                                                             # 
 8  # relax is free software; you can redistribute it and/or modify               # 
 9  # it under the terms of the GNU General Public License as published by        # 
10  # the Free Software Foundation; either version 2 of the License, or           # 
11  # (at your option) any later version.                                         # 
12  #                                                                             # 
13  # relax is distributed in the hope that it will be useful,                    # 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
16  # GNU General Public License for more details.                                # 
17  #                                                                             # 
18  # You should have received a copy of the GNU General Public License           # 
19  # along with relax; if not, write to the Free Software                        # 
20  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
21  #                                                                             # 
22  ############################################################################### 
23   
24  # Module docstring. 
25  """Module containing the citations GUI element for listing the citations relevant for the analysis.""" 
26   
27  # relax module imports. 
28  from graphics import fetch_icon 
29   
30  # relax GUI module imports. 
31  from gui.components.base_list import Base_list 
32  from gui.string_conv import str_to_gui 
33  from gui.uf_objects import Uf_storage; uf_store = Uf_storage() 
34   
35   
36 -class Citations(Base_list):
37 """The GUI element for listing the citations relevant for the analysis.""" 38
39 - def action_bmrb_citation(self, event):
40 """Launch the bmrb.citation user function. 41 42 @param event: The wx event. 43 @type event: wx event 44 """ 45 46 # Launch the dialog. 47 uf_store['bmrb.citation'](wx_parent=self.parent)
48 49
50 - def setup(self):
51 """Override the base variables.""" 52 53 # GUI variables. 54 self.title = "Citations" 55 self.observer_base_name = "citations" 56 self.button_placement = 'bottom' 57 58 # The column titles. 59 self.columns = [ 60 "Citation ID" 61 ] 62 63 # Button set up. 64 self.button_info = [ 65 { 66 'object': 'button_add', 67 'label': ' Add', 68 'icon': fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"), 69 'method': self.action_bmrb_citation, 70 'tooltip': "Specify a citation to be added the BMRB data file." 71 } 72 ]
73 74
75 - def update_data(self):
76 """Method called from self.build_element_safe() to update the list data.""" 77 78 # Expand the number of rows to match the number of entries, and add the data. 79 n = 0 80 if hasattr(cdp, 'exp_info') and hasattr(cdp.exp_info, 'citations'): 81 n = len(cdp.exp_info.citations) 82 for i in range(n): 83 # Set the citation ID. 84 self.element.InsertStringItem(i, str_to_gui(cdp.exp_info.citations[i].cite_id))
85