forked from Wobbl/Wobuzz
Implemented sorting by track title, artist name etc...
(Sorting order is not getting saved.)
This commit is contained in:
parent
1b69321c05
commit
3dd9123332
3 changed files with 100 additions and 21 deletions
|
@ -18,6 +18,7 @@ class TrackItem(QTreeWidgetItem):
|
|||
self.track = track
|
||||
self.index_user_sort = index
|
||||
self.index = index
|
||||
self.parent = parent
|
||||
|
||||
self.playlist = parent.playlist
|
||||
|
||||
|
@ -48,10 +49,20 @@ class TrackItem(QTreeWidgetItem):
|
|||
self.setFont(2, self.bold_font)
|
||||
self.setFont(3, self.normal_font)
|
||||
|
||||
|
||||
def unmark(self):
|
||||
self.setIcon(0, QIcon(None))
|
||||
self.setFont(1, self.normal_font)
|
||||
self.setFont(2, self.normal_font)
|
||||
self.setFont(3, self.normal_font)
|
||||
|
||||
def __lt__(self, other):
|
||||
# make numeric strings get sorted the right way
|
||||
|
||||
column = self.parent.sortColumn()
|
||||
|
||||
if column == 0 or column == 4:
|
||||
return int(self.text(column)) < int(other.text(column))
|
||||
|
||||
else:
|
||||
return super().__lt__(other)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue