Only use Unicode checkmark if in X

This commit is contained in:
2Shirt 2018-12-28 15:44:14 -07:00
parent 91649f5ee7
commit 575fa17425
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 10 additions and 4 deletions

View file

@ -781,6 +781,9 @@ def menu_ddrescue(source_path, dest_path, run_mode):
def menu_main(state):
"""Main menu is used to set ddrescue settings."""
checkmark = '*'
if 'DISPLAY' in global_vars['Env']:
checkmark = ''
title = '{GREEN}ddrescue TUI: Main Menu{CLEAR}\n\n'.format(**COLORS)
title += '{BLUE}Current pass: {CLEAR}'.format(**COLORS)
@ -804,8 +807,8 @@ def menu_main(state):
while True:
# Update entries
for opt in main_options:
opt['Name'] = '{} {}'.format(
'[✓]' if opt['Enabled'] else '[ ]',
opt['Name'] = '[{}] {}'.format(
checkmark if opt['Enabled'] else ' ',
opt['Base Name'])
selection = menu_select(

View file

@ -751,6 +751,9 @@ def get_read_rate(s):
def menu_diags(state, args):
"""Main menu to select and run HW tests."""
args = [a.lower() for a in args]
checkmark = '*'
if 'DISPLAY' in global_vars['Env']:
checkmark = ''
title = '{}\nMain Menu'.format(TOP_PANE_TEXT)
# NOTE: Changing the order of main_options will break everything
main_options = [
@ -819,8 +822,8 @@ def menu_diags(state, args):
# Update checkboxes
for opt in main_options:
_nvme_smart = opt['Base Name'] == 'NVMe / SMART'
opt['Name'] = '{} {} {}'.format(
'[✓]' if opt['Enabled'] else '[ ]',
opt['Name'] = '[{}] {} {}'.format(
checkmark if opt['Enabled'] else ' ',
opt['Base Name'],
QUICK_LABEL if state.quick_mode and _nvme_smart else '')