Black formatting and mypy fixups
This commit is contained in:
parent
8ce5c037ef
commit
8f94dc6c4f
@ -184,7 +184,6 @@ class _FadeCurve:
|
||||
|
||||
|
||||
class _FadeTrack(QThread):
|
||||
|
||||
finished = pyqtSignal()
|
||||
|
||||
def __init__(self, player: vlc.MediaPlayer, fade_seconds: int) -> None:
|
||||
@ -361,7 +360,9 @@ class _Music:
|
||||
self.player = vlc.MediaPlayer(vlc_instance, path)
|
||||
if self.player is None:
|
||||
log.error(f"_Music:play: failed to create MediaPlayer ({path=})")
|
||||
show_warning(None, "Error creating MediaPlayer", f"Cannot play file ({path})")
|
||||
show_warning(
|
||||
None, "Error creating MediaPlayer", f"Cannot play file ({path})"
|
||||
)
|
||||
return
|
||||
|
||||
_ = self.player.play()
|
||||
|
||||
@ -1061,7 +1061,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
if Config.USE_INTERNAL_BROWSER:
|
||||
self.tabInfolist.open_tab(url, title)
|
||||
else:
|
||||
webbrowser.get('browser').open_new_tab(url)
|
||||
webbrowser.get("browser").open_new_tab(url)
|
||||
|
||||
def open_wikipedia_browser(self, title: str) -> None:
|
||||
"""Search Wikipedia for title"""
|
||||
@ -1073,7 +1073,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
if Config.USE_INTERNAL_BROWSER:
|
||||
self.tabInfolist.open_tab(url, title)
|
||||
else:
|
||||
webbrowser.get('browser').open_new_tab(url)
|
||||
webbrowser.get("browser").open_new_tab(url)
|
||||
|
||||
def paste_rows(self) -> None:
|
||||
"""
|
||||
@ -1168,7 +1168,9 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
|
||||
# Show closing volume graph
|
||||
if track_sequence.current.fade_graph:
|
||||
log.debug(f"issue223: play_next: set up fade_graph, {track_sequence.current.title=}")
|
||||
log.debug(
|
||||
f"issue223: play_next: set up fade_graph, {track_sequence.current.title=}"
|
||||
)
|
||||
track_sequence.current.fade_graph.GraphWidget = self.widgetFadeVolume
|
||||
track_sequence.current.fade_graph.clear()
|
||||
track_sequence.current.fade_graph.plot()
|
||||
@ -1209,7 +1211,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
if not track_info:
|
||||
# Otherwise get track_id to next track to play
|
||||
if track_sequence.next:
|
||||
if track_sequence.next.path:
|
||||
if track_sequence.next.track_id:
|
||||
track_info = TrackInfo(
|
||||
track_sequence.next.track_id, track_sequence.next.row_number
|
||||
)
|
||||
@ -1421,7 +1423,8 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
return
|
||||
|
||||
# Return if no saved position
|
||||
if not track_sequence.previous.resume_marker:
|
||||
resume_marker = track_sequence.previous.resume_marker
|
||||
if not resume_marker:
|
||||
log.error("No previous track position")
|
||||
return
|
||||
|
||||
@ -1430,7 +1433,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
track_sequence.set_next(track_sequence.previous)
|
||||
|
||||
# Now resume playing the now-next track
|
||||
self.play_next(track_sequence.next.resume_marker)
|
||||
self.play_next(resume_marker)
|
||||
|
||||
# Adjust track info so that clocks and graph are correct.
|
||||
# We need to fake the start time to reflect where we resumed the
|
||||
|
||||
@ -884,7 +884,9 @@ class PlaylistModel(QAbstractTableModel):
|
||||
Move existing_rat track to new_row_number and append note to any existing note
|
||||
"""
|
||||
|
||||
log.debug(f"{self}: move_track_add_note({new_row_number=}, {existing_rat=}, {note=}")
|
||||
log.debug(
|
||||
f"{self}: move_track_add_note({new_row_number=}, {existing_rat=}, {note=}"
|
||||
)
|
||||
|
||||
if note:
|
||||
with db.Session() as session:
|
||||
@ -911,7 +913,9 @@ class PlaylistModel(QAbstractTableModel):
|
||||
Add the existing_rat track details to the existing header at header_row_number
|
||||
"""
|
||||
|
||||
log.debug(f"{self}: move_track_to_header({header_row_number=}, {existing_rat=}, {note=}")
|
||||
log.debug(
|
||||
f"{self}: move_track_to_header({header_row_number=}, {existing_rat=}, {note=}"
|
||||
)
|
||||
|
||||
if existing_rat.track_id:
|
||||
if note and existing_rat.note:
|
||||
@ -968,7 +972,9 @@ class PlaylistModel(QAbstractTableModel):
|
||||
|
||||
# Sanity check
|
||||
if not track_sequence.previous:
|
||||
log.error(f"{self}: playlistmodel:previous_track_ended called with no current track")
|
||||
log.error(
|
||||
f"{self}: playlistmodel:previous_track_ended called with no current track"
|
||||
)
|
||||
return
|
||||
if track_sequence.previous.row_number is None:
|
||||
log.error(
|
||||
@ -1243,7 +1249,9 @@ class PlaylistModel(QAbstractTableModel):
|
||||
PlaylistRows, self.playlist_rows[row_number].playlistrow_id
|
||||
)
|
||||
if not playlist_row:
|
||||
log.error(f"{self}: Error saving data: {row_number=}, {column=}, {value=}")
|
||||
log.error(
|
||||
f"{self}: Error saving data: {row_number=}, {column=}, {value=}"
|
||||
)
|
||||
return False
|
||||
|
||||
if playlist_row.track_id:
|
||||
@ -1294,7 +1302,9 @@ class PlaylistModel(QAbstractTableModel):
|
||||
shortlist_rows = {k: self.playlist_rows[k] for k in row_numbers}
|
||||
sorted_list = [
|
||||
playlist_row.row_number
|
||||
for playlist_row in sorted(shortlist_rows.values(), key=attrgetter(attr_name))
|
||||
for playlist_row in sorted(
|
||||
shortlist_rows.values(), key=attrgetter(attr_name)
|
||||
)
|
||||
]
|
||||
self.move_rows(sorted_list, min(sorted_list))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user