Skip to content

Commit 2148be9

Browse files
committed
Fixed AnnotatedEllipseTool: AttributeError when using tool
1 parent 7f88962 commit 2148be9

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# PlotPy Releases #
22

3+
## Version 2.0.1 ##
4+
5+
🛠️ Bug fixes:
6+
7+
* Fixed `plotpy.tools.AnnotatedEllipseTool`: `AttributeError` when finalizing the shape
8+
39
## Version 2.0.0 ##
410

511
This version is the first release of the 2.0 series, which is distributed under the

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.0.0"
23+
__version__ = "2.0.1"
2424
__VERSION__ = tuple([int(number) for number in __version__.split(".")])
2525

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

plotpy/items/annotation.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,17 @@ def __init__(self, x1=0, y1=0, x2=0, y2=0, annotationparam=None):
746746
AnnotatedShape.__init__(self, annotationparam)
747747
self.set_xdiameter(x1, y1, x2, y2)
748748
self.setIcon(get_icon("ellipse_shape.png"))
749-
self.shape.switch_to_ellipse()
749+
self.switch_to_ellipse()
750750

751751
# ----Public API-------------------------------------------------------------
752+
def switch_to_ellipse(self):
753+
"""Switch to ellipse mode"""
754+
self.shape.switch_to_ellipse()
755+
756+
def switch_to_circle(self):
757+
"""Switch to circle mode"""
758+
self.shape.switch_to_circle()
759+
752760
def set_xdiameter(self, x0, y0, x1, y1):
753761
"""Set the coordinates of the ellipse's X-axis diameter
754762
Warning: transform matrix is not applied here"""

plotpy/tools/annotation.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@ def create_shape(self):
6464
self.set_shape_style(annotation)
6565
return annotation, 0, 1
6666

67-
def handle_final_shape(self, shape):
68-
"""
69-
70-
:param shape:
71-
"""
72-
shape.shape.switch_to_ellipse()
73-
super().handle_final_shape(shape)
74-
7567

7668
class AnnotatedPointTool(PointTool):
7769
def create_shape(self):

0 commit comments

Comments
 (0)