diff options
author | David Reyna <David.Reyna@windriver.com> | 2014-02-28 05:55:46 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-09 12:24:01 -0700 |
commit | 4717749fd651e6983a31e3cefe3f210d2646ca87 (patch) | |
tree | 5ba0090617b97f5d49b5c78ee84563a0cab6b7f5 /bitbake/lib/toaster/toastergui/templatetags/projecttags.py | |
parent | 31d4bf8484ee42690386c6b7a6bd6c7a2be54464 (diff) | |
download | poky-4717749fd651e6983a31e3cefe3f210d2646ca87.tar.gz |
bitbake: toaster: implement the configuration pagedreyna/configure-detail-view
Update the configuration page with the file list pop-up, implement the file and description filters.
[YOCTO #4259]
(Bitbake rev: 54a767809960b66b2fe2d3bc46aa9c7e040c4ae3)
Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templatetags/projecttags.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templatetags/projecttags.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index b1e573b16d..857680b350 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py | |||
@@ -129,3 +129,62 @@ def check_filter_status(options, filter): | |||
129 | if filter == option[1]: | 129 | if filter == option[1]: |
130 | return "" | 130 | return "" |
131 | return "checked" | 131 | return "checked" |
132 | |||
133 | @register.filter | ||
134 | def variable_parent_name(value): | ||
135 | """ filter extended variable names to the parent name | ||
136 | """ | ||
137 | value=re.sub('_\$.*', '', value) | ||
138 | return re.sub('_[a-z].*', '', value) | ||
139 | |||
140 | @register.filter | ||
141 | def filter_setin_files(file_list,matchstr): | ||
142 | """ filter/search the 'set in' file lists. Note | ||
143 | that this output is not autoescaped to allow | ||
144 | the <p> marks, but this is safe as the data | ||
145 | is file paths | ||
146 | """ | ||
147 | |||
148 | # no filters, show last file (if any) | ||
149 | if matchstr == ":": | ||
150 | if file_list: | ||
151 | return file_list[len(file_list)-1].file_name | ||
152 | else: | ||
153 | return '' | ||
154 | |||
155 | search, filter = matchstr.partition(':')[::2] | ||
156 | htmlstr="" | ||
157 | # match only filters | ||
158 | if search == '': | ||
159 | for i in range(len(file_list)): | ||
160 | if file_list[i].file_name.find(filter) >= 0: | ||
161 | htmlstr += file_list[i].file_name + "<p>" | ||
162 | return htmlstr | ||
163 | |||
164 | # match only search string, plus always last file | ||
165 | if filter == "": | ||
166 | for i in range(len(file_list)-1): | ||
167 | if file_list[i].file_name.find(search) >= 0: | ||
168 | htmlstr += file_list[i].file_name + "<p>" | ||
169 | htmlstr += file_list[len(file_list)-1].file_name | ||
170 | return htmlstr | ||
171 | |||
172 | # match filter or search string | ||
173 | for i in range(len(file_list)): | ||
174 | if (file_list[i].file_name.find(filter) >= 0) or (file_list[i].file_name.find(search) >= 0): | ||
175 | htmlstr += file_list[i].file_name + "<p>" | ||
176 | return htmlstr | ||
177 | |||
178 | |||
179 | @register.filter | ||
180 | def string_slice(strvar,slicevar): | ||
181 | """ slice a string with |string_slice:'[first]:[last]' | ||
182 | """ | ||
183 | first,last= slicevar.partition(':')[::2] | ||
184 | if first=='': | ||
185 | return strvar[:int(last)] | ||
186 | elif last=='': | ||
187 | return strvar[int(first):] | ||
188 | else: | ||
189 | return strvar[int(first):int(last)] | ||
190 | |||