diff --git a/wobuzz/library/library.py b/wobuzz/library/library.py index 1ec3d6f..cddfd17 100644 --- a/wobuzz/library/library.py +++ b/wobuzz/library/library.py @@ -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)