Ensure we dont overwrite style object injected into render

This commit is contained in:
Darren Burns
2022-05-10 09:55:04 +01:00
parent cc483e71b7
commit 2425ba260f
3 changed files with 14 additions and 8 deletions

View File

@@ -145,4 +145,5 @@ class BasicApp(App):
self.mount(example.widget)
BasicApp.run(css_path="tabs.scss", watch_css=True, log_path="textual.log")
app = BasicApp(css_path="tabs.scss", watch_css=True, log_path="textual.log")
app.run()

View File

@@ -14,6 +14,11 @@ App.-show-focus *:focus {
background: darkslateblue;
}
#child2 {
text-style: underline;
background: red;
}
.list-item {
height: 10;
color: #12a0;

View File

@@ -206,17 +206,17 @@ class ScrollBar(Widget):
yield "position", self.position
def render(self, style: Style) -> RenderableType:
style = self.parent.styles
style = Style(
styles = self.parent.styles
scrollbar_style = Style(
bgcolor=(
style.scrollbar_background_hover.rich_color
styles.scrollbar_background_hover.rich_color
if self.mouse_over
else style.scrollbar_background.rich_color
else styles.scrollbar_background.rich_color
),
color=(
style.scrollbar_color_active.rich_color
styles.scrollbar_color_active.rich_color
if self.grabbed
else style.scrollbar_color.rich_color
else styles.scrollbar_color.rich_color
),
)
return ScrollBarRender(
@@ -224,7 +224,7 @@ class ScrollBar(Widget):
window_size=self.window_size,
position=self.position,
vertical=self.vertical,
style=style,
style=scrollbar_style,
)
async def on_event(self, event) -> None: