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:
4 files changed
+22
-42
No files matched your search
@@ -94,7 +94,9 @@ class PlayerBoxStack(Box):
|
||||
|
||||
def _create_no_media_box(self):
|
||||
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}')")
|
||||
|
||||
track_title = Label(
|
||||
@@ -131,12 +133,7 @@ class PlayerBoxStack(Box):
|
||||
h_expand=True,
|
||||
children=[track_info],
|
||||
),
|
||||
Box(
|
||||
h_align="start",
|
||||
v_align="center",
|
||||
name="player-image-stack",
|
||||
children=[album_cover],
|
||||
),
|
||||
album_cover,
|
||||
],
|
||||
)
|
||||
],
|
||||
@@ -291,19 +288,18 @@ class PlayerBox(Box):
|
||||
self._seekbar_signal_ids = []
|
||||
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(
|
||||
f"background-image:url('{self.fallback_cover_path}')"
|
||||
)
|
||||
self.album_cover.set_size_request(70, 70)
|
||||
|
||||
self.image = Overlay(
|
||||
child=Box(
|
||||
h_align="start",
|
||||
v_align="center",
|
||||
name="player-image-stack",
|
||||
children=[self.album_cover],
|
||||
),
|
||||
child=self.album_cover,
|
||||
overlays=[
|
||||
Box(
|
||||
children=Image(
|
||||
|
||||
@@ -144,7 +144,7 @@ class PlayerBoxStack(Box):
|
||||
|
||||
inner_box = CenterBox(
|
||||
name="inner-player-box",
|
||||
start_children=[Box(style_classes="album-image-c", children=album_cover)],
|
||||
start_children=[album_cover],
|
||||
center_children=[
|
||||
Box(
|
||||
name="player-info-box-c",
|
||||
@@ -317,16 +317,13 @@ class PlayerBox(Box):
|
||||
self.exit = False
|
||||
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.image = Overlay(
|
||||
child=Box(
|
||||
h_align="start",
|
||||
v_align="center",
|
||||
name="player-image-stack",
|
||||
children=[self.album_cover],
|
||||
),
|
||||
child=self.album_cover,
|
||||
overlays=[
|
||||
Box(
|
||||
children=Image(
|
||||
|
||||
@@ -54,21 +54,12 @@ class SystemInfoBase(Box):
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
children=[
|
||||
Box(
|
||||
children=[
|
||||
Overlay(
|
||||
child=self.progress,
|
||||
tooltip_text="",
|
||||
overlays=self.main_label,
|
||||
)
|
||||
]
|
||||
),
|
||||
Box(
|
||||
h_align="center",
|
||||
justification="centre",
|
||||
orientation="v",
|
||||
children=[self.info_container],
|
||||
Overlay(
|
||||
child=self.progress,
|
||||
tooltip_text="",
|
||||
overlays=self.main_label,
|
||||
),
|
||||
self.info_container,
|
||||
],
|
||||
)
|
||||
)
|
||||
|
||||
@@ -28,14 +28,10 @@ class Dock(Window):
|
||||
self.set_app_paintable(True)
|
||||
|
||||
self.canvas = DockCanvas(self)
|
||||
|
||||
canvas_box = Box(
|
||||
name="dock-canvas-box",
|
||||
children=[self.canvas],
|
||||
)
|
||||
self.canvas.set_name("dock-canvas-box")
|
||||
|
||||
self.revealer = Revealer(
|
||||
child=canvas_box,
|
||||
child=self.canvas,
|
||||
transition_duration=200,
|
||||
transition_type="slide-up",
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user