mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Help text for text align
This commit is contained in:
@@ -9,7 +9,6 @@ from textual.css._help_renderables import Example, Bullet, HelpText
|
|||||||
from textual.css.constants import (
|
from textual.css.constants import (
|
||||||
VALID_BORDER,
|
VALID_BORDER,
|
||||||
VALID_LAYOUT,
|
VALID_LAYOUT,
|
||||||
VALID_EDGE,
|
|
||||||
VALID_ALIGN_HORIZONTAL,
|
VALID_ALIGN_HORIZONTAL,
|
||||||
VALID_ALIGN_VERTICAL,
|
VALID_ALIGN_VERTICAL,
|
||||||
VALID_STYLE_FLAGS,
|
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
|
"""Help text to show when the user supplies an invalid value for the text-align property
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -658,26 +657,13 @@ def text_align_help_text(context: str) -> HelpText:
|
|||||||
return HelpText(
|
return HelpText(
|
||||||
summary="Invalid value for the [i]text-align[/] property.",
|
summary="Invalid value for the [i]text-align[/] property.",
|
||||||
bullets=[
|
bullets=[
|
||||||
*ContextSpecificBullets(
|
Bullet(
|
||||||
css=[
|
f"The [i]text-align[/] property must be one of {friendly_list(VALID_TEXT_ALIGN)}",
|
||||||
Bullet(
|
examples=[
|
||||||
f"The [i]text-align[/] property must be one of {friendly_list(VALID_TEXT_ALIGN)}",
|
Example("text-align: center;"),
|
||||||
examples=[
|
Example("text-align: right;"),
|
||||||
Example("text-align: center;"),
|
|
||||||
Example("text-align: right;"),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
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)
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ class StylesBuilder:
|
|||||||
self.error(
|
self.error(
|
||||||
name,
|
name,
|
||||||
tokens[0],
|
tokens[0],
|
||||||
text_align_help_text("css"),
|
text_align_help_text(),
|
||||||
)
|
)
|
||||||
|
|
||||||
self.styles._rules["text_align"] = tokens[0].value
|
self.styles._rules["text_align"] = tokens[0].value
|
||||||
|
|||||||
Reference in New Issue
Block a user