Skip to content

Settings Popups

Components

Plot Settings

PlotSettingsModal

Bases: QWidget

Source code in trace/widgets/plot_settings.py
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
class PlotSettingsModal(QWidget):
    auto_scroll_interval_change = Signal(int)
    grid_alpha_change = Signal(int)
    set_all_y_axis_gridlines = Signal(bool)
    disable_autoscroll = Signal()

    def __init__(self, parent: QWidget, plot: PyDMArchiverTimePlot):
        super().__init__(parent)
        self.setWindowFlag(Qt.Popup)

        self.plot = plot
        main_layout = QVBoxLayout()
        self.setLayout(main_layout)

        title_label = SettingsTitle(self, "Plot Settings", size=14)
        main_layout.addWidget(title_label)

        self.plot_title_line_edit = QLineEdit()
        self.plot_title_line_edit.setPlaceholderText("Enter Title")
        self.plot_title_line_edit.textChanged.connect(self.plot.setPlotTitle)
        self.plot.plotItem.titleLabel.anchor((0.5, 0), (0.5, 0))  # Center title
        plot_title_row = SettingsRowItem(self, "Title", self.plot_title_line_edit)
        main_layout.addLayout(plot_title_row)

        self.legend_checkbox = QCheckBox(self)
        self.legend_checkbox.checkStateChanged.connect(lambda check: self.plot.setShowLegend(bool(check)))
        self.legend_checkbox.setChecked(True)  # legend on by default
        legend_row = SettingsRowItem(self, "Show Legend", self.legend_checkbox)
        main_layout.addLayout(legend_row)

        self.mouse_mode_combo = QComboBox(self)
        self.mouse_mode_combo.addItems(["Rect", "Pan"])
        self.mouse_mode_combo.currentTextChanged.connect(self.plot.plotItem.changeMouseMode)
        mouse_mode_row = SettingsRowItem(self, "Mouse Mode", self.mouse_mode_combo)
        main_layout.addLayout(mouse_mode_row)

        self.as_interval_spinbox = QSpinBox(self)
        self.as_interval_spinbox.setValue(5)
        self.as_interval_spinbox.setMinimum(1)
        self.as_interval_spinbox.setMaximum(60)
        self.as_interval_spinbox.setSuffix(" s")
        self.as_interval_spinbox.valueChanged.connect(self.auto_scroll_interval_change.emit)
        as_interval_row = SettingsRowItem(self, "Autoscroll Interval", self.as_interval_spinbox)
        main_layout.addLayout(as_interval_row)

        self.start_datetime = QDateTimeEdit(self)
        self.start_datetime.setDisplayFormat("yyyy-MM-dd HH:mm:ss")
        self.start_datetime.setCalendarPopup(True)
        self.start_datetime.dateTimeChanged.connect(lambda qdt: self.set_time_axis_range((qdt, None)))
        start_dt_row = SettingsRowItem(self, "Start Time", self.start_datetime)
        main_layout.addLayout(start_dt_row)

        self.end_datetime = QDateTimeEdit(self)
        self.end_datetime.setDisplayFormat("yyyy-MM-dd HH:mm:ss")
        self.end_datetime.setCalendarPopup(True)
        self.end_datetime.dateTimeChanged.connect(lambda qdt: self.set_time_axis_range((None, qdt)))
        end_dt_row = SettingsRowItem(self, "End Time", self.end_datetime)
        main_layout.addLayout(end_dt_row)

        self.crosshair_checkbox = QCheckBox(self)
        self.crosshair_checkbox.checkStateChanged.connect(lambda check: self.plot.enableCrosshair(check, 100, 100))
        crosshair_row = SettingsRowItem(self, "Show Crosshair", self.crosshair_checkbox)
        main_layout.addLayout(crosshair_row)

        appearance_label = SettingsTitle(self, "Appearance")
        main_layout.addWidget(appearance_label)

        self.background_button = ColorButton(parent=self, color="white")
        self.background_button.color_changed.connect(self.plot.setBackgroundColor)
        background_row = SettingsRowItem(self, "  Background Color", self.background_button)
        main_layout.addLayout(background_row)

        axis_tick_font_size_spinbox = QSpinBox(self)
        axis_tick_font_size_spinbox.setValue(12)
        axis_tick_font_size_spinbox.setSuffix(" pt")
        axis_tick_font_size_spinbox.valueChanged.connect(self.set_axis_tick_font_size)
        axis_tick_font_size_row = SettingsRowItem(self, "  Axis Tick Font Size", axis_tick_font_size_spinbox)
        main_layout.addLayout(axis_tick_font_size_row)

        self.x_grid_checkbox = QCheckBox(self)
        self.x_grid_checkbox.checkStateChanged.connect(self.show_x_grid)
        x_grid_row = SettingsRowItem(self, "  X Axis Gridline", self.x_grid_checkbox)
        main_layout.addLayout(x_grid_row)

        self.y_grid_checkbox = QCheckBox(self)
        self.y_grid_checkbox.checkStateChanged.connect(self.show_y_grid)
        y_grid_row = SettingsRowItem(self, "  All Y Axis Gridlines", self.y_grid_checkbox)
        main_layout.addLayout(y_grid_row)

        self.grid_opacity_slider = QSlider(self)
        self.grid_opacity_slider.setOrientation(Qt.Horizontal)
        self.grid_opacity_slider.setMaximum(255)
        self.grid_opacity_slider.setValue(127)
        self.grid_opacity_slider.setSingleStep(32)
        self.grid_opacity_slider.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.grid_opacity_slider.valueChanged.connect(self.change_gridline_opacity)
        grid_opacity_row = SettingsRowItem(self, "  Gridline Opacity", self.grid_opacity_slider)
        main_layout.addLayout(grid_opacity_row)

        plot_viewbox = self.plot.plotItem.vb
        plot_viewbox.sigXRangeChanged.connect(self.set_axis_datetimes)
        plot_viewbox.sigRangeChangedManually.connect(lambda *_: self.set_axis_datetimes())

    @property
    def auto_scroll_interval(self):
        interval = self.as_interval_spinbox.value()
        interval *= 1000  # Convert to milliseconds
        return interval

    @property
    def x_grid_visible(self):
        return self.x_grid_checkbox.isChecked()

    @property
    def gridline_opacity(self):
        opacity = self.grid_opacity_slider.value()
        return opacity

    def show(self):
        parent_pos = self.parent().rect().bottomRight()
        global_pos = self.parent().mapToGlobal(parent_pos)
        self.move(global_pos)
        super().show()

    @Slot(int)
    def set_axis_tick_font_size(self, size: int) -> None:
        font = QFont()
        font.setPixelSize(size)

        all_axes = self.plot.plotItem.getAxes()
        for axis in all_axes:
            axis.setStyle(tickFont=font)

    @Slot(object)
    def set_time_axis_range(self, raw_range: tuple[QDateTime, QDateTime] = (None, None)) -> None:
        """PyQT Slot to set the plot's X-Axis range. This slot should be
        triggered on QDateTimeEdit value change.

        Parameters
        ----------
        raw_range : tuple[QDateTime, QDateTime], optional
            Takes in a tuple of 2 values, where one is a QDateTime and
            the other is None. The positioning changes either the plot's
            min or max range value. By default (None, None)
        """
        # Disable Autoscroll if enabled
        # self.ui.cursor_scale_btn.click()
        self.disable_autoscroll.emit()

        proc_range = [None, None]
        for ind, val in enumerate(raw_range):
            # Values that are QDateTime are converted to a float timestamp
            if isinstance(val, QDateTime):
                proc_range[ind] = val.toSecsSinceEpoch()
            # Values that are None use the existing range value
            elif not val:
                proc_range[ind] = self.plot.getXAxis().range[ind]
        proc_range.sort()

        logger.debug(f"Setting plot's X-Axis range to {proc_range}")
        self.plot.plotItem.vb.blockSignals(True)
        self.plot.plotItem.setXRange(*proc_range, padding=0)
        self.plot.plotItem.vb.blockSignals(False)

    @Slot(object, object)
    def set_axis_datetimes(self, _: ViewBox = None, time_range: tuple[float, float] = None) -> None:
        """Slot used to update the QDateTimeEdits on the Axis tab. This
        slot is called when the plot's X-Axis range changes values.

        Parameters
        ----------
        _ : ViewBox, optional
            The ViewBox on which the range is changing. This is unused
        time_range : Tuple[float, float], optional
            The new range values for the QDateTimeEdits, by default None
        """
        if not time_range:
            time_range = self.plot.getXAxis().range
        if min(time_range) <= 0:
            return

        time_range = [datetime.fromtimestamp(f) for f in time_range]

        edits = (self.start_datetime, self.end_datetime)
        for ind, qdt in enumerate(edits):
            if qdt.hasFocus():
                continue
            qdt.blockSignals(True)
            qdt.setDateTime(QDateTime(time_range[ind]))
            qdt.blockSignals(False)

    @Slot(int)
    def show_x_grid(self, visible: int):
        """Slot to show or hide the X-Axis gridlines."""
        opacity = self.gridline_opacity
        self.set_plot_gridlines(bool(visible), opacity)

    @Slot(int)
    def show_y_grid(self, visible: int):
        visible = bool(visible)
        self.set_all_y_axis_gridlines.emit(visible)

    @Slot(int)
    def change_gridline_opacity(self, opacity: int):
        """Slot to change the opacity of the gridlines for both X and Y axes."""
        visible = self.x_grid_visible
        self.set_plot_gridlines(visible, opacity)

    def set_plot_gridlines(self, visible: bool, opacity: int):
        """Helper function to set the plot's gridlines visibility and opacity. Updates both X and Y axes."""
        normalized_opacity = opacity / 255
        self.plot.setShowXGrid(visible, normalized_opacity)
        self.grid_alpha_change.emit(opacity)

    @Slot(dict)
    def plot_setup(self, config: dict):
        """Read in the full config dictionary. For each config preset, set the widgets to match the value, which will
        send signals out that will actually cause the plot to change."""
        if "title" in config:
            self.plot_title_line_edit.setText(str(config["title"]))
        if "legend" in config:
            self.legend_checkbox.setChecked(bool(config["legend"]))
        if "mouseMode" in config:
            mouse_mode_index = int(config["mouseMode"] / 3)
            self.mouse_mode_combo.setCurrentIndex(mouse_mode_index)
        if "refreshInterval" in config:
            self.as_interval_spinbox.setValue(int(config["refreshInterval"] / 1000))
        if "crosshair" in config:
            self.crosshair_checkbox.setChecked(bool(config["crosshair"]))
        if "backgroundColor" in config:
            self.background_button.color = QColor(config["backgroundColor"])
        if "xGrid" in config:
            self.x_grid_checkbox.setChecked(bool(config["xGrid"]))
        if "yGrid" in config:
            self.y_grid_checkbox.setChecked(bool(config["yGrid"]))
        if "gridOpacity" in config:
            self.grid_opacity_slider.setValue(int(config["gridOpacity"]))

