Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bc3c026

Browse filesBrowse files
committed
Merge branch 'develop'
2 parents f4d9686 + 9df9757 commit bc3c026
Copy full SHA for bc3c026

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

49 files changed

+1409
-549
lines changed

‎.github/workflows/build.yml

Copy file name to clipboardExpand all lines: .github/workflows/build.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717

1818
- name: Build wheels
19-
run: pipx run cibuildwheel==2.20.0
19+
run: pipx run cibuildwheel==2.21.2
2020

2121
- uses: actions/upload-artifact@v4
2222
with:

‎.github/workflows/build_deploy.yml

Copy file name to clipboardExpand all lines: .github/workflows/build_deploy.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@v4
2020

2121
- name: Build wheels
22-
uses: pypa/cibuildwheel@v2.20.0
22+
uses: pypa/cibuildwheel@v2.21.2
2323

2424
- uses: actions/upload-artifact@v4
2525
with:

‎.github/workflows/test.yml

Copy file name to clipboardExpand all lines: .github/workflows/test.yml
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
# Inspired from https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions
55

6-
name: Python package
6+
name: Build, install and test
77

88
on:
99
push:
10-
branches: [ "master" ]
10+
branches: [ "master", "develop" ]
1111
pull_request:
12-
branches: [ "master" ]
12+
branches: [ "master", "develop" ]
1313

1414
jobs:
1515
build:
@@ -21,12 +21,12 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
python-version: ["3.8", "3.11", "3.12"]
24+
python-version: ["3.9", "3.13"]
2525

2626
steps:
27-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2828
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v3
29+
uses: actions/setup-python@v5
3030
with:
3131
python-version: ${{ matrix.python-version }}
3232
- name: Install dependencies

‎CHANGELOG.md

Copy file name to clipboardExpand all lines: CHANGELOG.md
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Changelog #
22

3+
## Version 2.7.0 ##
4+
5+
Supported versions of Python have been updated (drop support for Python 3.8, add support for Python 3.13):
6+
7+
* PlotPy < 2.7.0: Python 3.8, 3.9, 3.10, 3.11 and 3.12
8+
* PlotPy >= 2.7.0: Python 3.9, 3.10, 3.11, 3.12 and 3.13
9+
10+
Other dependencies have been updated:
11+
12+
* Updated versions to those available at the time of the release of the oldest supported Python version (3.9)
13+
* Exception: Cython 3.0 is required for Python 3.13
14+
15+
💥 New features / Enhancements:
16+
17+
* Added `AnnotatedPolygon` annotation to items
18+
* Added `make.annotated_polygon` function to `plotpy.builder` module
19+
* Customization of annotation information:
20+
* Added `info_callback` argument to all annotation class constructors
21+
* Added `set_info_callback` method to all annotation classes
22+
* The `info_callback` is a function that takes the annotation object and returns a string with the information to display
23+
* Default `info_callback` is redirected to the `get_infos` method of the annotation object (this makes the feature backward compatible)
24+
25+
🛠️ Bug fixes:
26+
27+
* Fixed `pydicom` support: use `dcmread` instead of `read_file` to read DICOM files
28+
329
## Version 2.6.3 ##
430

531
🧯 In this release, test coverage is 79%.

‎doc/dev/platforms.rst

Copy file name to clipboardExpand all lines: doc/dev/platforms.rst
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ The following sections describe the reference platforms for the project.
77

88
.. note::
99

10-
The officially supported Python versions are 3.8, 3.9 and 3.10.
11-
However, the project should work on any earlier Python 3 version.
10+
The officially supported Python versions are 3.9, 3.10, 3.11, 3.12 and 3.13.
1211

1312
The officially supported Qt binding is PyQt5. However, efforts have been
1413
made and will continue to be made to support PyQt6 and PySide6 as well.
1514

1615
The project is currently tested on the following platforms:
1716

1817
* Microsoft Windows 10 (64-bit)
18+
* Microsoft Windows 11 (64-bit)
1919
* CentOS Stream 8.8 (64-bit)
20+
* Ubuntu 22.04 LTS (64-bit)
2021

2122
However, it should work on any other platform supported by its dependencies.
2223

‎doc/features/items/builder.rst

Copy file name to clipboardExpand all lines: doc/features/items/builder.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ used to simplify the creation of plot items.
1212
:members:
1313

1414
.. autoclass:: plotpy.builder.PlotBuilder
15-
:members: widget,dialog,window,gridparam,grid,mcurve,pcurve,curve,merror,perror,error,histogram,phistogram,range,vcursor,hcursor,xcursor,marker,image,maskedimage,maskedxyimage,rgbimage,quadgrid,pcolor,trimage,xyimage,imagefilter,contours,histogram2D,rectangle,ellipse,polygon,circle,segment,svg,annotated_point,annotated_rectangle,annotated_ellipse,annotated_circle,annotated_segment,label,legend,info_label,range_info_label,computation,computations,computation2d,computations2d
15+
:members: widget,dialog,window,gridparam,grid,mcurve,pcurve,curve,merror,perror,error,histogram,phistogram,range,vcursor,hcursor,xcursor,marker,image,maskedimage,maskedxyimage,rgbimage,quadgrid,pcolor,trimage,xyimage,imagefilter,contours,histogram2D,rectangle,ellipse,polygon,circle,segment,svg,annotated_point,annotated_rectangle,annotated_ellipse,annotated_circle,annotated_segment,annotated_polygon,label,legend,info_label,range_info_label,computation,computations,computation2d,computations2d

‎doc/features/items/overview.rst

Copy file name to clipboardExpand all lines: doc/features/items/overview.rst
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ The following annotation items are available:
7575
* :py:class:`.AnnotatedObliqueRectangle`
7676
* :py:class:`.AnnotatedEllipse`
7777
* :py:class:`.AnnotatedCircle`
78+
* :py:class:`.AnnotatedPolygon`
7879

7980
Labels
8081
^^^^^^

‎doc/features/items/reference.rst

Copy file name to clipboardExpand all lines: doc/features/items/reference.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ Annotations
124124
:members:
125125
.. autoclass:: plotpy.items.AnnotatedCircle
126126
:members:
127+
.. autoclass:: plotpy.items.AnnotatedPolygon
128+
:members:
127129

128130
Labels
129131
^^^^^^

‎doc/features/tools/reference.rst

Copy file name to clipboardExpand all lines: doc/features/tools/reference.rst
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Shape tools
5858

5959
.. autoclass:: plotpy.tools.MultiLineTool
6060
:members:
61-
.. autoclass:: plotpy.tools.FreeFormTool
61+
.. autoclass:: plotpy.tools.PolygonTool
6262
:members:
6363
.. autoclass:: plotpy.tools.LabelTool
6464
:members:
@@ -84,6 +84,8 @@ Shape tools
8484
:members:
8585
.. autoclass:: plotpy.tools.AnnotatedSegmentTool
8686
:members:
87+
.. autoclass:: plotpy.tools.AnnotatedPolygonTool
88+
:members:
8789
.. autoclass:: plotpy.tools.HRangeTool
8890
:members:
8991

‎doc/intro/motivation.rst

Copy file name to clipboardExpand all lines: doc/intro/motivation.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ From a developer point of view, PlotPy V2 is a major overhaul of PlotPy V1:
1313
all over the codebase
1414

1515
.. note::
16-
PlotPy V2 is fully typed using Python 3.8+ type annotations.
16+
PlotPy V2 is fully typed using Python type annotations.
1717
This means that you can use your IDE to get autocompletion and type checking
1818
(e.g. with VSCode, Visual Studio, etc.).
1919
This is a major improvement when you write code using PlotPy V2:

‎doc/requirements.rst

Copy file name to clipboardExpand all lines: doc/requirements.rst
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ The :mod:`plotpy` package requires the following Python modules:
88
- Version
99
- Summary
1010
* - Python
11-
- >=3.8, <4
11+
- >=3.9, <4
1212
- Python programming language
1313
* - guidata
14-
- >=3.4
14+
- >=3.7
1515
- Automatic GUI generation for easy dataset editing and display
1616
* - PythonQwt
17-
- >=0.12.1
17+
- >=0.14
1818
- Qt plotting widgets for Python
19-
* - NumPy
20-
- >=1.17
21-
- Fundamental package for array computing in Python
2219
* - SciPy
23-
- >=1.3
20+
- >=1.5
2421
- Fundamental algorithms for scientific computing in Python
22+
* - scikit-image
23+
- >= 0.18
24+
- Image processing in Python
2525
* - Pillow
2626
-
2727
- Python Imaging Library (Fork)

‎doc/update_requirements.py

Copy file name to clipboardExpand all lines: doc/update_requirements.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515

1616
if __name__ == "__main__":
1717
print("Updating requirements.rst file...", end=" ")
18-
gen_module_req_rst(plotpy, ["Python>=3.8", "PyQt5>=5.11"])
18+
gen_module_req_rst(plotpy, ["Python>=3.9", "PyQt5>=5.11"])
1919
print("done.")

‎plotpy/__init__.py

Copy file name to clipboardExpand all lines: plotpy/__init__.py
+1-1Lines 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.3"
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/builder/annotation.py

Copy file name to clipboardExpand all lines: plotpy/builder/annotation.py
+61-21Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
AnnotatedCircle,
2828
AnnotatedEllipse,
2929
AnnotatedPoint,
30+
AnnotatedPolygon,
3031
AnnotatedRectangle,
3132
AnnotatedSegment,
3233
)
@@ -126,10 +127,7 @@ def annotated_point(
126127
def __annotated_shape(
127128
self,
128129
shapeclass,
129-
x0,
130-
y0,
131-
x1,
132-
y1,
130+
points,
133131
title,
134132
subtitle,
135133
show_label,
@@ -153,7 +151,10 @@ def __annotated_shape(
153151
readonly=readonly,
154152
private=private,
155153
)
156-
shape = shapeclass(x0, y0, x1, y1, param)
154+
if isinstance(points, np.ndarray):
155+
shape = shapeclass(points, annotationparam=param)
156+
else:
157+
shape = shapeclass(*points, annotationparam=param)
157158
shape.set_style("plot", "shape/drag")
158159
return shape
159160

@@ -195,12 +196,10 @@ def annotated_rectangle(
195196
Returns:
196197
:py:class:`.AnnotatedRectangle` object
197198
"""
199+
points = x0, y0, x1, y1
198200
return self.__annotated_shape(
199201
AnnotatedRectangle,
200-
x0,
201-
y0,
202-
x1,
203-
y1,
202+
points,
204203
title,
205204
subtitle,
206205
show_label,
@@ -259,12 +258,10 @@ def annotated_ellipse(
259258
Returns:
260259
:py:class:`.AnnotatedEllipse` object
261260
"""
261+
points = x0, y0, x1, y1
262262
item = self.__annotated_shape(
263263
AnnotatedEllipse,
264-
x0,
265-
y0,
266-
x1,
267-
y1,
264+
points,
268265
title,
269266
subtitle,
270267
show_label,
@@ -318,12 +315,10 @@ def annotated_circle(
318315
Returns:
319316
:py:class:`.AnnotatedCircle` object
320317
"""
318+
points = x0, y0, x1, y1
321319
return self.__annotated_shape(
322320
AnnotatedCircle,
323-
x0,
324-
y0,
325-
x1,
326-
y1,
321+
points,
327322
title,
328323
subtitle,
329324
show_label,
@@ -374,12 +369,57 @@ def annotated_segment(
374369
Returns:
375370
:py:class:`.AnnotatedSegment` object
376371
"""
372+
points = x0, y0, x1, y1
377373
return self.__annotated_shape(
378374
AnnotatedSegment,
379-
x0,
380-
y0,
381-
x1,
382-
y1,
375+
points,
376+
title,
377+
subtitle,
378+
show_label,
379+
show_computations,
380+
show_subtitle,
381+
format,
382+
uncertainty,
383+
transform_matrix,
384+
readonly,
385+
private,
386+
)
387+
388+
def annotated_polygon(
389+
self,
390+
points: np.ndarray,
391+
title: str | None = None,
392+
subtitle: str | None = None,
393+
show_label: bool | None = None,
394+
show_computations: bool | None = None,
395+
show_subtitle: bool | None = None,
396+
format: str | None = None,
397+
uncertainty: float | None = None,
398+
transform_matrix: np.ndarray | None = None,
399+
readonly: bool | None = None,
400+
private: bool | None = None,
401+
) -> AnnotatedPolygon:
402+
"""Make an annotated polygon `plot item`
403+
404+
Args:
405+
points: polygon points
406+
title: label name. Default is None
407+
subtitle: label subtitle. Default is None
408+
show_label: show label. Default is None
409+
show_computations: show computations. Default is None
410+
show_subtitle: show subtitle. Default is None
411+
format: string formatting. Default is None
412+
uncertainty: measurement relative uncertainty. Default is None
413+
transform_matrix: transform matrix. Default is None
414+
readonly: readonly. Default is None
415+
private: private. Default is None
416+
417+
Returns:
418+
:py:class:`.AnnotatedPolygon` object
419+
"""
420+
return self.__annotated_shape(
421+
AnnotatedPolygon,
422+
points,
383423
title,
384424
subtitle,
385425
show_label,

‎plotpy/builder/image.py

Copy file name to clipboardExpand all lines: plotpy/builder/image.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ def image(
226226
if isinstance(filename, str) and filename.lower().endswith(".dcm"):
227227
# pylint: disable=import-outside-toplevel
228228
# pylint: disable=import-error
229-
from pydicom import dicomio # type:ignore
229+
from pydicom import dcmread # type:ignore
230230

231-
template = dicomio.read_file(filename, stop_before_pixels=True, force=True)
231+
template = dcmread(filename, stop_before_pixels=True, force=True)
232232
ipp = getattr(template, "ImagePositionPatient", ["0", "0", "0"])
233233
pxs = getattr(template, "PixelSpacing", ["1", "1"])
234234
ipx, ipy = float(ipp[0]), float(ipp[1])

‎plotpy/builder/shape.py

Copy file name to clipboardExpand all lines: plotpy/builder/shape.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ def svg(
179179
assert shape in ("circle", "rectangle", "square")
180180
assert isinstance(fname_or_data, (str, bytes))
181181
if isinstance(fname_or_data, str):
182-
data = open(fname_or_data, "rb").read()
182+
with open(fname_or_data, "rb") as file:
183+
data = file.read()
183184
else:
184185
data = fname_or_data
185186
shapeklass = {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.