Bugfix: Abort logic
This commit is contained in:
parent
97e93e812b
commit
5d32f3c94a
4 changed files with 8 additions and 10 deletions
|
|
@ -360,7 +360,7 @@ def select_disk(title='Which disk?', disks=[]):
|
||||||
if (selection.isnumeric()):
|
if (selection.isnumeric()):
|
||||||
return disk_options[int(selection)-1]['Disk']
|
return disk_options[int(selection)-1]['Disk']
|
||||||
elif (selection == 'M'):
|
elif (selection == 'M'):
|
||||||
raise GeneralAbort
|
raise GenericAbort
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print("This file is not meant to be called directly.")
|
print("This file is not meant to be called directly.")
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ def find_windows_image(windows_version):
|
||||||
else:
|
else:
|
||||||
print_error('Failed to find Windows source image for {}'.format(
|
print_error('Failed to find Windows source image for {}'.format(
|
||||||
windows_version['Name']))
|
windows_version['Name']))
|
||||||
raise GeneralAbort
|
raise GenericAbort
|
||||||
|
|
||||||
def format_disk(disk, use_gpt):
|
def format_disk(disk, use_gpt):
|
||||||
"""Format disk for use as a Windows OS disk."""
|
"""Format disk for use as a Windows OS disk."""
|
||||||
|
|
@ -166,7 +166,7 @@ def select_windows_version():
|
||||||
if selection.isnumeric():
|
if selection.isnumeric():
|
||||||
return WINDOWS_VERSIONS[int(selection)-1]
|
return WINDOWS_VERSIONS[int(selection)-1]
|
||||||
elif selection == 'M':
|
elif selection == 'M':
|
||||||
raise GeneralAbort
|
raise GenericAbort
|
||||||
|
|
||||||
def setup_windows(windows_image, windows_version):
|
def setup_windows(windows_image, windows_version):
|
||||||
cmd = [
|
cmd = [
|
||||||
|
|
|
||||||
|
|
@ -197,8 +197,9 @@ def menu_root():
|
||||||
if (selection.isnumeric()):
|
if (selection.isnumeric()):
|
||||||
try:
|
try:
|
||||||
menus[int(selection)-1]['Menu']()
|
menus[int(selection)-1]['Menu']()
|
||||||
except AbortError:
|
except GenericAbort:
|
||||||
pass
|
print_warning('\nAborted\n')
|
||||||
|
pause('Press Enter to return to main menu... ')
|
||||||
elif (selection == 'C'):
|
elif (selection == 'C'):
|
||||||
run_program(['cmd', '-new_console:n'], check=False)
|
run_program(['cmd', '-new_console:n'], check=False)
|
||||||
elif (selection == 'R'):
|
elif (selection == 'R'):
|
||||||
|
|
@ -262,7 +263,7 @@ def menu_setup():
|
||||||
print_warning(dest_disk['Format Warnings'])
|
print_warning(dest_disk['Format Warnings'])
|
||||||
|
|
||||||
if (not ask('Is this correct?')):
|
if (not ask('Is this correct?')):
|
||||||
raise GeneralAbort
|
raise GenericAbort
|
||||||
|
|
||||||
# Safety check
|
# Safety check
|
||||||
print_standard('\nSAFETY CHECK')
|
print_standard('\nSAFETY CHECK')
|
||||||
|
|
@ -271,7 +272,7 @@ def menu_setup():
|
||||||
print_warning('This is irreversible and will lead '
|
print_warning('This is irreversible and will lead '
|
||||||
'to {CLEAR}{RED}DATA LOSS.'.format(**COLORS))
|
'to {CLEAR}{RED}DATA LOSS.'.format(**COLORS))
|
||||||
if (not ask('Asking again to confirm, is this correct?')):
|
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 so S, T, & W can be used below
|
||||||
remove_volume_letters(keep=windows_image['Source'])
|
remove_volume_letters(keep=windows_image['Source'])
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,6 @@ DISKPART_SCRIPT = r'{}\diskpart.script'.format(global_vars['Env']['TMP'])
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
menu_root()
|
menu_root()
|
||||||
except GenericAbort:
|
|
||||||
# pause('Press Enter to return to main menu... ')
|
|
||||||
pass
|
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue