✨ feat(ui): add placeholder for player mini when no players are active
This commit is contained in:
3 files changed
+65
-20
No files matched your search
+15
-15
@@ -1,27 +1,27 @@
|
||||
$wallpaper = /home/sankalp/Pictures/wallpapers/1.png
|
||||
$background = 1a1110
|
||||
$foreground = f1dfdb
|
||||
$wallpaper = /home/sankalp/Pictures/wallpapers/spidy2.jpg
|
||||
$background = 161217
|
||||
$foreground = eae0e7
|
||||
|
||||
$primary = ffb4a5
|
||||
$secondary = e7bdb5
|
||||
$tertiary = dcc48c
|
||||
$surface = 1a1110
|
||||
$surface_bright = 423734
|
||||
$outline = a08c88
|
||||
$primary = e7b6f0
|
||||
$secondary = d5c0d6
|
||||
$tertiary = f5b7b2
|
||||
$surface = 161217
|
||||
$surface_bright = 3d373d
|
||||
$outline = 988e97
|
||||
$error = ff5945
|
||||
|
||||
$shadow = 000000
|
||||
|
||||
$red = ffb4a7
|
||||
$red = ffb2b9
|
||||
$green = b7d085
|
||||
$yellow = dec56e
|
||||
$blue = cebdfe
|
||||
$magenta = fcb0d5
|
||||
$cyan = 84d5c4
|
||||
$magenta = ecb4ec
|
||||
$cyan = 82d3e2
|
||||
$white = 82d3e0
|
||||
$red_dim = ff5d41
|
||||
$red_dim = ff4c5c
|
||||
$green_dim = 89ad42
|
||||
$yellow_dim = bb9b2b
|
||||
$blue_dim = 8359fc
|
||||
$magenta_dim = f84ea1
|
||||
$cyan_dim = 3eb59c
|
||||
$magenta_dim = d763d7
|
||||
$cyan_dim = 30b5ce
|
||||
@@ -183,4 +183,4 @@ class DashboardWindow(Window):
|
||||
all_visible=True,
|
||||
)
|
||||
|
||||
self.hide()
|
||||
# self.hide()
|
||||
@@ -96,7 +96,7 @@ class PlayerMini(Box):
|
||||
|
||||
self.album_cover = Box(style_classes="album-image")
|
||||
self.album_cover.set_style(
|
||||
f"background-image:url('{data.HOME_DIR}/.current_wall')"
|
||||
f"background-image:url('{data.HOME_DIR}/.current.wall')"
|
||||
)
|
||||
|
||||
self.children = [
|
||||
@@ -188,7 +188,7 @@ class PlayerMini(Box):
|
||||
def on_metadata(self, sender, metadata, player):
|
||||
keys = metadata.keys()
|
||||
if "xesam:artist" in keys and "xesam:title" in keys:
|
||||
# _max_chars = 20 if not info.VERTICAL else 30
|
||||
# _max_chars = 20 if not data.VERTICAL else 30
|
||||
song_title = metadata["xesam:title"]
|
||||
# if len(song_title) > _max_chars:
|
||||
# song_title = song_title[: _max_chars - 1] + "…"
|
||||
@@ -290,6 +290,45 @@ class PlayerMini(Box):
|
||||
shuffle_button.get_child().set_style("color: var(--outline)")
|
||||
|
||||
|
||||
class PlacheholderMini(Box):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(style_classes="player-mini", **kwargs)
|
||||
|
||||
self.set_style(f"background-image:url('{data.HOME_DIR}/.current.wall')")
|
||||
self.album_cover = Box(style_classes="album-image")
|
||||
self.album_cover.set_style(
|
||||
f"background-image:url('{data.HOME_DIR}/.current.wall')"
|
||||
)
|
||||
self.player_name = Label(
|
||||
style_classes=["player-icon", "mini"], markup=icons.disc
|
||||
)
|
||||
|
||||
self.children = [
|
||||
self.album_cover,
|
||||
Box(
|
||||
name="source",
|
||||
style_classes="mini",
|
||||
v_align="end",
|
||||
children=self.player_name,
|
||||
),
|
||||
Box(
|
||||
orientation="v",
|
||||
v_expand=True,
|
||||
h_expand=True,
|
||||
style="padding-left:10px;",
|
||||
v_align="center",
|
||||
children=[
|
||||
CenterBox(
|
||||
name="details",
|
||||
center_children=Label(
|
||||
label="Nothing Playing", style="color:black;"
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
class PlayerContainerMini(Box):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(name="player-container", style_classes="mini", **kwargs)
|
||||
@@ -297,11 +336,12 @@ class PlayerContainerMini(Box):
|
||||
self.manager = PlayerManager()
|
||||
self.manager.connect("new-player", self.new_player)
|
||||
self.manager.connect("player-vanish", self.on_player_vanish)
|
||||
self.placeholder = PlacheholderMini()
|
||||
self.stack = Stack(
|
||||
# name="player-container",
|
||||
transition_type="crossfade",
|
||||
transition_duration=100,
|
||||
children=[],
|
||||
children=[self.placeholder],
|
||||
)
|
||||
|
||||
self.player_stack = Stack(
|
||||
@@ -351,8 +391,10 @@ class PlayerContainerMini(Box):
|
||||
new_player.wiggly_bar.queue_draw()
|
||||
new_player.set_name(player.props.player_name)
|
||||
self.players.append(new_player)
|
||||
print("stacking dis bitvch")
|
||||
print("stacking mini", player.props.player_name)
|
||||
self.stack.add_named(new_player, player.props.player_name)
|
||||
if len(self.players) == 1:
|
||||
self.stack.remove(self.placeholder)
|
||||
|
||||
self.player_switch_container.add_center(
|
||||
Button(
|
||||
@@ -381,6 +423,9 @@ class PlayerContainerMini(Box):
|
||||
self.update_player_list()
|
||||
break
|
||||
|
||||
if len(self.players) == 0:
|
||||
self.stack.add_named(self.placeholder, "placeholder")
|
||||
|
||||
def update_player_list(self):
|
||||
curr = self.stack.get_visible_child()
|
||||
for btn in self.player_switch_container.center_children:
|
||||
|
||||
Reference in new issue
Block a user