change_gridline_opacity(opacity)

Slot to change the opacity of the gridlines for both X and Y axes.

Source code in trace/widgets/plot_settings.py
226
227
228
229
230
@Slot(int)
def change_gridline_opacity(self, opacity: int):
    """Slot to change the opacity of the gridlines for both X and Y axes."""
    visible = self.x_grid_visible
    self.set_plot_gridlines(visible, opacity)

plot_setup(config)

Read in the full config dictionary. For each config preset, set the widgets to match the value, which will send signals out that will actually cause the plot to change.

Source code in trace/widgets/plot_settings.py
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
@Slot(dict)
def plot_setup(self, config: dict):
    """Read in the full config dictionary. For each config preset, set the widgets to match the value, which will
    send signals out that will actually cause the plot to change."""
    if "title" in config:
        self.plot_title_line_edit.setText(str(config["title"]))
    if "legend" in config:
        self.legend_checkbox.setChecked(bool(config["legend"]))
    if "mouseMode" in config:
        mouse_mode_index = int(config["mouseMode"] / 3)
        self.mouse_mode_combo.setCurrentIndex(mouse_mode_index)
    if "refreshInterval" in config:
        self.as_interval_spinbox.setValue(int(config["refreshInterval"] / 1000))
    if "crosshair" in config:
        self.crosshair_checkbox.setChecked(bool(config["crosshair"]))
    if "backgroundColor" in config:
        self.background_button.color = QColor(config["backgroundColor"])
    if "xGrid" in config:
        self.x_grid_checkbox.setChecked(bool(config["xGrid"]))
    if "yGrid" in config:
        self.y_grid_checkbox.setChecked(bool(config["yGrid"]))
    if "gridOpacity" in config:
        self.grid_opacity_slider.setValue(int(config["gridOpacity"]))

set_axis_datetimes(_=None, time_range=None)

Slot used to update the QDateTimeEdits on the Axis tab. This slot is called when the plot's X-Axis range changes values.

Parameters

_ : ViewBox, optional The ViewBox on which the range is changing. This is unused time_range : Tuple[float, float], optional The new range values for the QDateTimeEdits, by default None

Source code in trace/widgets/plot_settings.py
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
@Slot(object, object)
def set_axis_datetimes(self, _: ViewBox = None, time_range: tuple[float, float] = None) -> None:
    """Slot used to update the QDateTimeEdits on the Axis tab. This
    slot is called when the plot's X-Axis range changes values.

    Parameters
    ----------
    _ : ViewBox, optional
        The ViewBox on which the range is changing. This is unused
    time_range : Tuple[float, float], optional
        The new range values for the QDateTimeEdits, by default None
    """
    if not time_range:
        time_range = self.plot.getXAxis().range
    if min(time_range) <= 0:
        return

    time_range = [datetime.fromtimestamp(f) for f in time_range]

    edits = (self.start_datetime, self.end_datetime)
    for ind, qdt in enumerate(edits):
        if qdt.hasFocus():
            continue
        qdt.blockSignals(True)
        qdt.setDateTime(QDateTime(time_range[ind]))
        qdt.blockSignals(False)

set_plot_gridlines(visible, opacity)

Helper function to set the plot's gridlines visibility and opacity. Updates both X and Y axes.

Source code in trace/widgets/plot_settings.py
232
233
234
235
236
def set_plot_gridlines(self, visible: bool, opacity: int):
    """Helper function to set the plot's gridlines visibility and opacity. Updates both X and Y axes."""
    normalized_opacity = opacity / 255
    self.plot.setShowXGrid(visible, normalized_opacity)
    self.grid_alpha_change.emit(opacity)

set_time_axis_range(raw_range=(None, None))

PyQT Slot to set the plot's X-Axis range. This slot should be triggered on QDateTimeEdit value change.

Parameters

raw_range : tuple[QDateTime, QDateTime], optional Takes in a tuple of 2 values, where one is a QDateTime and the other is None. The positioning changes either the plot's min or max range value. By default (None, None)

Source code in trace/widgets/plot_settings.py
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
@Slot(object)
def set_time_axis_range(self, raw_range: tuple[QDateTime, QDateTime] = (None, None)) -> None:
    """PyQT Slot to set the plot's X-Axis range. This slot should be
    triggered on QDateTimeEdit value change.

    Parameters
    ----------
    raw_range : tuple[QDateTime, QDateTime], optional
        Takes in a tuple of 2 values, where one is a QDateTime and
        the other is None. The positioning changes either the plot's
        min or max range value. By default (None, None)
    """
    # Disable Autoscroll if enabled
    # self.ui.cursor_scale_btn.click()
    self.disable_autoscroll.emit()

    proc_range = [None, None]
    for ind, val in enumerate(raw_range):
        # Values that are QDateTime are converted to a float timestamp
        if isinstance(val, QDateTime):
            proc_range[ind] = val.toSecsSinceEpoch()
        # Values that are None use the existing range value
        elif not val:
            proc_range[ind] = self.plot.getXAxis().range[ind]
    proc_range.sort()

    logger.debug(f"Setting plot's X-Axis range to {proc_range}")
    self.plot.plotItem.vb.blockSignals(True)
    self.plot.plotItem.setXRange(*proc_range, padding=0)
    self.plot.plotItem.vb.blockSignals(False)

