Help text for text align

This commit is contained in:
Darren Burns
2022-08-26 16:19:05 +01:00
parent 56d2516c64
commit 39665fb110
2 changed files with 8 additions and 22 deletions

View File

@@ -9,7 +9,6 @@ from textual.css._help_renderables import Example, Bullet, HelpText
from textual.css.constants import (
VALID_BORDER,
VALID_LAYOUT,
VALID_EDGE,
VALID_ALIGN_HORIZONTAL,
VALID_ALIGN_VERTICAL,
VALID_STYLE_FLAGS,
@@ -649,7 +648,7 @@ def align_help_text() -> HelpText:
)
def text_align_help_text(context: str) -> HelpText:
def text_align_help_text() -> HelpText:
"""Help text to show when the user supplies an invalid value for the text-align property
Returns:
@@ -658,8 +657,6 @@ def text_align_help_text(context: str) -> HelpText:
return HelpText(
summary="Invalid value for the [i]text-align[/] property.",
bullets=[
*ContextSpecificBullets(
css=[
Bullet(
f"The [i]text-align[/] property must be one of {friendly_list(VALID_TEXT_ALIGN)}",
examples=[
@@ -668,17 +665,6 @@ def text_align_help_text(context: str) -> HelpText:
],
)
],
inline=[
Bullet(
f"The [i]text_align[/] property must be one of {friendly_list(VALID_TEXT_ALIGN)}",
examples=[
Example("widget.styles.text_align = 'center'"),
Example("widget.styles.text_align = 'right'"),
],
)
],
).get_by_context(context)
],
)

View File

@@ -629,7 +629,7 @@ class StylesBuilder:
self.error(
name,
tokens[0],
text_align_help_text("css"),
text_align_help_text(),
)
self.styles._rules["text_align"] = tokens[0].value