Bugfix: Abort logic

This commit is contained in:
Alan Mason 2017-12-01 12:27:53 -08:00
parent 97e93e812b
commit 5d32f3c94a
4 changed files with 8 additions and 10 deletions

View file

@ -360,7 +360,7 @@ def select_disk(title='Which disk?', disks=[]):
if (selection.isnumeric()):
return disk_options[int(selection)-1]['Disk']
elif (selection == 'M'):
raise GeneralAbort
raise GenericAbort
if __name__ == '__main__':
print("This file is not meant to be called directly.")

View file

@ -75,7 +75,7 @@ def find_windows_image(windows_version):
else:
print_error('Failed to find Windows source image for {}'.format(
windows_version['Name']))
raise GeneralAbort
raise GenericAbort
def format_disk(disk, use_gpt):
"""Format disk for use as a Windows OS disk."""
@ -166,7 +166,7 @@ def select_windows_version():
if selection.isnumeric():
return WINDOWS_VERSIONS[int(selection)-1]
elif selection == 'M':
raise GeneralAbort
raise GenericAbort
def setup_windows(windows_image, windows_version):
cmd = [

View file

@ -197,8 +197,9 @@ def menu_root():
if (selection.isnumeric()):
try:
menus[int(selection)-1]['Menu']()
except AbortError:
pass
except GenericAbort:
print_warning('\nAborted\n')
pause('Press Enter to return to main menu... ')
elif (selection == 'C'):
run_program(['cmd', '-new_console:n'], check=False)
elif (selection == 'R'):
@ -262,7 +263,7 @@ def menu_setup():
print_warning(dest_disk['Format Warnings'])
if (not ask('Is this correct?')):
raise GeneralAbort
raise GenericAbort
# Safety check
print_standard('\nSAFETY CHECK')
@ -271,7 +272,7 @@ def menu_setup():
print_warning('This is irreversible and will lead '
'to {CLEAR}{RED}DATA LOSS.'.format(**COLORS))
if (not ask('Asking again to confirm, is this correct?')):
raise GeneralAbort
raise GenericAbort
# Remove volume letters so S, T, & W can be used below
remove_volume_letters(keep=windows_image['Source'])

View file

@ -17,9 +17,6 @@ DISKPART_SCRIPT = r'{}\diskpart.script'.format(global_vars['Env']['TMP'])
if __name__ == '__main__':
try:
menu_root()
except GenericAbort:
# pause('Press Enter to return to main menu... ')
pass
except SystemExit:
pass
except: