Package bmrblib :: Package experimental_details :: Module software
[hide private]
[frames] | no frames]

Source Code for Module bmrblib.experimental_details.software

  1  ############################################################################# 
  2  #                                                                           # 
  3  # The BMRB library.                                                         # 
  4  #                                                                           # 
  5  # Copyright (C) 2009-2013 Edward d'Auvergne                                 # 
  6  #                                                                           # 
  7  # This program 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 3 of the License, or         # 
 10  # (at your option) any later version.                                       # 
 11  #                                                                           # 
 12  # This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.     # 
 19  #                                                                           # 
 20  ############################################################################# 
 21   
 22  # Module docstring. 
 23  """The software saveframe category. 
 24   
 25  This file is part of the U{BMRB library<https://gna.org/projects/bmrblib>}. 
 26   
 27  For example, see http://www.bmrb.wisc.edu/dictionary/3.1html_frame/frame_SaveFramePage.html#software 
 28  """ 
 29   
 30  # relax module imports. 
 31  from bmrblib.base_classes import BaseSaveframe, TagCategory, TagCategoryFree 
 32   
 33   
34 -class SoftwareSaveframe(BaseSaveframe):
35 """The software saveframe class.""" 36 37 # Class variables. 38 sf_label = 'software' 39
40 - def add_tag_categories(self):
41 """Create the tag categories.""" 42 43 # The tag category objects. 44 self.tag_categories.append(Software(self)) 45 self.tag_categories.append(SoftwareCitation(self)) 46 self.tag_categories.append(Task(self)) 47 self.tag_categories.append(Vendor(self))
48 49
50 - def create_title(self):
51 """Create a special software saveframe title. 52 53 @return: The title. 54 @rtype: str 55 """ 56 57 return self.name.lower() + '_' + self.sf_label + '_' + self.count_str
58 59
60 -class Software(TagCategoryFree):
61 """Base class for the Software tag category.""" 62
63 - def __init__(self, sf):
64 """Setup the Software tag category. 65 66 @param sf: The saveframe object. 67 @type sf: saveframe instance 68 """ 69 70 # Initialise the baseclass. 71 super(Software, self).__init__(sf) 72 73 # Add the tag info. 74 self.add(key='SoftwareID', tag_name='ID', var_name='count_str') 75 self.add(key='Name', tag_name='Name', var_name='name') 76 self.add(key='Version', tag_name='Version', var_name='version')
77 78 79
80 -class SoftwareCitation(TagCategory):
81 """Base class for the SoftwareCitation tag category.""" 82 83
84 - def __init__(self, sf):
85 """Setup the SoftwareCitation tag category. 86 87 @param sf: The saveframe object. 88 @type sf: saveframe instance 89 """ 90 91 # Initialise the baseclass. 92 super(SoftwareCitation, self).__init__(sf) 93 94 # Add the tag info. 95 self.add(key='CitationID', tag_name='Citation_ID', var_name='cite_ids') 96 self.add(key='SoftwareID', tag_name='Software_ID', var_name='count_str')
97 98 99
100 -class Task(TagCategory):
101 """Base class for the Task tag category.""" 102
103 - def __init__(self, sf):
104 """Setup the Task tag category. 105 106 @param sf: The saveframe object. 107 @type sf: saveframe instance 108 """ 109 110 # Initialise the baseclass. 111 super(Task, self).__init__(sf) 112 113 # Add the tag info. 114 self.add(key='Task', tag_name='Task', var_name='task') 115 self.add(key='SoftwareID', tag_name='Software_ID', var_name='count_str')
116 117 118
119 -class Vendor(TagCategory):
120 """Base class for the Vendor tag category.""" 121
122 - def __init__(self, sf):
123 """Setup the Vendor tag category. 124 125 @param sf: The saveframe object. 126 @type sf: saveframe instance 127 """ 128 129 # Initialise the baseclass. 130 super(Vendor, self).__init__(sf) 131 132 # Add the tag info. 133 self.add(key='Name', tag_name='Name', var_name='vendor_name') 134 self.add(key='Address', tag_name='Address', var_name='vendor_address') 135 self.add(key='ElectronicAddress', tag_name='Electronic_address', var_name='vendor_eaddress') 136 self.add(key='SoftwareID', tag_name='SoftwareID', var_name='count_str')
137