Fix destination selection and title pane handling

This commit is contained in:
2Shirt 2023-06-04 19:24:27 -07:00
parent 7e6cfa1896
commit a2c41fbaf2
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -348,9 +348,8 @@ class State():
self.progress_out: pathlib.Path = self.log_dir.joinpath('progress.out')
self.mode: str = '?'
self.source: hw_disk.Disk | None = None
self.working_dir: pathlib.Path = pathlib.Path()
self.working_dir: pathlib.Path | None = None
self.ui: tui.TUI = tui.TUI('Source')
self.ui.add_title_pane('Destination')
def _add_block_pair(self, source: hw_disk.Disk, destination: pathlib.Path) -> None:
"""Add BlockPair object and run safety checks."""
@ -655,7 +654,7 @@ class State():
keep_history=True,
timestamp=False,
)
self.ui.set_progress_file(self.progress_out)
self.ui.set_progress_file(str(self.progress_out))
# Set mode
self.mode = set_mode(docopt_args)
@ -1109,6 +1108,7 @@ class State():
),
source_str,
)
if dest_str:
self.ui.add_title_pane(
ansi.color_string(
['Destination', '' if dest_exists else ' (Missing)'],
@ -1620,6 +1620,8 @@ def get_object(path) -> hw_disk.Disk | pathlib.Path:
obj = None
# Bail early
if path is None:
return obj
if not path:
raise FileNotFoundError(f'Path provided does not exist: {path}')