pygra.widgets
widgets.py — DatasetWidget: compact per-series panel
- class pygra.widgets.DatasetWidget(dataset, color, on_duplicate=None, on_replot=None, parent=None)[source]
Bases:
QWidgetCompact per-series control panel embedded in the left tab widget.
Shows dataset name and dimensions, a histogram-mode toggle, column selectors for x, y, dx, dy (line mode) or a single column (histogram mode), an Appearance button, a duplicate-series button, and a visibility checkbox. Style details are edited through
AppearanceDialogorHistAppearanceDialog.- Parameters:
dataset (DataSet) – The dataset this widget controls.
color (str) – Initial hex color string for the series (e.g.
"#1f77b4").on_duplicate (callable, optional) – Called with dataset when the “Add another plot” button is clicked.
on_replot (callable, optional) – Called with no arguments whenever a style change requires a full replot.
parent (QWidget, optional) – Parent widget.
- set_mode(mode)[source]
Set display mode programmatically.
- Parameters:
mode (str) – One of
"series","histogram", or"hist2d".
- refresh_col_ranges()[source]
Update the maximum value of all column spinboxes.
Should be called after the underlying dataset gains or loses columns (e.g. after a transform operation adds a new column).
- get_config()[source]
Return the current widget configuration as a plotting dict.
In series mode the result includes series-style keys; in histogram mode it includes histogram-style keys; in hist2d mode it includes hist2d-style keys.
- Returns:
Keys always present:
"label"(str),"visible"(bool),"hist_mode"(bool),"hist2d_mode"(bool),"xcol","ycol","dxcol","dycol","hcol"(int). In hist2d mode"xcol"and"ycol"reflect the hist2d column spinboxes. Additional style keys are merged from the active style dict.- Return type:
dict