From 888b674f051054b8553bc545b72b9c05ddee4813 Mon Sep 17 00:00:00 2001 From: Hayden Andreyka Date: Thu, 13 Jun 2024 18:34:44 -0700 Subject: [PATCH] fix: backslashes in f-string error on file drop dupe widget (#289) * fix: python complaining about backslashes inside f-string expressions refactor excessively long f-string into separate variables * fix: missing f on f-string * Format with Ruff --- tagstudio/src/qt/modals/drop_import.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tagstudio/src/qt/modals/drop_import.py b/tagstudio/src/qt/modals/drop_import.py index 2796a81a..370694e3 100644 --- a/tagstudio/src/qt/modals/drop_import.py +++ b/tagstudio/src/qt/modals/drop_import.py @@ -168,8 +168,15 @@ class DropImport: if len(self.duplicate_files) > display_limit: dupes_to_show = dupes_to_show[0:display_limit] + dupes_str = "\n ".join(map(lambda path: str(path), dupes_to_show)) + dupes_more = ( + f"\nand {len(self.duplicate_files)-display_limit} more " + if len(self.duplicate_files) > display_limit + else "\n" + ) + msgBox.setText( - f"The following files:\n {'\n '.join(map(lambda path: str(path),self.get_relative_paths(dupes_to_show)))} {(f'\nand {len(self.duplicate_files)-display_limit} more ') if len(self.duplicate_files)>display_limit else '\n'}have filenames that already exist in the library folder." + f"The following files:\n {dupes_str}{dupes_more}have filenames that already exist in the library folder." ) msgBox.addButton("Skip", QMessageBox.ButtonRole.YesRole) msgBox.addButton("Override", QMessageBox.ButtonRole.DestructiveRole)