1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """The method saveframe category.
24
25 This file is part of the U{BMRB library<https://sourceforge.net/projects/bmrblib>}.
26
27 For example, see http://www.bmrb.wisc.edu/dictionary/3.1html_frame/frame_SaveFramePage.html#method
28 """
29
30
31 from bmrblib.base_classes import BaseSaveframe, TagCategory, TagCategoryFree
32
33
35 """The method saveframe class."""
36
37
38 sf_label = 'method'
39
48
49
50
52 """Base class for the Method tag category."""
53
55 """Setup the Method tag category.
56
57 @param sf: The saveframe object.
58 @type sf: saveframe instance
59 """
60
61
62 super(Method, self).__init__(sf)
63
64
65 self.add(key='MethodID', tag_name='ID', var_name='count_str')
66 self.add(key='Details', tag_name='Details', var_name='details')
67
68
69
71 """Base class for the MethodCitation tag category."""
72
74 """Setup the MethodCitation tag category.
75
76 @param sf: The saveframe object.
77 @type sf: saveframe instance
78 """
79
80
81 super(MethodCitation, self).__init__(sf)
82
83
84 self.add(key='CitationID', tag_name='Citation_ID', var_name='cite_ids')
85 self.add(key='MethodID', tag_name='Method_ID', var_name='count_str')
86
87
89 """Check if the citation tag category is empty.
90
91 @return: The state of emptiness.
92 @rtype: bool
93 """
94
95
96 if not hasattr(self.sf, 'cite_ids') or not len(self.sf.cite_ids):
97 return True
98
99
100 return False
101
102
104 """Base class for the MethodFile tag category."""
105
107 """Setup the MethodFile tag category.
108
109 @param sf: The saveframe object.
110 @type sf: saveframe instance
111 """
112
113
114 super(MethodFile, self).__init__(sf)
115
116
117 self.add(key='Name', tag_name='Name', var_name='file_name', missing=False)
118 self.add(key='TextFormat', tag_name='Text_format', var_name='text_format')
119 self.add(key='Text', tag_name='Text', var_name='file_text', missing=False)
120 self.add(key='MethodID', tag_name='Method_ID', var_name='count_str')
121
122
123
125 """Base class for the MethodParam tag category."""
126
128 """Setup the MethodParam tag category.
129
130 @param sf: The saveframe object.
131 @type sf: saveframe instance
132 """
133
134
135 super(MethodParam, self).__init__(sf)
136
137
138 self.add(key='FileName', tag_name='File_name', var_name='param_file_name')
139 self.add(key='TextFormat', tag_name='Text_format', var_name='text_format')
140 self.add(key='Text', tag_name='Text', var_name='param_file_text')
141 self.add(key='MethodID', tag_name='Method_ID', var_name='count_str')
142