Simplify the rendering

With an eye on applying component styles soon.
This commit is contained in:
Dave Pearson
2023-02-16 14:17:15 +00:00
parent 47550a6acd
commit ae7f1b49ad

View File

@@ -100,16 +100,13 @@ class ToggleButton(Static, can_focus=True):
Returns:
The content to render for the widget.
"""
if self.button_first:
return Text.assemble(
self._button,
(" " if self.label else ""),
self.label,
)
return Text.assemble(
self.label,
(" " if self.label else ""),
self._button,
button = self._button
label = self.label
spacer = " " if self.label else ""
return (
Text.assemble(button, spacer, label)
if self.button_first
else Text.assemble(label, spacer, button)
)
def toggle(self) -> None: