Skip to content

Commit 983cec9

Browse files
committed
DownSamplingTool: enabled if a curve item is active
1 parent 9de2cba commit 983cec9

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

plotpy/tools/curve.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,9 +1097,7 @@ def activate_command(self, plot: BasePlot, checked: bool) -> None:
10971097
plot: BasePlot instance
10981098
checked: Wether the tool is checked or not
10991099
"""
1100-
curve_item: CurveItem | None = plot.get_last_active_item(
1101-
ICurveItemType
1102-
) # type: ignore
1100+
curve_item: CurveItem | None = plot.get_last_active_item(ICurveItemType)
11031101
if curve_item is not None:
11041102
curve_item.param.use_dsamp = checked
11051103
curve_item.update_params()
@@ -1110,11 +1108,10 @@ def update_status(self, plot: BasePlot) -> None:
11101108
Args:
11111109
plot: BasePlot instance
11121110
"""
1113-
curve_item: CurveItem | None = plot.get_last_active_item(
1114-
ICurveItemType
1115-
) # type: ignore
1116-
if curve_item is not None and self.action is not None:
1117-
self.action.setChecked(curve_item.param.use_dsamp)
1111+
item: CurveItem | None = plot.get_last_active_item(ICurveItemType)
1112+
self.action.setEnabled(item is not None)
1113+
if item is not None and self.action is not None:
1114+
self.action.setChecked(item.param.use_dsamp)
11181115

11191116

11201117
def export_curve_data(item: CurveItem) -> None:

0 commit comments

Comments
 (0)