Updated side pane sections

This commit is contained in:
2Shirt 2019-12-30 16:40:28 -07:00
parent 631449e40a
commit 0ddafe8a42
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -502,13 +502,13 @@ class State():
self.safety_check(mode, working_dir) self.safety_check(mode, working_dir)
# Confirmation #2 # Confirmation #2
self.update_progress_pane('Idle')
self.confirm_selections(mode, 'Start recovery?', working_dir=working_dir) self.confirm_selections(mode, 'Start recovery?', working_dir=working_dir)
# Prep destination # Prep destination
# if cloning and not resuming format destination # if cloning and not resuming format destination
# Done # Done
self.update_progress_pane('Idle')
# Ready for main menu # Ready for main menu
def init_tmux(self): def init_tmux(self):
@ -665,16 +665,23 @@ class State():
std.print_error('Failed to save clone settings') std.print_error('Failed to save clone settings')
raise std.GenericAbort() raise std.GenericAbort()
def update_progress_pane(self, status): def update_progress_pane(self, overall_status):
"""Update progress pane.""" """Update progress pane."""
report = [] report = []
separator = '─────────────────────' separator = '─────────────────────'
width = cfg.ddrescue.TMUX_SIDE_WIDTH width = cfg.ddrescue.TMUX_SIDE_WIDTH
# TODO: Finish update_progress_pane()
# Status # Status
report.append(std.color_string(f'{"Status":^{width}}', 'BLUE')) report.append(std.color_string(f'{"Status":^{width}}', 'BLUE'))
report.append(f'{status:^{width}}') if 'NEEDS ATTENTION' in overall_status:
report.append(
std.color_string(
f'{overall_status:^{width}}',
'YELLOW_BLINK',
),
)
else:
report.append(f'{overall_status:^{width}}')
report.append(separator) report.append(separator)
# Overall progress # Overall progress
@ -682,15 +689,11 @@ class State():
total_rescued = sum( total_rescued = sum(
[pair.map_data.get('rescued', 0) for pair in self.block_pairs], [pair.map_data.get('rescued', 0) for pair in self.block_pairs],
) )
total_rescued = 400 * 1024**2
total_size = sum([pair.size for pair in self.block_pairs]) total_size = sum([pair.size for pair in self.block_pairs])
percent = total_rescued / total_size percent = 100 * total_rescued / total_size
report.append(std.color_string('Overall Progress', 'BLUE')) report.append(std.color_string('Overall Progress', 'BLUE'))
report.append( report.append(
std.color_string( f'Rescued: {format_status_string(percent, width=width-9)}',
['Rescued:', f'{100*total_rescued/total_size:>{width-11}.2f} %'],
[None, get_percent_color(percent)],
),
) )
report.append( report.append(
std.color_string( std.color_string(
@ -703,13 +706,16 @@ class State():
# Block pair progress # Block pair progress
for pair in self.block_pairs: for pair in self.block_pairs:
report.append(std.color_string(pair.source, 'BLUE')) report.append(std.color_string(pair.source, 'BLUE'))
report.append(f'Pass 1 {"TODO":>{width-7}}') for name, status in pair.status.items():
report.append(f'Pass 2 {"TODO":>{width-7}}') name = name.title()
report.append(f'Pass 3 {"TODO":>{width-7}}') report.append(
f'{name}{format_status_string(status, width=width-len(name))}',
)
report.append(' ') report.append(' ')
# EToC # EToC
if status in ('In Progress', 'NEEDS ATTENTION'): # TODO: Finish update_progress_pane() [EToC]
if overall_status in ('Active', 'NEEDS ATTENTION'):
report.append(separator) report.append(separator)
report.append(std.color_string('Estimated Pass Finish', 'BLUE')) report.append(std.color_string('Estimated Pass Finish', 'BLUE'))
report.append('TODO') report.append('TODO')