Compare commits

..

No commits in common. "f19fc2e8c0a0739effbf03b6f8e01cc5995e6d73" and "4c420d01ca68338ad6581543cfba67ab701ce60d" have entirely different histories.

5 changed files with 22 additions and 30 deletions

View File

@ -534,7 +534,6 @@ class RowAndTrack:
return (
f"<RowAndTrack(playlist_id={self.playlist_id}, "
f"row_number={self.row_number}, "
f"playlistrow_id={self.playlistrow_id}, "
f"note={self.note}, track_id={self.track_id}>"
)

View File

@ -8,6 +8,7 @@ import sys
# PyQt imports
# Third party imports
import line_profiler
from sqlalchemy import (
bindparam,
delete,
@ -563,6 +564,7 @@ class PlaylistRows(dbtables.PlaylistRowsTable):
)
@staticmethod
@line_profiler.profile
def update_plr_row_numbers(
session: Session, playlist_id: int, sqla_map: List[dict[str, int]]
) -> None:

View File

@ -44,6 +44,7 @@ from PyQt6.QtWidgets import (
)
# Third party imports
import line_profiler
import pipeclient
from pygame import mixer
from sqlalchemy.exc import IntegrityError
@ -1068,7 +1069,8 @@ class Window(QMainWindow, Ui_MainWindow):
else:
webbrowser.get("browser").open_new_tab(url)
def paste_rows(self) -> None:
@line_profiler.profile
def paste_rows(self, dummy_for_profiling=None) -> None:
"""
Paste earlier cut rows.
"""
@ -1083,16 +1085,6 @@ class Window(QMainWindow, Ui_MainWindow):
else:
destination_row = self.active_proxy_model().rowCount()
# If we move a row to immediately under the current track, make
# that moved row the next track
set_next_row: Optional[int] = None
if (
track_sequence.current
and track_sequence.current.playlist_id == to_playlist_model.playlist_id
and destination_row == track_sequence.current.row_number + 1
):
set_next_row = destination_row
if (
to_playlist_model.playlist_id
== self.move_source_model.source_model.playlist_id
@ -1105,9 +1097,6 @@ class Window(QMainWindow, Ui_MainWindow):
self.active_tab().resize_rows()
self.active_tab().clear_selection()
if set_next_row:
to_playlist_model.set_next_row(set_next_row)
def play_next(self, position: Optional[float] = None) -> None:
"""
Play next track, optionally from passed position.

View File

@ -26,6 +26,7 @@ from PyQt6.QtGui import (
)
# Third party imports
import line_profiler
import obswebsocket # type: ignore
# import snoop # type: ignore
@ -736,7 +737,8 @@ class PlaylistModel(QAbstractTableModel):
self.update_track_times()
self.invalidate_rows(row_numbers)
def move_rows(self, from_rows: list[int], to_row_number: int) -> None:
@line_profiler.profile
def move_rows(self, from_rows: list[int], to_row_number: int, dummy_for_profiling=None) -> None:
"""
Move the playlist rows given to to_row and below.
"""
@ -783,6 +785,18 @@ class PlaylistModel(QAbstractTableModel):
if old_row != new_row:
row_map[old_row] = new_row
# Check to see whether any rows in track_sequence have moved
if track_sequence.previous and track_sequence.previous.row_number in row_map:
track_sequence.previous.row_number = row_map[
track_sequence.previous.row_number
]
if track_sequence.current and track_sequence.current.row_number in row_map:
track_sequence.current.row_number = row_map[
track_sequence.current.row_number
]
if track_sequence.next and track_sequence.next.row_number in row_map:
track_sequence.next.row_number = row_map[track_sequence.next.row_number]
# For SQLAlchemy, build a list of dictionaries that map playlistrow_id to
# new row number:
sqla_map: list[dict[str, int]] = []
@ -975,7 +989,8 @@ class PlaylistModel(QAbstractTableModel):
# Update display
self.invalidate_row(track_sequence.previous.row_number)
def refresh_data(self, session: db.session) -> None:
@line_profiler.profile
def refresh_data(self, session: db.session, dummy_for_profiling=None) -> None:
"""Populate self.playlist_rows with playlist data"""
# We used to clear self.playlist_rows each time but that's

View File

@ -296,15 +296,6 @@ class PlaylistTab(QTableView):
and 0 <= max(from_rows) <= self.source_model.rowCount()
and 0 <= to_model_row <= self.source_model.rowCount()
):
# If we move a row to immediately under the current track, make
# that moved row the next track
set_next_row: Optional[int] = None
if (
track_sequence.current
and to_model_row == track_sequence.current.row_number + 1
):
set_next_row = to_model_row
self.source_model.move_rows(from_rows, to_model_row)
# Reset drag mode to allow row selection by dragging
@ -316,10 +307,6 @@ class PlaylistTab(QTableView):
# Resize rows
self.resize_rows()
# Set next row if we are immediately under current row
if set_next_row:
self.source_model.set_next_row(set_next_row)
event.accept()
def mouseReleaseEvent(self, event):