Save playlist column widths correctly

This commit is contained in:
Keith Edmunds 2021-07-03 10:15:39 +01:00
parent 8838c23c59
commit 199dada246

View File

@ -91,19 +91,6 @@ class PlaylistTab(QTableWidget):
# ########## Events ##########
def closeEvent(self, event):
"Save column widths"
for column in range(self.columnCount()):
width = self.columnWidth(column)
name = f"playlist_col_{str(column)}_width"
with Session() as session:
record = Settings.get_int(session, name)
if record.f_int != self.columnWidth(column):
record.update(session, {'f_int': width})
event.accept()
def dropEvent(self, event: QDropEvent):
if not event.isAccepted() and event.source() == self:
drop_row = self._drop_on(event)
@ -170,6 +157,16 @@ class PlaylistTab(QTableWidget):
# ########## Externally called functions ##########
def close(self, session):
"Save column widths"
for column in range(self.columnCount()):
width = self.columnWidth(column)
name = f"playlist_col_{str(column)}_width"
record = Settings.get_int(session, name)
if record.f_int != self.columnWidth(column):
record.update(session, {'f_int': width})
def insert_note(self, session, note, repaint=True):
"""
Add note to playlist