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