debug markers to investigate #137

This commit is contained in:
Keith Edmunds 2022-10-14 15:50:13 +01:00
parent 4357e0e038
commit bf67866f8a
2 changed files with 11 additions and 12 deletions

View File

@ -260,7 +260,7 @@ class Window(QMainWindow, Ui_MainWindow):
def debug(self):
"""Invoke debugger"""
import ipdb
import ipdb # type: ignore
ipdb.set_trace()
def disable_play_next_controls(self) -> None:

View File

@ -415,7 +415,7 @@ class PlaylistTab(QTableWidget):
# Determin cell type changed
with Session() as session:
if self.edit_cell_type == "row_notes":
if self.edit_cell_type == ROW_NOTES:
# Get playlistrow object
plr_id = self._get_playlistrow_id(row)
plr_item = session.get(PlaylistRows, plr_id)
@ -434,9 +434,10 @@ class PlaylistTab(QTableWidget):
if track:
update_current = row == self._get_current_track_row()
update_next = row == self._get_next_track_row()
if self.edit_cell_type == "title":
if self.edit_cell_type == TITLE:
log.debug(f"KAE: _cell_changed:438, {new_text=}")
track.title = new_text
elif self.edit_cell_type == "artist":
elif self.edit_cell_type == ARTIST:
track.artist = new_text
if update_current:
self.musicmuster.update_current_track(track)
@ -487,25 +488,21 @@ class PlaylistTab(QTableWidget):
# If a track row, we only allow editing of title, artist and
# note. Check that this column is one of those.
self.edit_cell_type = None
if column == TITLE:
self.edit_cell_type = "title"
elif column == ARTIST:
self.edit_cell_type = "artist"
elif column == ROW_NOTES:
self.edit_cell_type = "row_notes"
if column in [TITLE, ARTIST, ROW_NOTES]:
self.edit_cell_type = column
else:
# Can't edit other columns
return False
# Check whether we're editing a notes row for later
if self.edit_cell_type == "row_notes":
if self.edit_cell_type == ROW_NOTES:
note_column = ROW_NOTES
else:
# This is a section header.
if column != HEADER_NOTES_COLUMN:
return False
note_column = HEADER_NOTES_COLUMN
self.edit_cell_type = "row_notes"
self.edit_cell_type = ROW_NOTES
# Disable play controls so that keyboard input doesn't
# disturb playing
@ -615,6 +612,7 @@ class PlaylistTab(QTableWidget):
self.setItem(row, START_GAP, start_gap_item)
title_item = QTableWidgetItem(row_data.track.title)
log.debug(f"KAE: insert_row:615, {title_item.text()=}")
self.setItem(row, TITLE, title_item)
artist_item = QTableWidgetItem(row_data.track.artist)
@ -1957,6 +1955,7 @@ class PlaylistTab(QTableWidget):
item_startgap.setBackground(QColor("white"))
item_title = self.item(row, TITLE)
log.debug(f"KAE: _update_row:1958, {track.title=}")
item_title.setText(track.title)
item_artist = self.item(row, ARTIST)