Added SMART/Journal panes

This commit is contained in:
2Shirt 2019-12-30 19:25:46 -07:00
parent d9561a0159
commit bcd46d4017
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 28 additions and 18 deletions

View file

@ -2,8 +2,6 @@
# pylint: disable=bad-whitespace,line-too-long
# vim: sts=2 sw=2 ts=2
import re
from collections import OrderedDict

View file

@ -405,17 +405,19 @@ class State():
if forced or needs_fixed:
self.update_top_panes()
# SMART/Journal
# Return if Progress pane not present
if 'Progress' not in self.panes:
# Assumning we're still selecting source/dest
return
height = tmux.get_pane_size(self.panes['Progress'])[1] - 2
p_ratios = [int((x/sum(PANE_RATIOS)) * height) for x in PANE_RATIOS]
if 'SMART' in self.panes:
tmux.resize_pane(self.panes['SMART'], height=p_ratios[0])
tmux.resize_pane(height=p_ratios[1])
if 'Journal' in self.panes:
tmux.resize_pane(self.panes['Journal'], height=p_ratios[2])
# SMART/Journal
if forced or needs_fixed:
height = tmux.get_pane_size(self.panes['Progress'])[1] - 2
p_ratios = [int((x/sum(PANE_RATIOS)) * height) for x in PANE_RATIOS]
if 'SMART' in self.panes:
tmux.resize_pane(self.panes['SMART'], height=p_ratios[0])
tmux.resize_pane(height=p_ratios[1])
if 'Journal' in self.panes:
tmux.resize_pane(self.panes['Journal'], height=p_ratios[2])
def fix_tmux_layout_loop(self):
"""Fix tmux layout on a loop.
@ -1349,16 +1351,24 @@ def mount_raw_image_macos(path):
def run_recovery(state, main_menu, settings_menu):
"""Run recovery passes."""
atexit.register(state.save_debug_reports)
state.update_progress_pane('Active')
# Start SMART/Journal
# TODO
state.panes['SMART'] = tmux.split_window(
behind=True, lines=12, vertical=True,
watch_file=f'{state.log_dir}/smart.out',
)
state.panes['Journal'] = tmux.split_window(
lines=4, vertical=True, cmd='journalctl --dmesg --follow',
)
# TODO
# Run ddrescue
state.update_progress_pane('Active')
# Stop SMART/Journal
# TODO
for pane in ('SMART', 'Journal'):
if pane in state.panes:
tmux.kill_pane(state.panes.pop(pane))
# Done
state.save_debug_reports()

View file

@ -275,15 +275,17 @@ class Disk(BaseObj):
# Done
return report
def generate_report(self):
def generate_report(self, header=True):
"""Generate Disk report, returns list."""
report = []
report.append(color_string(f'Device ({self.path.name})', 'BLUE'))
report.append(f' {self.description}')
if header:
report.append(color_string(f'Device ({self.path.name})', 'BLUE'))
report.append(f' {self.description}')
# Attributes
if self.attributes:
report.append(color_string('Attributes', 'BLUE'))
if header:
report.append(color_string('Attributes', 'BLUE'))
report.extend(self.generate_attribute_report())
# Notes