pygra.mainwindow
mainwindow.py — MainWindow with menu bar, fit layer management, custom toolbar
- class pygra.mainwindow.FitLayer(label, x, y, color, source_label, linestyle='--', linewidth=1.8)[source]
Bases:
objectData container for a single fit or interpolation curve.
Instances are created by
MainWindow._fit_active()and stored inMainWindow.fit_layers.- Parameters:
label (str) – Display label shown in the fit panel and plot legend.
x (numpy.ndarray) – x-coordinates of the fit curve.
y (numpy.ndarray) – y-coordinates of the fit curve.
color (str) – Hex color string for the curve.
source_label (str) – Label of the dataset series this fit was computed from.
linestyle (str, optional) – Matplotlib linestyle string. Default is
"--".linewidth (float, optional) – Line width in points. Default is
1.8.
- visible
Whether the layer is currently shown on the plot. Initialised to
True.- Type:
bool
- class pygra.mainwindow.FitLayerWidget(layer, on_remove, on_toggle, on_edit, parent=None)[source]
Bases:
QWidgetRow widget in the fit panel representing one
FitLayer.Displays a visibility checkbox, a color dot, the layer label with its source series, and a remove button. Double-clicking the label row opens the fit-layer appearance editor.
- Parameters:
layer (FitLayer) – The fit layer this widget controls.
on_remove (callable) – Called with layer when the ✕ button is clicked.
on_toggle (callable) – Called with
(layer, visible: bool)when the checkbox changes.on_edit (callable) – Called with
(layer, widget)on double-click.parent (QWidget, optional) – Parent widget.
- class pygra.mainwindow.MainWindow[source]
Bases:
QMainWindowApplication main window for PyGRA.
Manages the left-side series panel (one
DatasetWidgetper series tab), the matplotlib canvas, axis controls, a fit-layer panel, the menu bar, and a custom toolbar. Application state can be saved and restored as JSON session files.- datasets
All loaded datasets. A single dataset may be shared between multiple series widgets (via the duplicate action).
- Type:
list of DataSet
- dataset_widgets
One widget per visible series tab, in tab order.
- Type:
list of DatasetWidget
- style_settings
Active global style settings; mirrors
constants.DEFAULT_STYLE_SETTINGS.- Type:
dict