refactor: remove redundant Box wrappers

- dock/main.py: canvas_box eliminated, Revealer wraps canvas directly
- desktop/system.py: two single-child Box wrappers removed
- controlcenter/player.py: redundant album_cover wrapper removed
- controlcenter/expanded_player.py: same pattern as player.py
This commit is contained in:
sankalp committed 2026-07-31 00:39:53 +05:45
1 parent 5c936a68da
commit 92c2b92333
4 files changed
+18 -38

No files matched your search

+10 -14
View File
@@ -94,7 +94,9 @@ class PlayerBoxStack(Box):
def _create_no_media_box(self): def _create_no_media_box(self):
fallback_cover_path = PLAYER_FALLBACK_ART fallback_cover_path = PLAYER_FALLBACK_ART
album_cover = Box(style_classes="album-image-c") album_cover = Box(
style_classes="album-image-c", h_align="start", v_align="center"
)
album_cover.set_style(f"background-image:url('{fallback_cover_path}')") album_cover.set_style(f"background-image:url('{fallback_cover_path}')")
track_title = Label( track_title = Label(
@@ -131,12 +133,7 @@ class PlayerBoxStack(Box):
h_expand=True, h_expand=True,
children=[track_info], children=[track_info],
), ),
Box( album_cover,
h_align="start",
v_align="center",
name="player-image-stack",
children=[album_cover],
),
], ],
) )
], ],
@@ -291,19 +288,18 @@ class PlayerBox(Box):
self._seekbar_signal_ids = [] self._seekbar_signal_ids = []
self._cached_duration = 0 self._cached_duration = 0
self.album_cover = Box(style_classes="album-image-c") self.album_cover = Box(
style_classes="album-image-c",
h_align="start",
v_align="center",
)
self.album_cover.set_style( self.album_cover.set_style(
f"background-image:url('{self.fallback_cover_path}')" f"background-image:url('{self.fallback_cover_path}')"
) )
self.album_cover.set_size_request(70, 70) self.album_cover.set_size_request(70, 70)
self.image = Overlay( self.image = Overlay(
child=Box( child=self.album_cover,
h_align="start",
v_align="center",
name="player-image-stack",
children=[self.album_cover],
),
overlays=[ overlays=[
Box( Box(
children=Image( children=Image(
+5 -8
View File
@@ -144,7 +144,7 @@ class PlayerBoxStack(Box):
inner_box = CenterBox( inner_box = CenterBox(
name="inner-player-box", name="inner-player-box",
start_children=[Box(style_classes="album-image-c", children=album_cover)], start_children=[album_cover],
center_children=[ center_children=[
Box( Box(
name="player-info-box-c", name="player-info-box-c",
@@ -317,16 +317,13 @@ class PlayerBox(Box):
self.exit = False self.exit = False
self._signal_connections = [] self._signal_connections = []
self.album_cover = Box(style_classes="album-image-c") self.album_cover = Box(
style_classes="album-image-c", h_align="start", v_align="center"
)
self.album_cover.set_style(f"background-image:url('{self.cover_path}')") self.album_cover.set_style(f"background-image:url('{self.cover_path}')")
self.image = Overlay( self.image = Overlay(
child=Box( child=self.album_cover,
h_align="start",
v_align="center",
name="player-image-stack",
children=[self.album_cover],
),
overlays=[ overlays=[
Box( Box(
children=Image( children=Image(
+1 -10
View File
@@ -53,22 +53,13 @@ class SystemInfoBase(Box):
spacing=12, spacing=12,
h_align="center", h_align="center",
v_align="center", v_align="center",
children=[
Box(
children=[ children=[
Overlay( Overlay(
child=self.progress, child=self.progress,
tooltip_text="", tooltip_text="",
overlays=self.main_label, overlays=self.main_label,
)
]
),
Box(
h_align="center",
justification="centre",
orientation="v",
children=[self.info_container],
), ),
self.info_container,
], ],
) )
) )
+2 -6
View File
@@ -28,14 +28,10 @@ class Dock(Window):
self.set_app_paintable(True) self.set_app_paintable(True)
self.canvas = DockCanvas(self) self.canvas = DockCanvas(self)
self.canvas.set_name("dock-canvas-box")
canvas_box = Box(
name="dock-canvas-box",
children=[self.canvas],
)
self.revealer = Revealer( self.revealer = Revealer(
child=canvas_box, child=self.canvas,
transition_duration=200, transition_duration=200,
transition_type="slide-up", transition_type="slide-up",
) )