trying to fix the queue this still

This commit is contained in:
JISAUAY committed 2025-01-31 16:29:36 -06:00
1 parent b08337f870
commit aa804e66d6
2 files changed
+27 -46

No files matched your search

+21 -15
View File
@@ -16,7 +16,7 @@ import SubSonic
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame
from rich.table import Table
from rich.table import Table, Column
from textual import on, events, work
from textual.reactive import reactive
@@ -333,13 +333,14 @@ class QueueTable(Widget):
return table
# Fine to be a static renderable because it's not big enough to need a scroll
class PlayingInfo(Widget):
def render(self) -> RenderResult:
table = Table()
table.add_column("")
table.add_column("")
table.add_column("", min_width=10)
table.show_header = False
if app.currently_playing:
@@ -354,6 +355,8 @@ class PlayingInfo(Widget):
return table
# https://textual.textualize.io/widgets/data_table/#labeled-rows
# Add this ^ to queue sometime plz
class MainView(Screen):
CSS_PATH = 'main.tcss'
@@ -365,16 +368,17 @@ class MainView(Screen):
yield PlayingInfo()
yield ProgressBar()
yield CoverArtPixels()
# with Vertical(classes="column"):
# yield Label("Queue")
yield VerticalScroll(QueueTable())
with Vertical(classes="column"):
yield Label("Queue")
yield DataTable(id="queue")
# yield VerticalScroll(QueueTable())
yield Footer()
def on_mount(self) -> None:
app.sub_title = "Overview"
# queueTable: DataTable = self.query_one("#queue")
# queueTable.cursor_type = "row"
# queueTable.add_columns("Title", "Album", "Artist", "Plays", "Duration", "Bitrate")
queueTable: DataTable = self.query_one("#queue")
queueTable.cursor_type = "row"
queueTable.add_columns("Title", "Album", "Artist", "Plays", "Duration", "Bitrate")
# currentlyPlaying: DataTable = self.query_one('#currently_playing')
# currentlyPlaying.cursor_type = "row"
@@ -385,14 +389,14 @@ class MainView(Screen):
app.sub_title = "Overview"
# Update Queue Table
# queueTable: DataTable = self.query_one('#queue')
# self._clear_table('#queue')
queueTable: DataTable = self.query_one('#queue')
self._clear_table('#queue')
# queue: list[SubSonic.Song] = []
# queue.extend(app.user_queue)
# queue.extend(app.song_queue)
# for song in queue:
# queueTable.add_row(song.title, song.album, song.artist, song.playCount, song.duration, song.bitRate)
queue: list[SubSonic.Song] = []
queue.extend(app.user_queue)
queue.extend(app.song_queue)
for song in queue:
queueTable.add_row(song.title, song.album, song.artist, song.playCount, song.duration, song.bitRate)
# Update Currently Playing Table
# self._clear_table('#currently_playing')
@@ -526,10 +530,12 @@ class TextualSubpyPlayer(App):
return None
if not self.is_paused:
self.notify("Playback paused")
self.place = pygame.mixer.music.get_pos()
pygame.mixer.music.pause()
self.is_paused = True
else:
self.notify("Resuming Playback")
pygame.mixer.music.unpause()
self.is_paused = False