show_x_grid(visible)

Slot to show or hide the X-Axis gridlines.

Source code in trace/widgets/plot_settings.py
215
216
217
218
219
@Slot(int)
def show_x_grid(self, visible: int):
    """Slot to show or hide the X-Axis gridlines."""
    opacity = self.gridline_opacity
    self.set_plot_gridlines(bool(visible), opacity)

Axis Settings

Curve Settings

CurveSettingsModal

Bases: QWidget

Source code in trace/widgets/curve_settings.py
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
class CurveSettingsModal(QWidget):
    color_changed = Signal(object)

    def __init__(self, parent: QWidget, plot: PyDMArchiverTimePlot, curve: TimePlotCurveItem):
        super().__init__(parent)
        self.setWindowFlag(Qt.Popup)

        self.legend = plot._legend
        self.curve = curve
        main_layout = QVBoxLayout()
        self.setLayout(main_layout)

        title_label = SettingsTitle(self, "Curve Settings", size=14)
        main_layout.addWidget(title_label)

        name_edit = QLineEdit(curve.name(), self)
        name_edit.editingFinished.connect(self.set_curve_name)
        name_row = SettingsRowItem(self, "Curve Name", name_edit)
        main_layout.addLayout(name_row)

        color_button = ColorButton(parent=self, color=curve.color_string)
        color_button.color_changed.connect(self.set_curve_color)
        color_row = SettingsRowItem(self, "Color", color_button)
        main_layout.addLayout(color_row)

        self.bin_count_line_edit = bin_count_line_edit = QLineEdit()
        bin_count_line_edit.setMaximumWidth(65)
        bin_count_line_edit.returnPressed.connect(self.set_curve_data_bins)
        optimized_bin_count = SettingsRowItem(self, "Optimized bin count", bin_count_line_edit)
        bin_count = curve.optimized_data_bins
        if not bin_count:
            bin_count = plot.optimized_data_bins
        bin_count_line_edit.setPlaceholderText(str(bin_count))
        main_layout.addLayout(optimized_bin_count)

        self.live_toggle = QCheckBox("")
        self.live_toggle.setCheckState(Qt.Checked if self.curve.liveData else Qt.Unchecked)
        self.live_toggle.stateChanged.connect(self.set_live_data_connection)
        live_toggle_row = SettingsRowItem(self, "Connect to Live", self.live_toggle)
        main_layout.addLayout(live_toggle_row)

        self.archive_toggle = QCheckBox("")
        self.archive_toggle.setCheckState(Qt.Checked if self.curve.use_archive_data else Qt.Unchecked)
        self.archive_toggle.stateChanged.connect(self.set_archive_data_connection)
        archive_toggle_row = SettingsRowItem(self, "Connect to Archive", self.archive_toggle)
        main_layout.addLayout(archive_toggle_row)

        line_title_label = SettingsTitle(self, "Line")
        main_layout.addWidget(line_title_label)

        init_curve_type = "Step" if curve.stepMode in ["left", "right", "center"] else "Direct"
        type_combo = ComboBoxWrapper(self, {"Direct": None, "Step": "right"}, init_curve_type)
        type_combo.text_changed.connect(self.set_curve_type)
        type_row = SettingsRowItem(self, "  Type", type_combo)
        main_layout.addLayout(type_row)

        style_combo = ComboBoxWrapper(self, TimePlotCurveItem.lines, curve.lineStyle)
        style_combo.text_changed.connect(self.set_curve_style)
        style_row = SettingsRowItem(self, "  Style", style_combo)
        main_layout.addLayout(style_row)

        width_options = {f"{i}px": i for i in range(1, 6)}
        width_combo = ComboBoxWrapper(self, width_options, curve.lineWidth)
        width_combo.text_changed.connect(self.set_curve_width)
        width_row = SettingsRowItem(self, "  Width", width_combo)
        main_layout.addLayout(width_row)

        extention_option = QCheckBox(self)
        extention_option.checkStateChanged.connect(lambda check: self.set_extension_option(bool(check)))
        extention_option_row = SettingsRowItem(self, "Line Extention", extention_option)
        main_layout.addLayout(extention_option_row)

        symbol_title_label = SettingsTitle(self, "Symbol")
        main_layout.addWidget(symbol_title_label)

        shape_combo = ComboBoxWrapper(self, TimePlotCurveItem.symbols, curve.symbol)
        shape_combo.text_changed.connect(self.set_symbol_shape)
        shape_row = SettingsRowItem(self, "  Shape", shape_combo)
        main_layout.addLayout(shape_row)

        size_options = {f"{i}px": i for i in range(5, 26, 5)}
        size_combo = ComboBoxWrapper(self, size_options, curve.symbolSize)
        size_combo.text_changed.connect(self.set_symbol_size)
        size_row = SettingsRowItem(self, "  Size", size_combo)
        main_layout.addLayout(size_row)

    def set_curve_data_bins(self):
        n_bins = self.bin_count_line_edit.text()
        if not n_bins.isdigit() or int(n_bins) < 1:
            self.bin_count_line_edit.setStyleSheet("border: 2px solid #d32f2f")
            logger.warning("Invalid bin count entered. Please enter a postive integer.")
            return
        else:
            self.bin_count_line_edit.setStyleSheet("")
        try:
            n_bins = int(n_bins)
            self.curve.setOptimizedDataBins(n_bins)
            self.bin_count_line_edit.setPlaceholderText(str(n_bins))
        except (AttributeError, ValueError) as e:
            logger.warning(f"Unable to set data bins: {e}")

    def set_live_data_connection(self, state: Qt.CheckState) -> None:
        self.curve.liveData = state == Qt.Checked

    def set_archive_data_connection(self, state: Qt.CheckState) -> None:
        self.curve.use_archive_data = state == Qt.Checked

    def show(self):
        parent_pos = self.parent().rect().bottomRight()
        global_pos = self.parent().mapToGlobal(parent_pos)
        self.move(global_pos)
        self.bin_count_line_edit.setStyleSheet("")
        self.bin_count_line_edit.setText("")
        super().show()

    @Slot()
    def set_curve_name(self):
        sender = self.sender()
        name = sender.text()

        if not name:
            sender.blockSignals(True)
            sender.setText(self.curve.name())
            sender.blockSignals(False)
        elif name != self.curve.name():
            legend_label = self.legend.getLabel(self.curve)
            legend_label.setText(name)

            x, y = self.curve.getData()
            self.curve.setData(name=name, x=x, y=y)

    @Slot(QColor)
    def set_curve_color(self, color: QColor):
        self.curve.color = color
        self.color_changed.emit(color)

    @Slot(object)
    def set_curve_type(self, curve_type: str | None = None) -> None:
        self.curve.stepMode = curve_type

    @Slot(object)
    def set_curve_style(self, style: int) -> None:
        self.curve.lineStyle = style

    @Slot(object)
    def set_curve_width(self, width: int) -> None:
        self.curve.lineWidth = width

    @Slot(object)
    def set_symbol_shape(self, shape: str) -> None:
        self.curve.symbol = shape

    @Slot(object)
    def set_symbol_size(self, size: int) -> None:
        self.curve.symbolSize = size

    @Slot(object)
    def set_extension_option(self, enable: bool) -> None:
        """Set the line extension based on the checkbox state."""
        self.curve.show_extension_line = enable
        self.curve.getViewBox().addItem(self.curve._extension_line)
        self.curve.redrawCurve()

set_extension_option(enable)

Set the line extension based on the checkbox state.

Source code in trace/widgets/curve_settings.py
167
168
169
170
171
172
@Slot(object)
def set_extension_option(self, enable: bool) -> None:
    """Set the line extension based on the checkbox state."""
    self.curve.show_extension_line = enable
    self.curve.getViewBox().addItem(self.curve._extension_line)
    self.curve.redrawCurve()