Black formatting
This commit is contained in:
parent
c9b45848dd
commit
4e73ea6e6a
@ -176,7 +176,9 @@ class FileImporter:
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Start the import if necessary
|
# 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()
|
self._import_next_file()
|
||||||
|
|
||||||
def populate_trackfiledata(self, path: str) -> TrackFileData:
|
def populate_trackfiledata(self, path: str) -> TrackFileData:
|
||||||
@ -454,7 +456,7 @@ class FileImporter:
|
|||||||
directory=Config.IMPORT_DESTINATION,
|
directory=Config.IMPORT_DESTINATION,
|
||||||
)
|
)
|
||||||
if pathspec:
|
if pathspec:
|
||||||
if pathspec == '':
|
if pathspec == "":
|
||||||
# User cancelled
|
# User cancelled
|
||||||
tfd.error = "You did not select a location to save this track"
|
tfd.error = "You did not select a location to save this track"
|
||||||
return False
|
return False
|
||||||
@ -516,7 +518,9 @@ class FileImporter:
|
|||||||
log.debug(
|
log.debug(
|
||||||
f"remaining files: {[a.source_path for a in self.import_files_data]}"
|
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)
|
self._start_import(tfd)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
log.debug("import_next_file: no files remaining in queue")
|
log.debug("import_next_file: no files remaining in queue")
|
||||||
@ -535,13 +539,17 @@ class FileImporter:
|
|||||||
tags=tfd.tags,
|
tags=tfd.tags,
|
||||||
destination_path=tfd.destination_path,
|
destination_path=tfd.destination_path,
|
||||||
track_id=tfd.track_id,
|
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")
|
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(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()
|
self.workers[tfd.source_path].start()
|
||||||
|
|
||||||
@ -589,7 +597,7 @@ class DoTrackImport(QThread):
|
|||||||
tags: Tags,
|
tags: Tags,
|
||||||
destination_path: str,
|
destination_path: str,
|
||||||
track_id: int,
|
track_id: int,
|
||||||
file_path_to_remove: Optional[str] = None
|
file_path_to_remove: Optional[str] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Save parameters
|
Save parameters
|
||||||
|
|||||||
@ -630,7 +630,9 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.signals.search_songfacts_signal.connect(self.open_songfacts_browser)
|
self.signals.search_songfacts_signal.connect(self.open_songfacts_browser)
|
||||||
self.signals.search_wikipedia_signal.connect(self.open_wikipedia_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"""
|
"""Create new playlist"""
|
||||||
|
|
||||||
log.debug(f"create_playlist({playlist_name=}")
|
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
|
# We need to keep a reference to the FileImporter else it will be
|
||||||
# garbage collected while import threads are still running
|
# garbage collected while import threads are still running
|
||||||
self.importer = FileImporter(
|
self.importer = FileImporter(self.current.base_model, self.current_row_or_end())
|
||||||
self.current.base_model,
|
|
||||||
self.current_row_or_end()
|
|
||||||
)
|
|
||||||
self.importer.start()
|
self.importer.start()
|
||||||
|
|
||||||
def insert_header(self) -> None:
|
def insert_header(self) -> None:
|
||||||
@ -973,7 +972,9 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
playlist.delete(session)
|
playlist.delete(session)
|
||||||
session.commit()
|
session.commit()
|
||||||
else:
|
else:
|
||||||
raise ApplicationError(f"Unrecognised action from EditDeleteDialog: {action=}")
|
raise ApplicationError(
|
||||||
|
f"Unrecognised action from EditDeleteDialog: {action=}"
|
||||||
|
)
|
||||||
|
|
||||||
def mark_rows_for_moving(self) -> None:
|
def mark_rows_for_moving(self) -> None:
|
||||||
"""
|
"""
|
||||||
@ -1464,9 +1465,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
helpers.show_warning(
|
helpers.show_warning(
|
||||||
self, "Duplicate template", "Template name already in use"
|
self, "Duplicate template", "Template name already in use"
|
||||||
)
|
)
|
||||||
Playlists.save_as_template(
|
Playlists.save_as_template(session, self.current.playlist_id, template_name)
|
||||||
session, self.current.playlist_id, template_name
|
|
||||||
)
|
|
||||||
session.commit()
|
session.commit()
|
||||||
helpers.show_OK("Template", "Template saved", self)
|
helpers.show_OK("Template", "Template saved", self)
|
||||||
|
|
||||||
|
|||||||
@ -213,10 +213,10 @@ class PlaylistDelegate(QStyledItemDelegate):
|
|||||||
doc.setTextWidth(option.rect.width())
|
doc.setTextWidth(option.rect.width())
|
||||||
doc.setDefaultFont(option.font)
|
doc.setDefaultFont(option.font)
|
||||||
doc.setDocumentMargin(Config.ROW_PADDING)
|
doc.setDocumentMargin(Config.ROW_PADDING)
|
||||||
if '\n' in option.text:
|
if "\n" in option.text:
|
||||||
txt = option.text.replace('\n', '<br>')
|
txt = option.text.replace("\n", "<br>")
|
||||||
elif '\u2028' in option.text:
|
elif "\u2028" in option.text:
|
||||||
txt = option.text.replace('\u2028', '<br>')
|
txt = option.text.replace("\u2028", "<br>")
|
||||||
else:
|
else:
|
||||||
txt = option.text
|
txt = option.text
|
||||||
doc.setHtml(txt)
|
doc.setHtml(txt)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user