Made drag n drop activate just when the playlist is fully loaded.

This commit is contained in:
The Wobbler 2025-02-19 18:57:23 +01:00
parent d8f885959b
commit db191cbc44
3 changed files with 9 additions and 2 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/python3
import os
from PyQt6.QtWidgets import QTabWidget
from PyQt6.QtWidgets import QTabWidget, QAbstractItemView
from ..player.playlist import Playlist
from ..ui.library_dock import LibraryDock
from ..ui.playlist import PlaylistView
@ -75,5 +75,7 @@ class Library:
playlist_tabs: QTabWidget = library_dock.library_widget.playlist_tabs
playlist_view = PlaylistView(playlist, library_dock)
playlist_view.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove) # enable drag n drop
playlist_tabs.addTab(playlist_view, playlist.title)

View file

@ -4,6 +4,7 @@ import os
import threading
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QAbstractItemView
from .track import Track
@ -65,6 +66,11 @@ class Playlist:
elif isinstance(self.load_from, list): # if it's created from tracks
self.load_from_paths(self.load_from)
for dock_id in self.views: # enable drag and drop on every view
view = self.views[dock_id]
view.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
def load_from_m3u(self, path):
file = open(path, "r")
m3u = file.read()

View file

@ -24,7 +24,6 @@ class PlaylistView(QTreeWidget):
playlist.views[id(dock)] = self
self.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
self.setColumnCount(4)