Add "shuffle" button
This commit is contained in:
parent
bf2e5956ba
commit
1481c8a50c
|
@ -86,6 +86,10 @@ def playlist_next():
|
||||||
def playlist_previous():
|
def playlist_previous():
|
||||||
return f"playlist/previous", None
|
return f"playlist/previous", None
|
||||||
|
|
||||||
|
@request_post
|
||||||
|
def playlist_shuffle():
|
||||||
|
return f"playlist/shuffle", None
|
||||||
|
|
||||||
@request_delete
|
@request_delete
|
||||||
def playlist_clear():
|
def playlist_clear():
|
||||||
return f"playlist", None
|
return f"playlist", None
|
||||||
|
|
|
@ -65,15 +65,27 @@ class RemiApp(App):
|
||||||
self.playlist = Namespace()
|
self.playlist = Namespace()
|
||||||
self.playlist.table = gui.Table(width="100%", margin="10px")
|
self.playlist.table = gui.Table(width="100%", margin="10px")
|
||||||
self.playlist.table.append_from_list([['#', 'Name', "length", "", "", ""]], fill_title=True)
|
self.playlist.table.append_from_list([['#', 'Name', "length", "", "", ""]], fill_title=True)
|
||||||
|
self.playlist.shuffle = gui.Button("SHUFFLE", height="1.8em")
|
||||||
|
self.playlist.shuffle.set_on_click_listener(self.on_playlist_clear_shuffle)
|
||||||
self.playlist.clear = gui.Button("CLEAR", height="1.8em")
|
self.playlist.clear = gui.Button("CLEAR", height="1.8em")
|
||||||
self.playlist.clear.set_on_click_listener(self.on_playlist_clear_click)
|
self.playlist.clear.set_on_click_listener(self.on_playlist_clear_click)
|
||||||
|
|
||||||
self.playlist.clear.style["background"] = f"linear-gradient(40deg,{COLOR_RED},{COLOR_ORANGE})"
|
self.playlist.clear.style["background"] = f"linear-gradient(40deg,{COLOR_RED},{COLOR_ORANGE})"
|
||||||
self.playlist.clear.style["font-size"] = "0.8em"
|
self.playlist.shuffle.style["background"] = f"linear-gradient(40deg,{COLOR_TEAL},{COLOR_GREEN})"
|
||||||
self.playlist.clear.style["margin-left"] = "auto"
|
for i in (self.playlist.shuffle, self.playlist.clear):
|
||||||
self.playlist.clear.style["margin-right"] = "0.5em"
|
i.style.update({
|
||||||
|
"font-size": "0.8em",
|
||||||
|
"margin-left": "0.25em",
|
||||||
|
"margin-right": "0.25em",
|
||||||
|
})
|
||||||
|
|
||||||
container.append(self.playlist.table)
|
container.append(self.playlist.table)
|
||||||
container.append(self.playlist.clear)
|
playlist_button_container = gui.HBox()
|
||||||
|
playlist_button_container.style["margin-left"] = "auto"
|
||||||
|
playlist_button_container.style["margin-right"] = "0.25em"
|
||||||
|
playlist_button_container.append(self.playlist.shuffle)
|
||||||
|
playlist_button_container.append(self.playlist.clear)
|
||||||
|
container.append(playlist_button_container)
|
||||||
|
|
||||||
#input
|
#input
|
||||||
container.append(gui.Label("Add song:"))
|
container.append(gui.Label("Add song:"))
|
||||||
|
@ -149,6 +161,9 @@ class RemiApp(App):
|
||||||
def on_table_item_remove_click(self, row_widget, playlist_item):
|
def on_table_item_remove_click(self, row_widget, playlist_item):
|
||||||
api.playlist_remove(playlist_item["index"])
|
api.playlist_remove(playlist_item["index"])
|
||||||
@call_as_thread
|
@call_as_thread
|
||||||
|
def on_playlist_clear_shuffle(self, row_widget):
|
||||||
|
api.playlist_shuffle()
|
||||||
|
@call_as_thread
|
||||||
def on_playlist_clear_click(self, row_widget):
|
def on_playlist_clear_click(self, row_widget):
|
||||||
api.playlist_clear()
|
api.playlist_clear()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue