Windows Setup working

This commit is contained in:
Alan Mason 2017-12-01 15:28:15 -08:00
parent d075f17bfa
commit dce31bf5dd
3 changed files with 26 additions and 14 deletions

View file

@ -372,10 +372,17 @@ def set_title(title='~Some Title~'):
global_vars['Title'] = title
os.system('title {}'.format(title))
def show_info(message='~Some message~', info='~Some info~', indent=8, width=32):
def show_info(message='~Some message~', info='~Some info~', indent=8, width=32,
warning=False, error=False):
"""Display info with formatting."""
print_standard('{indent}{message:<{width}}{info}'.format(
indent=' '*indent, width=width, message=message, info=info))
message = '{indent}{message:<{width}}{info}'.format(
indent=' '*indent, width=width, message=message, info=info)
if error:
print_error(message)
elif warning:
print_warning(message)
else:
print_standard(message)
def sleep(seconds=2):
"""Wait for a while."""

View file

@ -232,7 +232,7 @@ def prep_disk_for_formatting(disk=None):
if len(disk['Partitions']) == 0:
disk['Format Warnings'] += 'No partitions found\n'
for partition in disk['Partitions']:
display = ' Partition {num:>{width}}:\t{size} {fs}'.format(
display = '{size} {fs}'.format(
num = partition['Number'],
width = width,
size = partition['Size'],
@ -344,10 +344,10 @@ def select_disk(title='Which disk?', disks=[]):
# Show unsupported partition(s)
if is_bad_partition(partition):
p_display_name = '{YELLOW}{display}{CLEAR}'.format(
display=p_name, **COLORS)
p_name = '{YELLOW}{p_name}{CLEAR}'.format(
p_name=p_name, **COLORS)
display_name += '\n\t\t\t{}'.format(display_name)
display_name += '\n\t\t\t{}'.format(p_name)
if not disk['Partitions']:
display_name += '\n\t\t\t{}No partitions found.{}'.format(
COLORS['YELLOW'], COLORS['CLEAR'])

View file

@ -263,7 +263,7 @@ def menu_setup():
# Select disk to use as the OS disk
dest_disk = select_disk('To which disk are we installing Windows?', disks)
if not disk:
if not dest_disk:
raise GenericAbort
# "Prep" disk
@ -277,11 +277,16 @@ def menu_setup():
show_info(
message = 'Boot Method:',
info = 'UEFI (GPT)' if dest_disk['Use GPT'] else 'Legacy (MBR)')
show_info(message='Using Image:', info=windows_version['Path'])
print_warning(' ERASING: \t[{Table}] ({Type}) {Name} {Size}\n'.format(
**dest_disk))
show_info(message='Using Image:', info=windows_image['Path'])
show_info(
message = 'ERASING:',
info = '[{Table}] ({Type}) {Name} {Size}\n'.format(**dest_disk),
warning = True)
for par in dest_disk['Partitions']:
print_warning(par['Display String'])
show_info(
message = 'Partition {:>2}:'.format(par['Number']),
info = par['Display String'],
warning = True)
print_warning(dest_disk['Format Warnings'])
if (not ask('Is this correct?')):
@ -290,7 +295,7 @@ def menu_setup():
# Safety check
print_standard('\nSAFETY CHECK')
print_warning('All data will be DELETED from the '
'disk & partition(s) listed above.')
'disk and partition(s) listed above.')
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?')):
@ -357,7 +362,7 @@ def menu_tools():
if (selection.isnumeric()):
name = tools[int(selection)-1]['Name']
cmd = [PE_TOOLS[name]['Path']] + PE_TOOLS[name].get('Args', [])
if tool == 'Blue Screen View':
if name == 'Blue Screen View':
# Select path to scan
minidump_path = select_minidump_path()
if minidump_path: