@@ -66,6 +66,9 @@ def visualize(widget: Widget, obj: object, markup: bool = True) -> Visual:
66
66
obj: An object.
67
67
markup: Enable markup.
68
68
69
+ Raises:
70
+ VisualError: If there is no Visual could be returned to render `obj`.
71
+
69
72
Returns:
70
73
A Visual instance to render the object, or `None` if there is no associated visual.
71
74
"""
@@ -101,7 +104,7 @@ def visualize(widget: Widget, obj: object, markup: bool = True) -> Visual:
101
104
102
105
103
106
class Visual (ABC ):
104
- """A Textual 'visual ' object.
107
+ """A Textual 'Visual ' object.
105
108
106
109
Analogous to a Rich renderable, but with support for transparency.
107
110
@@ -117,7 +120,7 @@ def render_strips(
117
120
selection : Selection | None = None ,
118
121
selection_style : Style | None = None ,
119
122
) -> list [Strip ]:
120
- """Render the visual into an iterable of strips.
123
+ """Render the Visual into an iterable of strips.
121
124
122
125
Args:
123
126
rules: A mapping of style rules, such as the Widgets `styles` object.
@@ -133,9 +136,9 @@ def render_strips(
133
136
134
137
@abstractmethod
135
138
def get_optimal_width (self , rules : RulesMap , container_width : int ) -> int :
136
- """Get optimal width of the visual to display its content.
139
+ """Get optimal width of the Visual to display its content.
137
140
138
- The exact definition of "optimal width" is dependant on the visual , but
141
+ The exact definition of "optimal width" is dependant on the Visual , but
139
142
will typically be wide enough to display output without cropping or wrapping,
140
143
and without superfluous space.
141
144
@@ -150,7 +153,7 @@ def get_optimal_width(self, rules: RulesMap, container_width: int) -> int:
150
153
151
154
@abstractmethod
152
155
def get_height (self , rules : RulesMap , width : int ) -> int :
153
- """Get the height of the visual if rendered with the given width.
156
+ """Get the height of the Visual if rendered at the given width.
154
157
155
158
Args:
156
159
rules: A mapping of style rules, such as the Widgets `styles` object.
@@ -317,7 +320,7 @@ def render_strips(
317
320
class Padding (Visual ):
318
321
"""A Visual to pad another visual."""
319
322
320
- def __init__ (self , visual : Visual , spacing : Spacing ):
323
+ def __init__ (self , visual : Visual , spacing : Spacing ) -> None :
321
324
"""
322
325
323
326
Args:
0 commit comments