Added a button that adds a playlist.

This commit is contained in:
The Wobbler 2025-01-25 21:46:48 +01:00
parent 1007ac045f
commit 31e72c25d3
6 changed files with 57 additions and 9 deletions

View file

@ -1,15 +1,28 @@
#!/usr/bin/python3
from PyQt6.QtWidgets import QToolBox, QLabel, QFrame, QTabWidget
from PyQt6.QtCore import Qt
from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import QToolBox, QLabel, QTabWidget, QToolButton
class Library(QToolBox):
def __init__(self, parent=None):
def __init__(self, library, parent=None):
super().__init__(parent)
self.library = library
self.playlist_tabs = QTabWidget()
self.playlist_tabs.setMovable(True)
self.addItem(self.playlist_tabs, "Playlists")
self.create_playlist = QToolButton(self)
plus_icon = QIcon.fromTheme(QIcon.ThemeIcon.ListAdd)
self.create_playlist.setIcon(plus_icon)
self.playlist_tabs.setCornerWidget(self.create_playlist)
label = QLabel()
self.addItem(label, "Genres")
label = QLabel()
@ -19,3 +32,5 @@ class Library(QToolBox):
label = QLabel()
self.addItem(label, "Tracks")
self.create_playlist.pressed.connect(self.library.new_playlist)

View file

@ -6,15 +6,17 @@ from .library import Library
class LibraryDock(QDockWidget):
def __init__(self, parent=None):
def __init__(self, library, parent=None):
super().__init__(parent)
self.library = library
self.setAllowedAreas(
Qt.DockWidgetArea.LeftDockWidgetArea |
Qt.DockWidgetArea.RightDockWidgetArea |
Qt.DockWidgetArea.BottomDockWidgetArea
)
self.library = Library(self)
self.setWidget(self.library)
self.library_widget = Library(library, self)
self.setWidget(self.library_widget)

View file

@ -11,6 +11,8 @@ class TrackControl(QToolBar):
self.app = app
self.setWindowTitle("Track Control")
self.play_icon = QIcon.fromTheme(QIcon.ThemeIcon.MediaPlaybackStart)
self.pause_icon = QIcon.fromTheme(QIcon.ThemeIcon.MediaPlaybackPause)