hide empty groups in brief

develop
Спиридонов Денис 12 years ago
parent 27f21d7c09
commit d5a01b186e

@ -96,8 +96,9 @@ def get_ip_mac_type(client_type = None):
return results return results
def print_brief_group(Fields, group_name): def print_brief_group(Fields, group_name):
if group_name: print_group_flag = False
_print ('\b'+group_name) # if group_name:
# _print ('\b'+group_name)
uncompatible_count = 0 uncompatible_count = 0
for field in Fields: for field in Fields:
if field.uncompatible: if field.uncompatible:
@ -105,6 +106,9 @@ def print_brief_group(Fields, group_name):
continue continue
if field.element in ['input', 'openfile']: if field.element in ['input', 'openfile']:
value = field.value if field.value else '' value = field.value if field.value else ''
if not print_group_flag:
_print ('\b'+group_name)
print_group_flag = True
colorPrint._printSUCCESS('%s: %s' %(field.label, value)) colorPrint._printSUCCESS('%s: %s' %(field.label, value))
elif field.element in ['combo', 'comboEdit', 'radio', 'file']: elif field.element in ['combo', 'comboEdit', 'radio', 'file']:
@ -118,6 +122,9 @@ def print_brief_group(Fields, group_name):
value = ', '.join(value) value = ', '.join(value)
else: else:
value = field.value if field.value else '' value = field.value if field.value else ''
if not print_group_flag:
_print ('\b'+group_name)
print_group_flag = True
colorPrint._printSUCCESS('%s: %s' %(field.label, value)) colorPrint._printSUCCESS('%s: %s' %(field.label, value))
elif field.element in ['multichoice', 'multichoice_add',\ elif field.element in ['multichoice', 'multichoice_add',\
@ -134,12 +141,18 @@ def print_brief_group(Fields, group_name):
value = ', '.join(field.listvalue.string) value = ', '.join(field.listvalue.string)
else: else:
value = field.value if field.value else '' value = field.value if field.value else ''
if not print_group_flag:
_print ('\b'+group_name)
print_group_flag = True
colorPrint._printSUCCESS('%s: %s' %(field.label, value)) colorPrint._printSUCCESS('%s: %s' %(field.label, value))
# elif field.element == 'label': # elif field.element == 'label':
# print field.label # print field.label
elif field.element == 'error': elif field.element == 'error':
if not print_group_flag:
_print ('\b'+group_name)
print_group_flag = True
colorPrint.printERROR(field.label) colorPrint.printERROR(field.label)
elif field.element in ['check', 'check_tristate']: elif field.element in ['check', 'check_tristate']:
@ -151,6 +164,9 @@ def print_brief_group(Fields, group_name):
value = _('auto') value = _('auto')
else: else:
value = field.value value = field.value
if not print_group_flag:
_print ('\b'+group_name)
print_group_flag = True
colorPrint._printSUCCESS('%s: %s' %(field.label, value)) colorPrint._printSUCCESS('%s: %s' %(field.label, value))
elif field.element == 'table' and field.type != 'steps': elif field.element == 'table' and field.type != 'steps':
@ -192,6 +208,9 @@ def print_brief_group(Fields, group_name):
for body_row in body: for body_row in body:
data.append(map(lambda x: x if x else '', body_row)) data.append(map(lambda x: x if x else '', body_row))
if not print_group_flag:
_print ('\b'+group_name)
print_group_flag = True
colorPrint._printSUCCESS('%s: ' %(field.label)) colorPrint._printSUCCESS('%s: ' %(field.label))
res = printTable(data, head) res = printTable(data, head)
sys.stdout.flush() sys.stdout.flush()
@ -200,8 +219,8 @@ def print_brief_group(Fields, group_name):
else: else:
uncompatible_count += 1 uncompatible_count += 1
if uncompatible_count == len (Fields) and group_name: # if uncompatible_count == len (Fields) and group_name:
colorPrint._printSUCCESS(_('Not used')) # colorPrint._printSUCCESS(_('Not used'))
def print_brief(view, brief_label): def print_brief(view, brief_label):
for Group in view.groups.GroupField: for Group in view.groups.GroupField:

Loading…
Cancel
Save