1717 from qtpy .QtCore import QPointF # helping out python_qt_documentation
1818
1919 from plotpy .interfaces import IItemType
20+ from plotpy .plot import BasePlot
2021 from plotpy .styles .base import ItemParameters
2122
2223
@@ -219,10 +220,10 @@ def move_local_point_to(
219220 """
220221 pt = canvas_to_axes (self , pos )
221222 self .move_point_to (handle , pt , ctrl )
222- if self .plot ():
223- self . plot (). SIG_ITEM_RESIZED . emit ( self , 0 , 0 )
224- if self . plot ():
225- self . plot () .SIG_ITEM_HANDLE_MOVED .emit (self )
223+ plot : BasePlot = self .plot ()
224+ if plot is not None :
225+ plot . SIG_ITEM_RESIZED . emit ( self , 0 , 0 )
226+ plot .SIG_ITEM_HANDLE_MOVED .emit (self )
226227
227228 def move_local_shape (self , old_pos : QPointF , new_pos : QPointF ) -> None :
228229 """Translate the shape such that old_pos becomes new_pos in canvas coordinates
@@ -234,8 +235,9 @@ def move_local_shape(self, old_pos: QPointF, new_pos: QPointF) -> None:
234235 old_pt = canvas_to_axes (self , old_pos )
235236 new_pt = canvas_to_axes (self , new_pos )
236237 self .move_shape (old_pt , new_pt )
237- if self .plot ():
238- self .plot ().SIG_ITEM_MOVED .emit (self , * (old_pt + new_pt ))
238+ plot : BasePlot = self .plot ()
239+ if plot is not None :
240+ plot .SIG_ITEM_MOVED .emit (self , * (old_pt + new_pt ))
239241
240242 def move_with_selection (self , delta_x : float , delta_y : float ) -> None :
241243 """Translate the item together with other selected items
@@ -270,7 +272,7 @@ def move_shape(self, old_pos: QPointF, new_pos: QPointF) -> None:
270272
271273 def invalidate_plot (self ) -> None :
272274 """Invalidate the plot to force a redraw"""
273- plot = self .plot ()
275+ plot : BasePlot = self .plot ()
274276 if plot is not None :
275277 plot .invalidate ()
276278
0 commit comments