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
This commit is contained in:
Hayden Andreyka
2024-06-13 18:34:44 -07:00
committed by GitHub
parent e5a0e5aa9b
commit 888b674f05

View File

@@ -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)