Black formatting and mypy fixups
This commit is contained in:
parent
27012a9658
commit
b8fcc79f8e
@ -184,7 +184,6 @@ class _FadeCurve:
|
|||||||
|
|
||||||
|
|
||||||
class _FadeTrack(QThread):
|
class _FadeTrack(QThread):
|
||||||
|
|
||||||
finished = pyqtSignal()
|
finished = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, player: vlc.MediaPlayer, fade_seconds: int) -> None:
|
def __init__(self, player: vlc.MediaPlayer, fade_seconds: int) -> None:
|
||||||
@ -361,7 +360,9 @@ class _Music:
|
|||||||
self.player = vlc.MediaPlayer(vlc_instance, path)
|
self.player = vlc.MediaPlayer(vlc_instance, path)
|
||||||
if self.player is None:
|
if self.player is None:
|
||||||
log.error(f"_Music:play: failed to create MediaPlayer ({path=})")
|
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
|
return
|
||||||
|
|
||||||
_ = self.player.play()
|
_ = self.player.play()
|
||||||
|
|||||||
@ -1061,7 +1061,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if Config.USE_INTERNAL_BROWSER:
|
if Config.USE_INTERNAL_BROWSER:
|
||||||
self.tabInfolist.open_tab(url, title)
|
self.tabInfolist.open_tab(url, title)
|
||||||
else:
|
else:
|
||||||
webbrowser.get('browser').open_new_tab(url)
|
webbrowser.get("browser").open_new_tab(url)
|
||||||
|
|
||||||
def open_wikipedia_browser(self, title: str) -> None:
|
def open_wikipedia_browser(self, title: str) -> None:
|
||||||
"""Search Wikipedia for title"""
|
"""Search Wikipedia for title"""
|
||||||
@ -1073,7 +1073,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if Config.USE_INTERNAL_BROWSER:
|
if Config.USE_INTERNAL_BROWSER:
|
||||||
self.tabInfolist.open_tab(url, title)
|
self.tabInfolist.open_tab(url, title)
|
||||||
else:
|
else:
|
||||||
webbrowser.get('browser').open_new_tab(url)
|
webbrowser.get("browser").open_new_tab(url)
|
||||||
|
|
||||||
def paste_rows(self) -> None:
|
def paste_rows(self) -> None:
|
||||||
"""
|
"""
|
||||||
@ -1168,7 +1168,9 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
# Show closing volume graph
|
# Show closing volume graph
|
||||||
if track_sequence.current.fade_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.GraphWidget = self.widgetFadeVolume
|
||||||
track_sequence.current.fade_graph.clear()
|
track_sequence.current.fade_graph.clear()
|
||||||
track_sequence.current.fade_graph.plot()
|
track_sequence.current.fade_graph.plot()
|
||||||
@ -1209,7 +1211,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if not track_info:
|
if not track_info:
|
||||||
# Otherwise get track_id to next track to play
|
# Otherwise get track_id to next track to play
|
||||||
if track_sequence.next:
|
if track_sequence.next:
|
||||||
if track_sequence.next.path:
|
if track_sequence.next.track_id:
|
||||||
track_info = TrackInfo(
|
track_info = TrackInfo(
|
||||||
track_sequence.next.track_id, track_sequence.next.row_number
|
track_sequence.next.track_id, track_sequence.next.row_number
|
||||||
)
|
)
|
||||||
@ -1421,7 +1423,8 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Return if no saved position
|
# 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")
|
log.error("No previous track position")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1430,7 +1433,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
track_sequence.set_next(track_sequence.previous)
|
track_sequence.set_next(track_sequence.previous)
|
||||||
|
|
||||||
# Now resume playing the now-next track
|
# 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.
|
# Adjust track info so that clocks and graph are correct.
|
||||||
# We need to fake the start time to reflect where we resumed the
|
# 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
|
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:
|
if note:
|
||||||
with db.Session() as session:
|
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
|
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 existing_rat.track_id:
|
||||||
if note and existing_rat.note:
|
if note and existing_rat.note:
|
||||||
@ -968,7 +972,9 @@ class PlaylistModel(QAbstractTableModel):
|
|||||||
|
|
||||||
# Sanity check
|
# Sanity check
|
||||||
if not track_sequence.previous:
|
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
|
return
|
||||||
if track_sequence.previous.row_number is None:
|
if track_sequence.previous.row_number is None:
|
||||||
log.error(
|
log.error(
|
||||||
@ -1243,7 +1249,9 @@ class PlaylistModel(QAbstractTableModel):
|
|||||||
PlaylistRows, self.playlist_rows[row_number].playlistrow_id
|
PlaylistRows, self.playlist_rows[row_number].playlistrow_id
|
||||||
)
|
)
|
||||||
if not playlist_row:
|
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
|
return False
|
||||||
|
|
||||||
if playlist_row.track_id:
|
if playlist_row.track_id:
|
||||||
@ -1294,7 +1302,9 @@ class PlaylistModel(QAbstractTableModel):
|
|||||||
shortlist_rows = {k: self.playlist_rows[k] for k in row_numbers}
|
shortlist_rows = {k: self.playlist_rows[k] for k in row_numbers}
|
||||||
sorted_list = [
|
sorted_list = [
|
||||||
playlist_row.row_number
|
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))
|
self.move_rows(sorted_list, min(sorted_list))
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user