Skip to content

Commit 3fdf868

Browse files
committed
Merge branch 'master' into develop
# Conflicts: # CHANGELOG.md
2 parents 5058673 + 241416a commit 3fdf868

8 files changed

Lines changed: 57 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
# Changelog #
22

3-
## Version 2.6.3 ##
3+
## Version 2.7.0 ##
44

55
💥 New features / Enhancements:
66

77
* Added `AnnotatedPolygon` annotation to items
88
* Added `make.annotated_polygon` function to `plotpy.builder` module
99

10+
## Version 2.6.3 ##
11+
1012
🛠️ Bug fixes:
1113

14+
* PySide6 compatibility issues:
15+
* Fixed deprecated call to `QMouseEvent` in `tests/unit/utils.py`
16+
* Added workaround for `QPolygonF` shape point slicing
17+
* [Issue #21](https://github.com/PlotPyStack/PlotPy/issues/21) - PySide6 on Linux: segfault in test_colormap_editor.py
18+
* Fixed `sliderMoved` signal connection in `ColorMapEditor`
19+
* Fixed `AssertionError` in test_rect_zoom.py (Linux, Python 3.12, PyQt6)
1220
* Fixed typing issues in `plotpy.events` module:
1321
* Event objects were not properly typed (`QtCore.QEvent` instead of `QtGui.QMouseEvent`)
1422
* Event position arguments were not properly typed (`QtCore.QPoint` instead of `QtCore.QPointF`)
23+
* Fix NumPy `FutureWarning: Format strings passed to MaskedConstant are ignored [...]` when displaying masked pixel coordinates
1524

1625
## Version 2.6.2 ##
1726

plotpy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
.. _GitHub: https://github.com/PierreRaybaut/plotpy
2121
"""
2222

23-
__version__ = "2.6.2"
23+
__version__ = "2.7.0"
2424
__VERSION__ = tuple([int(number) for number in __version__.split(".")])
2525

2626
# --- Important note: DATAPATH and LOCALEPATH are used by guidata.configtools

plotpy/external/sliders/_generic_range_slider.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,29 @@ class _GenericRangeSlider(_GenericSlider):
2727
integers.
2828
"""
2929

30-
# Emitted when the slider value has changed, with the new slider values
31-
_valuesChanged = Signal(tuple)
32-
33-
# Emitted when sliderDown is true and the slider moves
34-
# This usually happens when the user is dragging the slider
35-
# The value is the positions of *all* handles.
36-
_slidersMoved = Signal(tuple)
30+
# -- BEGIN -- Original implementation, causing segfault on Linux with PySide6
31+
# https://github.com/PlotPyStack/PlotPy/issues/21
32+
# _valuesChanged = Signal(tuple)
33+
# _slidersMoved = Signal(tuple)
34+
# -- END --
35+
36+
# -- BEGIN -- New implementation: avoid segfault by overriding the class attributes
37+
# instead of overriding them through instance attributes in `__init__`
38+
valueChanged = Signal(tuple)
39+
sliderMoved = Signal(tuple)
40+
# -- END --
3741

3842
def __init__(self, *args, **kwargs):
3943
self._style = RangeSliderStyle()
4044

4145
super().__init__(*args, **kwargs)
42-
self.valueChanged = self._valuesChanged
43-
self.sliderMoved = self._slidersMoved
46+
47+
# -- BEGIN -- Original implementation, causing segfault on Linux with PySide6
48+
# https://github.com/PlotPyStack/PlotPy/issues/21
49+
# self.valueChanged = self._valuesChanged
50+
# self.sliderMoved = self._slidersMoved
51+
# -- END --
52+
4453
# list of values
4554
self._value: List[_T] = [20, 80]
4655

plotpy/external/sliders/_generic_slider.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
scalar (with one handle per item), and it forms the basis of
2020
QRangeSlider.
2121
"""
22+
2223
import os
2324
import platform
2425
from typing import TypeVar
@@ -59,9 +60,19 @@
5960

6061

6162
class _GenericSlider(QSlider):
62-
_fvalueChanged = Signal(int)
63-
_fsliderMoved = Signal(int)
64-
_frangeChanged = Signal(int, int)
63+
# -- BEGIN -- Original implementation, causing segfault on Linux with PySide6
64+
# https://github.com/PlotPyStack/PlotPy/issues/21
65+
# _fvalueChanged = Signal(int)
66+
# _fsliderMoved = Signal(int)
67+
# _frangeChanged = Signal(int, int)
68+
# -- END --
69+
70+
# -- BEGIN -- New implementation: avoid segfault by overriding the class attributes
71+
# instead of overriding them through instance attributes in `__init__`
72+
valueChanged = Signal(int)
73+
sliderMoved = Signal(int)
74+
rangeChanged = Signal(int, int)
75+
# -- END --
6576

6677
MAX_DISPLAY = 5000
6778

@@ -88,9 +99,13 @@ def __init__(self, *args, **kwargs) -> None:
8899
self._control_fraction = 0.04
89100

90101
super().__init__(*args, **kwargs)
91-
self.valueChanged = self._fvalueChanged
92-
self.sliderMoved = self._fsliderMoved
93-
self.rangeChanged = self._frangeChanged
102+
103+
# -- BEGIN -- Original implementation, causing segfault on Linux with PySide6
104+
# https://github.com/PlotPyStack/PlotPy/issues/21
105+
# self.valueChanged = self._fvalueChanged
106+
# self.sliderMoved = self._fsliderMoved
107+
# self.rangeChanged = self._frangeChanged
108+
# -- END --
94109

95110
self.setAttribute(Qt.WidgetAttribute.WA_Hover)
96111
self.setStyleSheet("")

plotpy/items/shape/polygon.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,10 @@ def draw(
302302
painter.setBrush(brush)
303303
points = self.transform_points(xMap, yMap)
304304
if self.ADDITIONNAL_POINTS:
305-
shape_points = points[: -self.ADDITIONNAL_POINTS]
306-
other_points = points[-self.ADDITIONNAL_POINTS :]
305+
# Slice indexing is not supported by PySide6, so we convert the `QPolygonF`
306+
# object to a list before converting it back to a `QPolygonF` object:
307+
shape_points = QG.QPolygonF(list(points)[: -self.ADDITIONNAL_POINTS])
308+
other_points = QG.QPolygonF(list(points)[-self.ADDITIONNAL_POINTS :])
307309
else:
308310
shape_points = points
309311
other_points = []

plotpy/tests/unit/test_rect_zoom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def zoom(
5353
def test_rect_zoom_tool():
5454
"""Test the rectangular zoom tool."""
5555
x_path = linspace(0, 0.5, 100)
56-
y_path = linspace(0, 0.5, 100)
56+
y_path = linspace(0, 0.4, 100)
5757
zoom(x_path, y_path, lambda og, final: final < og)
5858

5959

plotpy/tests/unit/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ def mouse_event_at_relative_plot_pos(
162162
mouse_event = QG.QMouseEvent(
163163
type_,
164164
canvas_pos,
165+
QC.QPointF(canvas.mapToGlobal(canvas_pos.toPoint())),
165166
btn,
166167
btn,
167168
mod,

plotpy/widgets/colormap/editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def __init__(
155155
self.colormap_widget.HANDLE_ADDED.connect(self.new_tab)
156156
self.colormap_widget.HANDLE_DELETED.connect(self.delete_tab)
157157
self.colormap_widget.multi_range_hslider.sliderMoved.connect(
158-
self.update_current_dataset
158+
lambda *args: self.update_current_dataset()
159159
)
160160

161161
def set_colormap(self, colormap: EditableColormap) -> None:

0 commit comments

Comments
 (0)