Skip to content

Commit 3aa2eb8

Browse files
committed
Fix docstrings issues (Qt intersphinx + newlines w/o space)
1 parent cb37a98 commit 3aa2eb8

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

plotpy/events.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
from plotpy.items.shape.marker import Marker
3131

3232
if TYPE_CHECKING:
33+
from qtpy.QtCore import QPoint
34+
3335
from plotpy.plot.base import BasePlot
3436

3537
CursorShape = type(QC.Qt.CursorShape.ArrowCursor)
@@ -663,7 +665,7 @@ def __init__(
663665
self.marker: Marker | None = None
664666

665667
def get_pan_param(
666-
self, plot: BasePlot, pos: QC.QPoint
668+
self, plot: BasePlot, pos: QPoint
667669
) -> tuple[tuple[float, float, float, float], tuple[float, float, float, float]]:
668670
"""Returns the parameters to use for panning the plot.
669671
@@ -682,7 +684,7 @@ def get_pan_param(
682684
return dx, dy
683685

684686
def get_zoom_param(
685-
self, plot: BasePlot, pos: QC.QPoint, factor: float
687+
self, plot: BasePlot, pos: QPoint, factor: float
686688
) -> tuple[tuple[float, float, float, float], tuple[float, float, float, float]]:
687689
"""Returns the parameters to use for zooming on the plot.
688690

plotpy/mathutils/colormaps.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def load_raw_colormaps_from_json(
6262
6363
Args:
6464
json_path: absolute path to the json to open. If file is not found, returns an
65-
empty dictionary
65+
empty dictionary
6666
6767
Returns:
6868
Dictionnary of colormaps names -> raw colormap sequences
@@ -179,11 +179,11 @@ def build_icon_from_cmap(
179179
width: icon width
180180
height: icon height
181181
orientation: orientation of the colormap in the icon. Can be "h" for horizontal
182-
or "v" for vertical
182+
or "v" for vertical
183183
margin: margin around the colormap in the icon. Beware that the margin is
184-
included in the given icon size. For example, if margin is 1 and width is 16,
185-
the actual colormap width will be 14 (16 - 2 * 1). This was done to prevent
186-
interpolation on display.
184+
included in the given icon size. For example, if margin is 1 and width is 16,
185+
the actual colormap width will be 14 (16 - 2 * 1). This was done to prevent
186+
interpolation on display.
187187
"""
188188

189189
padded_width = width - 2 * margin
@@ -233,11 +233,11 @@ def build_icon_from_cmap_name(
233233
width: icon width
234234
height: icon height
235235
orientation: orientation of the colormap in the icon. Can be "h" for horizontal
236-
or "v" for vertical
236+
or "v" for vertical
237237
margin: margin around the colormap in the icon. Beware that the margin is
238-
included in the given icon size. For example, if margin is 1 and width is 16,
239-
the actual colormap width will be 14 (16 - 2 * 1). This was done to prevent
240-
interpolation on display.
238+
included in the given icon size. For example, if margin is 1 and width is 16,
239+
the actual colormap width will be 14 (16 - 2 * 1). This was done to prevent
240+
interpolation on display.
241241
242242
Returns:
243243
QIcon representing the colormap
@@ -253,7 +253,7 @@ def get_cmap(cmap_name: str) -> EditableColormap:
253253
254254
Args:
255255
cmap_name: colormap name to search in ALL_COLORMAPS. All keys in ALL_COLORMAPS
256-
are lower case, so the given name is also lowered.
256+
are lower case, so the given name is also lowered.
257257
258258
Returns:
259259
A CustomQwtLinearColormap instance corresponding to the given name, if no
@@ -270,7 +270,7 @@ def cmap_exists(cmap_name: str, cmap_dict: CmapDictType | None = None) -> bool:
270270
271271
Args:
272272
cmap_name: colormap name to search in given colormap dictionnary. All keys in
273-
the dictionary are lower case, so the given name is also lowered.
273+
the dictionary are lower case, so the given name is also lowered.
274274
cmap_dict: colormap dictionnary to search in. If None, ALL_COLORMAPS is used.
275275
276276
Returns:

plotpy/tools/curve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class SelectPointTool(InteractiveTool):
180180
icon: Tool icon path. Defaults to None.
181181
tip: Available tip. Defaults to None.
182182
end_callback: Callback function taking a Self instance as argument that will
183-
be passed when the user stops dragging the point. Defaults to None.
183+
be passed when the user stops dragging the point. Defaults to None.
184184
toolbar_id: Toolbar Id to use. Defaults to DefaultToolbarID.
185185
marker_style: Marker style. Defaults to None.
186186
switch_to_default_tool: Wether to use as the default tool or not.

plotpy/tools/image.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from guidata.widgets.arrayeditor import ArrayEditor
1313
from qtpy import QtCore as QC
1414
from qtpy import QtWidgets as QW
15-
from qtpy.QtWidgets import QAction, QActionGroup
1615

1716
from plotpy import io
1817
from plotpy.config import _
@@ -52,7 +51,8 @@
5251
from plotpy.widgets.imagefile import exec_image_save_dialog
5352

5453
if TYPE_CHECKING: # pragma: no cover
55-
from qtpy import QtGui as QG
54+
from qtpy.QtCore import QEvent
55+
from qtpy.QtWidgets import QMenu
5656

5757
from plotpy.events import StatefulEventFilter
5858
from plotpy.interfaces.items import IBasePlotItem
@@ -327,7 +327,7 @@ def __init__(self, manager: PlotManager) -> None:
327327
super().__init__(manager, _("Aspect ratio"), tip=None, toolbar_id=None)
328328
self.action.setEnabled(True)
329329

330-
def create_action_menu(self, manager: PlotManager) -> QW.QMenu:
330+
def create_action_menu(self, manager: PlotManager) -> QMenu:
331331
"""Create and return menu for the tool's action"""
332332
self.ar_param = AspectRatioParam(_("Aspect ratio"))
333333
menu = QW.QMenu()
@@ -428,7 +428,7 @@ def update_status(self, plot: BasePlot) -> None:
428428
item = plot.get_last_active_item(IVoiImageItemType)
429429
panel = self.manager.get_panel(self.panel_id)
430430
for action in panel.toolbar.actions():
431-
if isinstance(action, QAction):
431+
if isinstance(action, QW.QAction):
432432
action.setEnabled(item is not None)
433433

434434

@@ -557,7 +557,7 @@ def __init__(self, manager: PlotManager, toolbar_id=DefaultToolbarID) -> None:
557557
)
558558
self.masked_image = None # associated masked image item
559559

560-
def create_action_menu(self, manager: PlotManager) -> QW.QMenu:
560+
def create_action_menu(self, manager: PlotManager) -> QMenu:
561561
"""Create and return the tool's action menu for a given manager.
562562
563563
Args:
@@ -912,16 +912,16 @@ class RotationCenterTool(InteractiveTool):
912912
Args:
913913
manager: PlotManager instance
914914
toolbar_id: toolbar id to use. Defaults to DefaultToolbarID.. Defaults to
915-
DefaultToolbarID.
915+
DefaultToolbarID.
916916
title: tool title. Defaults to None.
917917
icon: tool icon filename. Defaults to None.
918918
tip: user tip to be displayed. Defaults to None.
919919
switch_to_default_tool: Flag to switch to default tool. Defaults to True.
920920
rotation_point_move_with_shape: Flag to move rotation point with shape when it
921-
is moved. Defaults to True.
921+
is moved. Defaults to True.
922922
rotation_center: True if image already has a rotation center, False otherwise.
923923
on_all_items: True if rotation center should be set on all items or False if only
924-
on selected ones. Defaults to True.
924+
on selected ones. Defaults to True.
925925
926926
"""
927927

@@ -1006,7 +1006,7 @@ def action_triggered(self, checked: bool) -> None:
10061006
if self.rotation_center and self.filter is not None:
10071007
self.mouse_press(self.filter, QC.QEvent(QC.QEvent.Type.MouseButtonPress))
10081008

1009-
def mouse_press(self, filter: StatefulEventFilter, event: QC.QEvent) -> None:
1009+
def mouse_press(self, filter: StatefulEventFilter, event: QEvent) -> None:
10101010
"""We create a new shape if it's the first point
10111011
otherwise we add a new point.
10121012

0 commit comments

Comments
 (0)