summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyungJoo Ham <myungjoo.ham@samsung.com>2017-04-12 19:22:41 +0900
committerMyungJoo Ham <myungjoo.ham@samsung.com>2017-04-13 18:35:35 +0900
commit9db41777008e06ac8800a6001047e7fe8bdca76a (patch)
treedcc60a0158267f058af7572fe7f23bfc2b0d5fb2
parentff300c1a13bdb59be7f2ac2e1de759d790326375 (diff)
downloadtic-core-9db41777008e06ac8800a6001047e7fe8bdca76a.tar.gz
tic-core-9db41777008e06ac8800a6001047e7fe8bdca76a.tar.bz2
tic-core-9db41777008e06ac8800a6001047e7fe8bdca76a.zip
[TIC-Core] Allow to express UI elements within package list with UI meta blocks
If a meta package name ends with "__UI__xx", it is a UI meta block. xx denotes for the UI element it stands for: - BR/br: blank line - HR/hr: <hr> - SD/sd: shade (not tested) - SM/sm: Summary text message - HT/ht: HTML code from summary message (not tested) Change-Id: Ife75da45f642be998910e23b9cd2b0b11da49d1c Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
-rw-r--r--tic/parser/view_parser.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/tic/parser/view_parser.py b/tic/parser/view_parser.py
index a35c94d..9e6419b 100644
--- a/tic/parser/view_parser.py
+++ b/tic/parser/view_parser.py
@@ -61,6 +61,27 @@ def make_view_data(pkg_group):
return n
def make_meta_node(pkgname, viewtext):
return dict(text=viewtext, metaname=pkgname, nodes=[])
+ def is_blank_ui_meta_node(pkgname):
+ return (pkgname[-8:-2] == '__UI__')
+ def handle_ui_meta_node(tag, node):
+ node['selectable'] = False
+ node['hideCheckbox'] = True
+ if tag == 'BR' or tag == 'br':
+ node['text'] = ''
+ elif tag == 'HR' or tag == 'hr':
+ node['text'] = '<hr style="margin-bottom: 0px; margin-top: 0px; border-style: inset; border-width: 3px" />'
+ elif tag == 'SD' or tag == 'sd':
+ node['text'] = ''
+ node['backColor'] = '#101010'
+ elif tag == 'SM' or tag == 'sm':
+ # Keep the summary text
+ node['text'] = node['text']
+ elif tag == 'HT' or tag == 'ht':
+ # Keep the summary (TODO: verify the usage of HTML tags.)
+ node['text'] = node['text'] # Do we need conversion?
+ else:
+ node['text'] = ''
+ return node
# view_data for tree view on web-ui
view_data = []
@@ -86,7 +107,7 @@ def make_view_data(pkg_group):
if meta_info.get('category'):
for category in meta_info['category']:
c_rpm = pkg_dict[category[0]]
- if hasattr(c_rpm.get('suggests'), '__iter__'):
+ if hasattr(c_rpm.get('suggests'), '__iter__'):
for suggest in c_rpm.get('suggests'):
category_dict[suggest['name']] = category[1]
else:
@@ -100,11 +121,17 @@ def make_view_data(pkg_group):
view_ref[root[0]] = root_node
if root[0] in category_dict:
root_node['category'] = category_dict[root[0]]
+ if is_blank_ui_meta_node(root[0]):
+ name = root[0]
+ sub1_node = handle_ui_meta_node(name[-2:], root_node)
view_data.append(root_node)
for sub1 in meta_info['sub1']:
sub1_node = make_meta_node(sub1[0], sub1[2])
view_ref[sub1[0]] = sub1_node
+ if is_blank_ui_meta_node(sub1[0]):
+ name = sub1[0]
+ sub1_node = handle_ui_meta_node(name[-2:], sub1_node)
# search root
if sub1[1] in view_ref:
# add to root node
@@ -118,6 +145,9 @@ def make_view_data(pkg_group):
for sub2 in meta_info['sub2']:
sub2_node = make_meta_node(sub2[0], sub2[3])
view_ref[sub2[0]] = sub2_node
+ if is_blank_ui_meta_node(sub2[0]):
+ name = sub2[0]
+ sub1_node = handle_ui_meta_node(name[-2:], sub2_node)
# search sub1
if sub2[2] in view_ref:
if 'category' in view_ref[sub2[2]] and view_ref[sub2[2]]['category']: