Skip to content

Commit

Permalink
enh: warn user when source and target directory are identical (close #28
Browse files Browse the repository at this point in the history
)
  • Loading branch information
paulmueller committed Apr 17, 2024
1 parent 70f811e commit 2328397
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
@@ -1,5 +1,6 @@
0.6.3
- fix: cleanup temporary directories on startup (#29)
- enh: warn user when source and target directory are identical (#28)
0.6.2
- setup: bump dclab from 0.55.7 to 0.57.0
0.6.1
Expand Down
15 changes: 15 additions & 0 deletions mpl_data_cast/gui/main.py
Expand Up @@ -150,6 +150,21 @@ def on_task_transfer(self) -> None:
"Output directory error",
"Output directory does not exist!")

# Warn the user when input and output directories are identical.
if self.widget_input.path.samefile(self.widget_output.path):
ret = QtWidgets.QMessageBox.question(
self,
"Output and input directories are identical",
"You have selected an output directory that is identical to "
"the input directory. If you continue, then the files in this "
"directory will be <b>replaced</b> according to the recipe "
"you chose.<br><br>"
"Are you absolutely sure you would like to continue?"
)
if ret != QtWidgets.QMessageBox.StandardButton.Yes:
# Abort
return

self.pushButton_transfer.setEnabled(False)
rp = self.current_recipe(self.widget_input.path,
self.widget_output.path)
Expand Down

0 comments on commit 2328397

Please sign in to comment.