From 4aa54101d01942a3d84ab130c03dd4781221e3d6 Mon Sep 17 00:00:00 2001 From: laixintao Date: Mon, 25 Sep 2023 23:28:02 +0800 Subject: [PATCH] auto fix the detail row height, to match the radio set. --- flameshow/render/app.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/flameshow/render/app.py b/flameshow/render/app.py index 35db57d..8b72f26 100644 --- a/flameshow/render/app.py +++ b/flameshow/render/app.py @@ -55,19 +55,20 @@ class FlameGraphApp(App): DEFAULT_CSS = """ #span-detail-container { - height: 6; } #span-detail { width: 1fr; + height: 1fr; padding: 0 1; border: round $secondary; border-subtitle-align: left; - background: $boost; + content-align-vertical: middle; } #sample-type-radio { width: 20%; + height: 1fr; } """ @@ -123,7 +124,7 @@ def compose(self) -> ComposeResult: # TODO for heap default to inuse bytes options[self.sample_index].value = True radioset = RadioSet(*options, id="sample-type-radio") - yield Horizontal( + detail_row = Horizontal( Static( id="span-detail", ), @@ -131,6 +132,11 @@ def compose(self) -> ComposeResult: id="span-detail-container", ) + # set min height, 2 lines of detail + 2 lines border + detail_row.styles.height = max(4, len(options) + 2) + + yield detail_row + yield FlameGraphScroll( Vertical(id="flamegraph-container"), id="flamegraph-out-container",