Fixed update_progress & update_sidepane
This commit is contained in:
parent
afaee53077
commit
2272d133f9
1 changed files with 16 additions and 7 deletions
|
|
@ -424,7 +424,7 @@ def build_outer_panes(state):
|
||||||
**COLORS))
|
**COLORS))
|
||||||
|
|
||||||
# Side pane
|
# Side pane
|
||||||
update_progress(state)
|
update_sidepane(state)
|
||||||
tmux_splitw(
|
tmux_splitw(
|
||||||
'-dhl', str(SIDE_PANE_WIDTH),
|
'-dhl', str(SIDE_PANE_WIDTH),
|
||||||
'watch', '--color', '--no-title', '--interval', '1',
|
'watch', '--color', '--no-title', '--interval', '1',
|
||||||
|
|
@ -862,7 +862,7 @@ def run_ddrescue(state, pass_settings):
|
||||||
if bp.pass_done[state.current_pass]:
|
if bp.pass_done[state.current_pass]:
|
||||||
# Skip to next block-pair
|
# Skip to next block-pair
|
||||||
continue
|
continue
|
||||||
update_progress(state)
|
update_sidepane(state)
|
||||||
|
|
||||||
# Set ddrescue cmd
|
# Set ddrescue cmd
|
||||||
cmd = [
|
cmd = [
|
||||||
|
|
@ -887,17 +887,25 @@ def run_ddrescue(state, pass_settings):
|
||||||
# ddrescue_proc = popen_program(['./__exit_ok', *cmd])
|
# ddrescue_proc = popen_program(['./__exit_ok', *cmd])
|
||||||
# ddrescue_proc = popen_program(cmd)
|
# ddrescue_proc = popen_program(cmd)
|
||||||
while True:
|
while True:
|
||||||
|
bp.update_progress(state.current_pass)
|
||||||
|
update_sidepane(state)
|
||||||
try:
|
try:
|
||||||
ddrescue_proc.wait(timeout=10)
|
ddrescue_proc.wait(timeout=10)
|
||||||
sleep(2)
|
sleep(2)
|
||||||
update_progress(state)
|
bp.update_progress(state.current_pass)
|
||||||
|
update_sidepane(state)
|
||||||
break
|
break
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
update_progress(state)
|
# Catch to update bp/sidepane
|
||||||
|
pass
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
# Catch user abort
|
# Catch user abort
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Update progress/sidepane again
|
||||||
|
bp.update_progress(state.current_pass)
|
||||||
|
update_sidepane(state)
|
||||||
|
|
||||||
# Was ddrescue aborted?
|
# Was ddrescue aborted?
|
||||||
return_code = ddrescue_proc.poll()
|
return_code = ddrescue_proc.poll()
|
||||||
if return_code is None or return_code is 130:
|
if return_code is None or return_code is 130:
|
||||||
|
|
@ -1174,9 +1182,10 @@ def tmux_splitw(*args):
|
||||||
return result.stdout.decode().strip()
|
return result.stdout.decode().strip()
|
||||||
|
|
||||||
|
|
||||||
def update_progress(state):
|
def update_sidepane(state):
|
||||||
"""Update progress file for side pane."""
|
"""Update progress file for side pane."""
|
||||||
output = []
|
output = []
|
||||||
|
state.update_progress()
|
||||||
if state.mode == 'clone':
|
if state.mode == 'clone':
|
||||||
output.append(' {BLUE}Cloning Status{CLEAR}'.format(**COLORS))
|
output.append(' {BLUE}Cloning Status{CLEAR}'.format(**COLORS))
|
||||||
else:
|
else:
|
||||||
|
|
@ -1195,11 +1204,11 @@ def update_progress(state):
|
||||||
output.append('{BLUE}Image File{CLEAR}'.format(**COLORS))
|
output.append('{BLUE}Image File{CLEAR}'.format(**COLORS))
|
||||||
elif state.mode == 'image' and len(state.block_pairs) == 1:
|
elif state.mode == 'image' and len(state.block_pairs) == 1:
|
||||||
output.append('{BLUE}{source} {YELLOW}(Whole){CLEAR}'.format(
|
output.append('{BLUE}{source} {YELLOW}(Whole){CLEAR}'.format(
|
||||||
source=bp.source.path,
|
source=bp.source_path,
|
||||||
**COLORS))
|
**COLORS))
|
||||||
else:
|
else:
|
||||||
output.append('{BLUE}{source}{CLEAR}'.format(
|
output.append('{BLUE}{source}{CLEAR}'.format(
|
||||||
source=bp.source.path,
|
source=bp.source_path,
|
||||||
**COLORS))
|
**COLORS))
|
||||||
output.extend(bp.status)
|
output.extend(bp.status)
|
||||||
output.append(' ')
|
output.append(' ')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue