forked from Wobbl/Wobuzz
Moved playlist tabs related widgets to its own files.
This commit is contained in:
parent
9d844ae2dd
commit
649ad1d647
5 changed files with 97 additions and 78 deletions
35
wobuzz/ui/playlist_tabs/tab_bar.py
Normal file
35
wobuzz/ui/playlist_tabs/tab_bar.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from PyQt6.QtGui import QDragEnterEvent
|
||||
from PyQt6.QtWidgets import QTabBar
|
||||
|
||||
|
||||
class PlaylistTabBar(QTabBar):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.tab_widget = parent
|
||||
self.app = parent.library.app
|
||||
|
||||
self.setAcceptDrops(True)
|
||||
|
||||
self.tabBarClicked.connect(self.on_click)
|
||||
self.tabBarDoubleClicked.connect(self.on_doubleclick)
|
||||
|
||||
def dragEnterEvent(self, event: QDragEnterEvent):
|
||||
index = self.tabAt(event.position().toPoint())
|
||||
|
||||
self.tab_widget.setCurrentIndex(index)
|
||||
|
||||
def on_click(self, index):
|
||||
playlist_view = self.tab_widget.widget(index)
|
||||
playlist = playlist_view.playlist
|
||||
|
||||
self.app.gui.clicked_playlist = playlist
|
||||
|
||||
def on_doubleclick(self, index):
|
||||
playlist_view = self.tab_widget.widget(index)
|
||||
playlist = playlist_view.playlist
|
||||
|
||||
self.app.player.start_playlist(playlist)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue