Hi,
I wanted to redefine the render_line method of a widget to alter the style of strips returned by the superclass method.
However, my Styles are not applied when calling Strip.apply_style.
The problem is that Strip.apply_style does not expose the post_style parameter to be passed to rich's Segment.apply_style. Its docstring in turn says
Returns an iterable of segments where the style is replaced by style + segment.style + post_style
Without the post_style parameter in Strip.apply_style, I have no way to overwrite the style of a Strip if an internal Segment comes with its own style.
Since I am not a collaborator in this project: A fix is available on my fork at https://github.com/jbdyn/textual/tree/apply-post-style with commit 594265f.
If this patch is not suitable: What would be the alternative if I wanted to change a Strip returned by the superclass's render_line method?
Hi,
I wanted to redefine the
render_linemethod of a widget to alter the style of strips returned by the superclass method.However, my
Styles are not applied when callingStrip.apply_style.The problem is that
Strip.apply_styledoes not expose thepost_styleparameter to be passed torich'sSegment.apply_style. Its docstring in turn saysWithout the
post_styleparameter inStrip.apply_style, I have no way to overwrite the style of aStripif an internalSegmentcomes with its own style.Since I am not a collaborator in this project: A fix is available on my fork at https://github.com/jbdyn/textual/tree/apply-post-style with commit 594265f.
If this patch is not suitable: What would be the alternative if I wanted to change a
Stripreturned by the superclass'srender_linemethod?