Black formatting

This commit is contained in:
Keith Edmunds 2025-02-05 17:46:16 +00:00
parent c9b45848dd
commit 4e73ea6e6a
3 changed files with 27 additions and 20 deletions

View File

@ -176,7 +176,9 @@ class FileImporter:
]
# Start the import if necessary
log.debug(f"Import files prepared: {[a.source_path for a in self.import_files_data]}")
log.debug(
f"Import files prepared: {[a.source_path for a in self.import_files_data]}"
)
self._import_next_file()
def populate_trackfiledata(self, path: str) -> TrackFileData:
@ -454,7 +456,7 @@ class FileImporter:
directory=Config.IMPORT_DESTINATION,
)
if pathspec:
if pathspec == '':
if pathspec == "":
# User cancelled
tfd.error = "You did not select a location to save this track"
return False
@ -516,7 +518,9 @@ class FileImporter:
log.debug(
f"remaining files: {[a.source_path for a in self.import_files_data]}"
)
self.signals.status_message_signal.emit(f"Importing {filename}", 10000)
self.signals.status_message_signal.emit(
f"Importing {filename}", 10000
)
self._start_import(tfd)
except IndexError:
log.debug("import_next_file: no files remaining in queue")
@ -535,13 +539,17 @@ class FileImporter:
tags=tfd.tags,
destination_path=tfd.destination_path,
track_id=tfd.track_id,
file_path_to_remove=tfd.file_path_to_remove
file_path_to_remove=tfd.file_path_to_remove,
)
log.debug(f"{self.workers[tfd.source_path]=} created")
self.workers[tfd.source_path].import_finished.connect(self.post_import_processing)
self.workers[tfd.source_path].import_finished.connect(
self.post_import_processing
)
self.workers[tfd.source_path].finished.connect(lambda: self.cleanup_thread(tfd))
self.workers[tfd.source_path].finished.connect(self.workers[tfd.source_path].deleteLater)
self.workers[tfd.source_path].finished.connect(
self.workers[tfd.source_path].deleteLater
)
self.workers[tfd.source_path].start()
@ -589,7 +597,7 @@ class DoTrackImport(QThread):
tags: Tags,
destination_path: str,
track_id: int,
file_path_to_remove: Optional[str] = None
file_path_to_remove: Optional[str] = None,
) -> None:
"""
Save parameters

View File

@ -630,7 +630,9 @@ class Window(QMainWindow, Ui_MainWindow):
self.signals.search_songfacts_signal.connect(self.open_songfacts_browser)
self.signals.search_wikipedia_signal.connect(self.open_wikipedia_browser)
def create_playlist(self, session: Session, playlist_name: str) -> Optional[Playlists]:
def create_playlist(
self, session: Session, playlist_name: str
) -> Optional[Playlists]:
"""Create new playlist"""
log.debug(f"create_playlist({playlist_name=}")
@ -856,10 +858,7 @@ class Window(QMainWindow, Ui_MainWindow):
# We need to keep a reference to the FileImporter else it will be
# garbage collected while import threads are still running
self.importer = FileImporter(
self.current.base_model,
self.current_row_or_end()
)
self.importer = FileImporter(self.current.base_model, self.current_row_or_end())
self.importer.start()
def insert_header(self) -> None:
@ -973,7 +972,9 @@ class Window(QMainWindow, Ui_MainWindow):
playlist.delete(session)
session.commit()
else:
raise ApplicationError(f"Unrecognised action from EditDeleteDialog: {action=}")
raise ApplicationError(
f"Unrecognised action from EditDeleteDialog: {action=}"
)
def mark_rows_for_moving(self) -> None:
"""
@ -1464,9 +1465,7 @@ class Window(QMainWindow, Ui_MainWindow):
helpers.show_warning(
self, "Duplicate template", "Template name already in use"
)
Playlists.save_as_template(
session, self.current.playlist_id, template_name
)
Playlists.save_as_template(session, self.current.playlist_id, template_name)
session.commit()
helpers.show_OK("Template", "Template saved", self)

View File

@ -213,10 +213,10 @@ class PlaylistDelegate(QStyledItemDelegate):
doc.setTextWidth(option.rect.width())
doc.setDefaultFont(option.font)
doc.setDocumentMargin(Config.ROW_PADDING)
if '\n' in option.text:
txt = option.text.replace('\n', '<br>')
elif '\u2028' in option.text:
txt = option.text.replace('\u2028', '<br>')
if "\n" in option.text:
txt = option.text.replace("\n", "<br>")
elif "\u2028" in option.text:
txt = option.text.replace("\u2028", "<br>")
else:
txt = option.text
doc.setHtml(txt)