Implemented playing of different playlist, but its buggy.

This commit is contained in:
The Wobbler 2025-01-25 22:59:19 +01:00
parent 744d050bac
commit 2b1310990a
3 changed files with 23 additions and 7 deletions

View file

@ -1,10 +1,12 @@
#!/usr/bin/python3
from PyQt6.QtGui import QDragEnterEvent
from PyQt6.QtGui import QDragEnterEvent, QMouseEvent
from PyQt6.QtWidgets import QTabWidget, QTabBar
class PlaylistTabs(QTabWidget):
def __init__(self, parent=None):
def __init__(self, library, parent=None):
self.library = library
super().__init__(parent)
self.setTabBar(PlaylistTabBar(self))
@ -18,11 +20,20 @@ class PlaylistTabBar(QTabBar):
super().__init__(parent)
self.tab_widget = parent
self.app = parent.library.app
self.setAcceptDrops(True)
def dragEnterEvent(self, event: QDragEnterEvent):
tab = self.tabAt(event.position().toPoint())
index = self.tabAt(event.position().toPoint())
self.tab_widget.setCurrentIndex(tab)
self.tab_widget.setCurrentIndex(index)
def mouseDoubleClickEvent(self, event: QMouseEvent):
index = self.tabAt(event.position().toPoint())
playlist_view = self.tab_widget.widget(index)
playlist = playlist_view.playlist
self.app.player.current_playlist = playlist