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 | |
parent | 31d4bf8484ee42690386c6b7a6bd6c7a2be54464 (diff) | |
download | openembedded-core-contrib-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')
-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): if filter == option[1]: return "" return "checked" + +@register.filter +def variable_parent_name(value): + """ filter extended variable names to the parent name + """ + value=re.sub('_\$.*', '', value) + return re.sub('_[a-z].*', '', value) + +@register.filter +def filter_setin_files(file_list,matchstr): + """ filter/search the 'set in' file lists. Note + that this output is not autoescaped to allow + the <p> marks, but this is safe as the data + is file paths + """ + + # no filters, show last file (if any) + if matchstr == ":": + if file_list: + return file_list[len(file_list)-1].file_name + else: + return '' + + search, filter = matchstr.partition(':')[::2] + htmlstr="" + # match only filters + if search == '': + for i in range(len(file_list)): + if file_list[i].file_name.find(filter) >= 0: + htmlstr += file_list[i].file_name + "<p>" + return htmlstr + + # match only search string, plus always last file + if filter == "": + for i in range(len(file_list)-1): + if file_list[i].file_name.find(search) >= 0: + htmlstr += file_list[i].file_name + "<p>" + htmlstr += file_list[len(file_list)-1].file_name + return htmlstr + + # match filter or search string + for i in range(len(file_list)): + if (file_list[i].file_name.find(filter) >= 0) or (file_list[i].file_name.find(search) >= 0): + htmlstr += file_list[i].file_name + "<p>" + return htmlstr + + +@register.filter +def string_slice(strvar,slicevar): + """ slice a string with |string_slice:'[first]:[last]' + """ + first,last= slicevar.partition(':')[::2] + if first=='': + return strvar[:int(last)] + elif last=='': + return strvar[int(first):] + else: + return strvar[int(first):int(last)] + |