Fixed broken menus

This commit is contained in:
Alan Mason 2017-11-22 20:06:08 -08:00
parent c78172ede0
commit 0416f83448
4 changed files with 12 additions and 7 deletions

View file

@ -37,11 +37,10 @@ if __name__ == '__main__':
{'Name': 'Quit', 'Letter': 'Q'},
]
# Main loop
while True:
selection = menu_select(
'{}: Windows Activation Menu'.format(KIT_NAME_FULL),
activation_methods, actions)
main_entries=activation_methods, action_entries=actions)
if (selection.isnumeric()):
activation_methods[int(selection)-1]['Function']()

View file

@ -28,7 +28,9 @@ if __name__ == '__main__':
{'Name': 'Schedule CHKDSK scan (offline repair)', 'Repair': True}]
actions = [{'Name': 'Quit', 'Letter': 'Q'}]
selection = menu_select(
'{}: Check Disk Menu\n'.format(KIT_NAME_FULL), options, actions)
'{}: Check Disk Menu\n'.format(KIT_NAME_FULL),
main_entries=options,
action_entries=actions)
print_info('{}: Check Disk Menu\n'.format(KIT_NAME_FULL))
if selection == 'Q':
abort()

View file

@ -23,12 +23,15 @@ if __name__ == '__main__':
'GenericRepair': 'Repaired',
'UnsupportedOSError': 'Unsupported OS',
}}
disabled = bool(global_vars['OS']['Version'] not in ['8', '10'])
options = [
{'Name': 'Check Health', 'Repair': False},
{'Name': 'Restore Health', 'Repair': True}]
{'Name': 'Check Health', 'Repair': False, 'Disabled': disabled},
{'Name': 'Restore Health', 'Repair': True, 'Disabled': disabled}]
actions = [{'Name': 'Quit', 'Letter': 'Q'}]
selection = menu_select(
'{}: DISM Menu\n'.format(KIT_NAME_FULL), options, actions)
'{}: DISM Menu\n'.format(KIT_NAME_FULL),
main_entries=options,
action_entries=actions)
print_info('{}: DISM Menu\n'.format(KIT_NAME_FULL))
if selection == 'Q':
abort()

View file

@ -59,6 +59,7 @@ class UnsupportedOSError(Exception):
def abort():
"""Abort script."""
print_warning('Aborted.')
sleep(5)
exit_script()
def ask(prompt='Kotaero!'):
@ -234,7 +235,7 @@ def menu_select(title='~ Untitled Menu ~',
width = width,
name = entry.get('Display Name', entry['Name']))
if entry.get('Disabled', False):
entry_str = '{YELLOW}{entry_str} ({disabled}){CLEAR}\n'.format(
entry_str = '{YELLOW}{entry_str} ({disabled}){CLEAR}'.format(
entry_str = entry_str,
disabled = disabled_label,
**COLORS)