forked from Wobbl/Wobuzz
Did some memory optimisation, moved some files and created a completely not tested gui class that will list an artist's tracks.
Made tracks return an already existing object when they get created with a path of an already existing track object.
This commit is contained in:
parent
9ae1704e4a
commit
7edaebc3c3
7 changed files with 77 additions and 4 deletions
1
wobuzz/ui/library/__init__.py
Normal file
1
wobuzz/ui/library/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
#!/usr/bin/python3
|
42
wobuzz/ui/library/artist_view.py
Normal file
42
wobuzz/ui/library/artist_view.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from PyQt6.QtWidgets import QTreeWidget, QAbstractItemView
|
||||
|
||||
from ..playlist_view import PlaylistView
|
||||
|
||||
|
||||
class ArtistView(PlaylistView):
|
||||
def __init__(self, playlist, library_widget, parent=None):
|
||||
QTreeWidget.__init__(self, parent)
|
||||
|
||||
self.playlist = playlist
|
||||
self.library_widget = library_widget
|
||||
|
||||
self.app = playlist.app
|
||||
|
||||
self.header = self.header()
|
||||
self.header.setSectionsClickable(True)
|
||||
self.header.setSortIndicatorShown(True)
|
||||
|
||||
playlist.views[id(self.library_widget)] = self # let the playlist know that this view exists
|
||||
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
|
||||
self.setColumnCount(3)
|
||||
|
||||
headers = [
|
||||
"#",
|
||||
"Title",
|
||||
"Artist",
|
||||
"Album",
|
||||
]
|
||||
|
||||
self.setHeaderLabels(headers)
|
||||
|
||||
self.itemActivated.connect(self.on_track_activation)
|
||||
self.header.sectionClicked.connect(self.on_header_click)
|
||||
self.sort_signal.connect(self.sortItems)
|
||||
|
||||
def setDragDropMode(self, behavior):
|
||||
pass # user should not be able to sort the playlist manually
|
||||
|
35
wobuzz/ui/library/library.py
Normal file
35
wobuzz/ui/library/library.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from PyQt6.QtGui import QIcon
|
||||
from PyQt6.QtWidgets import QToolBox, QLabel, QToolButton
|
||||
from wobuzz.ui.playlist_tabs import PlaylistTabs
|
||||
|
||||
|
||||
class LibraryWidget(QToolBox):
|
||||
def __init__(self, library, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.library = library
|
||||
|
||||
self.playlist_tabs = PlaylistTabs(library)
|
||||
|
||||
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()
|
||||
self.addItem(label, "Albums")
|
||||
label = QLabel()
|
||||
self.addItem(label, "Artists")
|
||||
label = QLabel()
|
||||
self.addItem(label, "Tracks")
|
||||
|
||||
self.create_playlist.pressed.connect(self.library.new_playlist)
|
||||
|
17
wobuzz/ui/library/library_dock.py
Normal file
17
wobuzz/ui/library/library_dock.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from PyQt6.QtWidgets import QDockWidget
|
||||
from wobuzz.ui.library import LibraryWidget
|
||||
|
||||
|
||||
class LibraryDock(QDockWidget):
|
||||
def __init__(self, library, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.library = library
|
||||
|
||||
self.setAcceptDrops(True)
|
||||
|
||||
self.library_widget = Library(library, self)
|
||||
self.setWidget(self.library_widget)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue