Skip to content

Commit b5e9387

Browse files
committed
fix colormap widget after pyqwt update
1 parent a63e313 commit b5e9387

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

plotpy/widgets/colormap/widget.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,14 @@ def get_stop_color(self, index: int) -> QG.QColor:
227227
index = min(index, len(self.stops))
228228
return QG.QColor(self.stops[index].rgb)
229229

230+
def stop_values(self) -> list[float]:
231+
"""Returns the color stops values as a list of floats.
232+
233+
Returns:
234+
List of color stops values.
235+
"""
236+
return [stop.pos for stop in self.stops]
237+
230238

231239
class ColorMapWidget(QW.QWidget):
232240
"""Simple colormap widget containing a horizontal slider and a colorbar image.
@@ -293,7 +301,7 @@ def __init__(
293301
self._colormap = EditableColormap(color1, color2)
294302
else:
295303
self._colormap = colormap
296-
self.set_handles_values(colormap.colorStops())
304+
self.set_handles_values(colormap.stop_values())
297305

298306
self.colortable = self._colormap.colorTable(self.qwt_color_interval)
299307

@@ -324,7 +332,7 @@ def set_colormap(self, colormap: EditableColormap) -> None:
324332
Args:
325333
colormap: replacement colormap
326334
"""
327-
new_values = colormap.colorStops()
335+
new_values = colormap.stop_values()
328336
self._colormap = colormap
329337
self.set_handles_values(new_values)
330338
self.COLORMAP_CHANGED.emit()
@@ -426,7 +434,7 @@ def edit_color_stop(
426434
new_color = QG.QColor(self.colortable[new_color])
427435

428436
self._colormap.move_color_stop(index, new_pos, new_color)
429-
self.set_handles_values(self._colormap.colorStops())
437+
self.set_handles_values(self._colormap.stop_values())
430438
self.COLORMAP_CHANGED.emit()
431439

432440
def _edit_color_map_on_slider_change(self, raw_values: tuple[float, ...]) -> None:

0 commit comments

Comments
 (0)