43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
|
#!/usr/bin/python3
|
||
|
|
||
|
from PyQt6.QtWidgets import QTreeWidget, QAbstractItemView
|
||
|
|
||
|
from ..playlist_view import PlaylistView
|
||
|
|
||
|
|
||
|
class ArtistView(PlaylistView):
|
||
|
def __init__(self, playlist, library_widget, parent=None):
|
||
|
QTreeWidget.__init__(self, parent)
|
||
|
|
||
|
self.playlist = playlist
|
||
|
self.library_widget = library_widget
|
||
|
|
||
|
self.app = playlist.app
|
||
|
|
||
|
self.header = self.header()
|
||
|
self.header.setSectionsClickable(True)
|
||
|
self.header.setSortIndicatorShown(True)
|
||
|
|
||
|
playlist.views[id(self.library_widget)] = self # let the playlist know that this view exists
|
||
|
|
||
|
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||
|
|
||
|
self.setColumnCount(3)
|
||
|
|
||
|
headers = [
|
||
|
"#",
|
||
|
"Title",
|
||
|
"Artist",
|
||
|
"Album",
|
||
|
]
|
||
|
|
||
|
self.setHeaderLabels(headers)
|
||
|
|
||
|
self.itemActivated.connect(self.on_track_activation)
|
||
|
self.header.sectionClicked.connect(self.on_header_click)
|
||
|
self.sort_signal.connect(self.sortItems)
|
||
|
|
||
|
def setDragDropMode(self, behavior):
|
||
|
pass # user should not be able to sort the playlist manually
|
||
|
|