mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
empty sparklines
This commit is contained in:
@@ -367,7 +367,7 @@ def loop_first_last(values: Iterable[T]) -> Iterable[tuple[bool, bool, T]]:
|
||||
def update_log(self) -> None:
|
||||
"""Update the Log with new content."""
|
||||
log = self.query_one(Log)
|
||||
if not self.app.screen.can_view_partial(log) and not log.is_in_maximized_view:
|
||||
if not self.app.screen.can_view_entire(log) and not log.is_in_maximized_view:
|
||||
return
|
||||
self.log_count += 1
|
||||
line_no = self.log_count % len(self.TEXT)
|
||||
@@ -378,7 +378,7 @@ def loop_first_last(values: Iterable[T]) -> Iterable[tuple[bool, bool, T]]:
|
||||
"""Update the Rich Log with content."""
|
||||
rich_log = self.query_one(RichLog)
|
||||
if (
|
||||
not self.app.screen.can_view_partial(rich_log)
|
||||
not self.app.screen.can_view_entire(rich_log)
|
||||
and not rich_log.is_in_maximized_view
|
||||
):
|
||||
return
|
||||
|
||||
@@ -87,8 +87,9 @@ class Sparkline(Widget):
|
||||
|
||||
def render(self) -> RenderResult:
|
||||
"""Renders the sparkline when there is data available."""
|
||||
if not self.data:
|
||||
return "<empty sparkline>"
|
||||
data = self.data or []
|
||||
if not data:
|
||||
return ""
|
||||
_, base = self.background_colors
|
||||
min_color = base + (
|
||||
self.get_component_styles("sparkline--min-color").color
|
||||
@@ -101,7 +102,7 @@ class Sparkline(Widget):
|
||||
else self.max_color
|
||||
)
|
||||
return SparklineRenderable(
|
||||
self.data,
|
||||
data,
|
||||
width=self.size.width,
|
||||
min_color=min_color.rich_color,
|
||||
max_color=max_color.rich_color,
|
||||
|
||||
Reference in New Issue
Block a user