From 16d47a12a6947d99bfa0fb22f06d6fdc781172f8 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Tue, 22 Feb 2022 13:07:54 -0700 Subject: [PATCH] Simplify the WKClone source/dest selection Only show confirmation #2 if using advanced partition selection. --- scripts/wk/hw/ddrescue.py | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/scripts/wk/hw/ddrescue.py b/scripts/wk/hw/ddrescue.py index da66ecd3..8634b584 100644 --- a/scripts/wk/hw/ddrescue.py +++ b/scripts/wk/hw/ddrescue.py @@ -740,10 +740,17 @@ class State(): self.update_top_panes() # Confirmation #1 - self.confirm_selections( - prompt='Are these selections correct?', - source_parts=source_parts, - ) + advanced_selection = False + try: + self.confirm_selections( + prompt='Are these selections correct? (use "No" for advanced selection)', + source_parts=source_parts, + ) + except std.GenericAbort: + if std.ask('Proceed to advanced partition selection?'): + advanced_selection = True + else: + raise # Update panes self.update_progress_pane('Idle') @@ -762,11 +769,18 @@ class State(): clean_working_dir(self) # Add block pairs - if self.mode == 'Clone': - source_parts = self.add_clone_block_pairs() + if advanced_selection: + if self.mode == 'Clone': + source_parts = self.add_clone_block_pairs() + else: + source_parts = select_disk_parts(self.mode, self.source) + self.add_image_block_pairs(source_parts) else: - source_parts = select_disk_parts(self.mode, self.source) - self.add_image_block_pairs(source_parts) + if self.mode == 'Clone': + self._add_block_pair( + hw_obj.Disk(self.source.path), + pathlib.Path(self.destination.path), + ) # Safety Checks #1 if self.mode == 'Clone': @@ -775,7 +789,8 @@ class State(): # Confirmation #2 self.update_progress_pane('Idle') - self.confirm_selections('Start recovery?') + if advanced_selection: + self.confirm_selections('Start recovery?') # Unmount source and/or destination under macOS if PLATFORM == 'Darwin':