Expanded Player formatting
This commit is contained in:
1 parent
cc5a116efb
commit
b5211b3446
2 files changed
+49
-48
No files matched your search
@@ -14,7 +14,6 @@ from typing import List
|
|||||||
import threading
|
import threading
|
||||||
|
|
||||||
from fabric.utils import bulk_connect, invoke_repeater, cooldown
|
from fabric.utils import bulk_connect, invoke_repeater, cooldown
|
||||||
from fabric.widgets.centerbox import CenterBox
|
|
||||||
from fabric.widgets.image import Image
|
from fabric.widgets.image import Image
|
||||||
from fabric.widgets.overlay import Overlay
|
from fabric.widgets.overlay import Overlay
|
||||||
from fabric.widgets.stack import Stack
|
from fabric.widgets.stack import Stack
|
||||||
@@ -196,6 +195,7 @@ class PlayerBoxStack(Box):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from gi.repository import GdkPixbuf
|
from gi.repository import GdkPixbuf
|
||||||
|
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
||||||
fallback_cover_path, 80, 80, True
|
fallback_cover_path, 80, 80, True
|
||||||
)
|
)
|
||||||
@@ -538,6 +538,7 @@ class PlayerBox(Box):
|
|||||||
# Set fallback image immediately with proper scaling
|
# Set fallback image immediately with proper scaling
|
||||||
try:
|
try:
|
||||||
from gi.repository import GdkPixbuf
|
from gi.repository import GdkPixbuf
|
||||||
|
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
||||||
self.fallback_cover_path, 80, 80, True
|
self.fallback_cover_path, 80, 80, True
|
||||||
)
|
)
|
||||||
@@ -554,7 +555,10 @@ class PlayerBox(Box):
|
|||||||
self.album_cover.set_size_request(80, 80)
|
self.album_cover.set_size_request(80, 80)
|
||||||
|
|
||||||
self.image_stack = Box(
|
self.image_stack = Box(
|
||||||
h_align="start", v_align="start", name="macos-player-image-stack"
|
h_align="start",
|
||||||
|
v_align="start",
|
||||||
|
h_expand=False, # Fixed width for album art
|
||||||
|
name="macos-player-image-stack"
|
||||||
)
|
)
|
||||||
self.image_stack.children = [*self.image_stack.children, self.album_cover]
|
self.image_stack.children = [*self.image_stack.children, self.album_cover]
|
||||||
|
|
||||||
@@ -616,6 +620,7 @@ class PlayerBox(Box):
|
|||||||
self.button_box = Box(
|
self.button_box = Box(
|
||||||
name="macos-button-box",
|
name="macos-button-box",
|
||||||
h_align="center",
|
h_align="center",
|
||||||
|
h_expand=True,
|
||||||
spacing=15, # Wider spacing for macOS look
|
spacing=15, # Wider spacing for macOS look
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -623,19 +628,21 @@ class PlayerBox(Box):
|
|||||||
self.controls_box = Box(
|
self.controls_box = Box(
|
||||||
name="macos-player-controls",
|
name="macos-player-controls",
|
||||||
orientation="v",
|
orientation="v",
|
||||||
|
h_expand=True,
|
||||||
spacing=8,
|
spacing=8,
|
||||||
h_align="center",
|
h_align="center",
|
||||||
children=[self.button_box],
|
children=[self.button_box],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Track info with inline controls - more compact layout
|
# Track info with inline controls - expands to fill available space
|
||||||
self.track_info = Box(
|
self.track_info = Box(
|
||||||
name="macos-track-info",
|
name="macos-track-info",
|
||||||
spacing=6, # Reduced spacing
|
spacing=6, # Reduced spacing
|
||||||
orientation="v",
|
orientation="v",
|
||||||
v_align="start",
|
v_align="start",
|
||||||
h_align="start",
|
h_align="fill", # Fill all available horizontal space
|
||||||
h_expand=True,
|
h_expand=True, # Expand horizontally to take maximum space
|
||||||
|
v_expand=True, # Also expand vertically
|
||||||
children=[
|
children=[
|
||||||
self.track_title,
|
self.track_title,
|
||||||
self.track_artist,
|
self.track_artist,
|
||||||
@@ -666,11 +673,11 @@ class PlayerBox(Box):
|
|||||||
|
|
||||||
# Player switcher buttons box (compact, minimal space)
|
# Player switcher buttons box (compact, minimal space)
|
||||||
self.stack_buttons_box = Box(
|
self.stack_buttons_box = Box(
|
||||||
h_expand=False,
|
h_expand=False, # Fixed width, don't expand
|
||||||
v_expand=False,
|
v_expand=True,
|
||||||
name="macos-stack-buttons-box",
|
name="macos-stack-buttons-box",
|
||||||
spacing=4, # Reduced spacing
|
spacing=4, # Reduced spacing
|
||||||
orientation="h", # Horizontal layout for compactness
|
orientation="v", # Vertical layout for compactness
|
||||||
h_align="end",
|
h_align="end",
|
||||||
v_align="start",
|
v_align="start",
|
||||||
)
|
)
|
||||||
@@ -711,30 +718,15 @@ class PlayerBox(Box):
|
|||||||
self.outer_box = Box(
|
self.outer_box = Box(
|
||||||
name="macos-outer-player-box",
|
name="macos-outer-player-box",
|
||||||
orientation="horizontal",
|
orientation="horizontal",
|
||||||
spacing=15,
|
spacing=15, # Good spacing between elements
|
||||||
h_align="start",
|
h_expand=True,
|
||||||
|
v_expand=True,
|
||||||
|
v_align="center",
|
||||||
|
h_align="fill", # Fill available space
|
||||||
children=[
|
children=[
|
||||||
self.image_stack, # Album art on left
|
self.image_stack, # Album art on left (fixed width)
|
||||||
Box(
|
self.track_info, # Contains title, artist, seek bar AND controls (expands)
|
||||||
name="macos-main-section",
|
self.stack_buttons_box, # Compact switcher in corner (fixed width)
|
||||||
orientation="v",
|
|
||||||
spacing=0,
|
|
||||||
h_expand=True,
|
|
||||||
v_align="center",
|
|
||||||
children=[
|
|
||||||
# Header with player switcher in corner
|
|
||||||
Box(
|
|
||||||
orientation="h",
|
|
||||||
h_expand=True,
|
|
||||||
children=[
|
|
||||||
Box(h_expand=True), # Spacer
|
|
||||||
self.stack_buttons_box, # Compact switcher in corner
|
|
||||||
],
|
|
||||||
),
|
|
||||||
# Main content area
|
|
||||||
self.track_info, # Contains title, artist, seek bar AND controls now
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -806,7 +798,9 @@ class PlayerBox(Box):
|
|||||||
|
|
||||||
# Connect click handler to switch to this player
|
# Connect click handler to switch to this player
|
||||||
def make_click_handler(index):
|
def make_click_handler(index):
|
||||||
return lambda *_: self.player_stack.on_player_clicked_by_index(index)
|
return lambda *_: self.player_stack.on_player_clicked_by_index(
|
||||||
|
index
|
||||||
|
)
|
||||||
|
|
||||||
dot_button.connect("clicked", make_click_handler(i))
|
dot_button.connect("clicked", make_click_handler(i))
|
||||||
self.stack_buttons_box.children = [
|
self.stack_buttons_box.children = [
|
||||||
@@ -1032,6 +1026,7 @@ class PlayerBox(Box):
|
|||||||
self.seek_bar.set_value(safe_position)
|
self.seek_bar.set_value(safe_position)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _on_seek_start(self, widget, event):
|
def _on_seek_start(self, widget, event):
|
||||||
"""User started seeking - disable automatic updates"""
|
"""User started seeking - disable automatic updates"""
|
||||||
self._user_seeking = True
|
self._user_seeking = True
|
||||||
@@ -1053,7 +1048,7 @@ class PlayerBox(Box):
|
|||||||
try:
|
try:
|
||||||
self.player.position = new_position
|
self.player.position = new_position
|
||||||
self.position_label.set_label(self.length_str(new_position))
|
self.position_label.set_label(self.length_str(new_position))
|
||||||
except Exception as e:
|
except Exception:
|
||||||
# If setting position fails, just update the label
|
# If setting position fails, just update the label
|
||||||
self.position_label.set_label(self.length_str(new_position))
|
self.position_label.set_label(self.length_str(new_position))
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
+21
-15
@@ -500,7 +500,7 @@
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
min-height: 20px;
|
min-height: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#apple-seek-bar trough {
|
#apple-seek-bar trough {
|
||||||
@@ -555,11 +555,11 @@
|
|||||||
|
|
||||||
/* macOS-style expanded player - more compact */
|
/* macOS-style expanded player - more compact */
|
||||||
#macos-outer-player-box {
|
#macos-outer-player-box {
|
||||||
min-height: 110px; /* Reduced height */
|
min-height: 110px; /* Reduced height */
|
||||||
min-width: 380px;
|
min-width: 420px; /* Slightly wider to accommodate expanded track info */
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
padding: 15px; /* Reduced padding */
|
padding: 15px; /* Reduced padding */
|
||||||
background-color: alpha(#000, 0.4);
|
background-color: alpha(#000, 0.4);
|
||||||
box-shadow:
|
box-shadow:
|
||||||
0 4px 16px alpha(#000, 0.25),
|
0 4px 16px alpha(#000, 0.25),
|
||||||
@@ -583,6 +583,12 @@
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Track info container that expands to fill available space */
|
||||||
|
#macos-track-info {
|
||||||
|
margin-left: 15px;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
#macos-player-title {
|
#macos-player-title {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
@@ -601,12 +607,12 @@
|
|||||||
#macos-seek-bar {
|
#macos-seek-bar {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
margin: 8px 0 4px 0;
|
margin: 8px 0 4px 0;
|
||||||
min-height: 20px;
|
min-height: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#macos-seek-bar trough {
|
#macos-seek-bar trough {
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
min-height: 4px;
|
min-height: 2px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
background-color: alpha(#fff, 0.25);
|
background-color: alpha(#fff, 0.25);
|
||||||
border: none;
|
border: none;
|
||||||
@@ -645,16 +651,16 @@
|
|||||||
|
|
||||||
/* macOS control buttons - more compact */
|
/* macOS control buttons - more compact */
|
||||||
#macos-button-box {
|
#macos-button-box {
|
||||||
margin-top: 6px; /* Reduced top margin */
|
margin-top: 6px; /* Reduced top margin */
|
||||||
}
|
}
|
||||||
|
|
||||||
#macos-control-button {
|
#macos-control-button {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
min-width: 28px; /* Slightly smaller */
|
min-width: 28px; /* Slightly smaller */
|
||||||
min-height: 28px;
|
min-height: 28px;
|
||||||
padding: 5px; /* Reduced padding */
|
padding: 5px; /* Reduced padding */
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
transition: all 0.15s ease;
|
transition: all 0.15s ease;
|
||||||
}
|
}
|
||||||
@@ -668,9 +674,9 @@
|
|||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
min-width: 36px; /* Slightly smaller */
|
min-width: 36px; /* Slightly smaller */
|
||||||
min-height: 36px;
|
min-height: 36px;
|
||||||
padding: 7px; /* Reduced padding */
|
padding: 7px; /* Reduced padding */
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
transition: all 0.15s ease;
|
transition: all 0.15s ease;
|
||||||
}
|
}
|
||||||
@@ -682,16 +688,16 @@
|
|||||||
|
|
||||||
/* macOS player switcher dots - compact horizontal layout */
|
/* macOS player switcher dots - compact horizontal layout */
|
||||||
#macos-stack-buttons-box {
|
#macos-stack-buttons-box {
|
||||||
margin: 2px 5px; /* Minimal margins */
|
margin: 2px 5px; /* Minimal margins */
|
||||||
}
|
}
|
||||||
|
|
||||||
.macos-switcher-dot {
|
.macos-switcher-dot {
|
||||||
background: alpha(#fff, 0.3);
|
background: alpha(#fff, 0.3);
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
min-width: 6px; /* Smaller dots */
|
min-width: 6px; /* Smaller dots */
|
||||||
min-height: 6px;
|
min-height: 6px;
|
||||||
margin: 2px; /* Reduced margins */
|
margin: 2px; /* Reduced margins */
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -701,5 +707,5 @@
|
|||||||
|
|
||||||
.macos-switcher-dot.active {
|
.macos-switcher-dot.active {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
box-shadow: 0 0 0 1px alpha(#fff, 0.3); /* Smaller glow */
|
box-shadow: 0 0 0 1px alpha(#fff, 0.3); /* Smaller glow */
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user