Skip to content

Commit 20faa12

Browse files
committed
feat: Add unit conversion option and visibility toggle in TimeSeriesDataUIManager
1 parent 17b484a commit 20faa12

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

dvue/tsdataui.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,13 @@ class TimeSeriesDataUIManager(DataUIManager):
230230
convert_units = param.Boolean(
231231
default=False,
232232
doc="Apply unit conversion to loaded data. Override apply_unit_conversion() in a subclass "
233-
"to define the conversion logic for a specific domain (e.g. ft→m, cfs→m³/s).",
233+
"to define the conversion logic for a specific domain (e.g. ft\u2192m, cfs\u2192m\u00b3/s).",
234+
)
235+
show_convert_units = param.Boolean(
236+
default=False,
237+
doc="Show the 'Convert units' checkbox in the Transform tab. Set to True in subclasses "
238+
"that implement apply_unit_conversion(). When False the widget is hidden and "
239+
"convert_units has no effect.",
234240
)
235241

236242
def __init__(self, **params):
@@ -685,12 +691,15 @@ def _update_expr_and_btn(*args):
685691
convert_units_w = pn.widgets.Checkbox.from_param(
686692
self.param.convert_units, name="Convert units", margin=_M)
687693

688-
transform_widgets = pn.Column(
689-
# ── ⓪ Units ——————————————————————————————————————————
690-
_section("⓪ Units"),
694+
units_section = [
695+
_section("\u24ea Units"),
691696
pn.Row(convert_units_w, align="center"),
692-
# ── ① Data Prep ——————————————————————————————————————
693-
_section("① Data Prep"),
697+
] if self.show_convert_units else []
698+
699+
transform_widgets = pn.Column(
700+
*units_section,
701+
# ── \u2460 Data Prep \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014
702+
_section("\u2460 Data Prep"),
694703
pn.Row(
695704
pn.pane.HTML(
696705
"<span style='font-size:11px;color:#666'>Gap fill limit</span>",

0 commit comments

Comments
 (0)