Added item flags so it is impossible to put other tracks into tracks.
This commit is contained in:
parent
da27963884
commit
5d6f67603a
1 changed files with 10 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from PyQt6.QtWidgets import QTabWidget, QTreeWidgetItem
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtWidgets import QTabWidget, QTreeWidgetItem, QAbstractItemView
|
||||
from player.playlist import Playlist
|
||||
from ui.library_dock import LibraryDock
|
||||
from ui.playlist import PlaylistView
|
||||
|
@ -34,9 +35,17 @@ class Library:
|
|||
|
||||
def create_playlist_view(self, playlist: Playlist):
|
||||
view = PlaylistView()
|
||||
view.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
|
||||
|
||||
for track in playlist.tracks:
|
||||
track_item = QTreeWidgetItem(view)
|
||||
|
||||
track_item.setFlags(
|
||||
Qt.ItemFlag.ItemIsEnabled |
|
||||
Qt.ItemFlag.ItemIsSelectable |
|
||||
Qt.ItemFlag.ItemIsDragEnabled
|
||||
)
|
||||
|
||||
track_item.track = track
|
||||
track_item.setText(1, track.tags.title)
|
||||
track_item.setText(2, track.tags.artist)
|
||||
|
|
Loading…
Reference in a new issue