Inline border invalid number of edges help text

This commit is contained in:
Darren Burns
2022-04-25 15:56:46 +01:00
parent 37f18247b5
commit d9fd240212
3 changed files with 7 additions and 4 deletions

View File

@@ -85,7 +85,7 @@ class BasicApp(App):
def action_increase_margin(self): def action_increase_margin(self):
old_margin = self.focused.styles.margin old_margin = self.focused.styles.margin
self.focused.styles.border = [("solid", "green"), ("dashed", "s")] self.focused.styles.border = [("solid", "green"), ("dashed", "red")]
BasicApp.run(css_file="uber.css", log="textual.log", log_verbosity=1) BasicApp.run(css_file="uber.css", log="textual.log", log_verbosity=1)

View File

@@ -267,7 +267,7 @@ def border_property_help_text(
f'widget.styles.{property_name} = ("solid", "red")' f'widget.styles.{property_name} = ("solid", "red")'
), ),
Example( Example(
f'widget.styles.{property_name} = ("round", #f0f0f0")' f'widget.styles.{property_name} = ("round", "#f0f0f0")'
), ),
Example( Example(
f'widget.styles.{property_name} = [("dashed", "#f0f0f0"), ("solid", "blue")] [dim]# Vertical, horizontal' f'widget.styles.{property_name} = [("dashed", "#f0f0f0"), ("solid", "blue")] [dim]# Vertical, horizontal'
@@ -275,7 +275,7 @@ def border_property_help_text(
], ],
), ),
Bullet( Bullet(
f"Valid values for <bordertype> are:\n {friendly_list(VALID_BORDER)}" f"Valid values for <bordertype> are:\n{friendly_list(VALID_BORDER)}"
), ),
Bullet( Bullet(
f"Colors can be specified using hex, RGB, or ANSI color names" f"Colors can be specified using hex, RGB, or ANSI color names"

View File

@@ -341,7 +341,10 @@ class BorderProperty:
setattr(obj, bottom, _border3) setattr(obj, bottom, _border3)
setattr(obj, left, _border4) setattr(obj, left, _border4)
else: else:
raise StyleValueError("expected 1, 2, or 4 values") raise StyleValueError(
"expected 1, 2, or 4 values",
help_text=border_property_help_text(self.name, context="inline"),
)
obj.refresh(layout=self._layout) obj.refresh(layout=self._layout)