|
12 | 12 | from guidata.widgets.arrayeditor import ArrayEditor |
13 | 13 | from qtpy import QtCore as QC |
14 | 14 | from qtpy import QtWidgets as QW |
15 | | -from qtpy.QtWidgets import QAction, QActionGroup |
16 | 15 |
|
17 | 16 | from plotpy import io |
18 | 17 | from plotpy.config import _ |
|
52 | 51 | from plotpy.widgets.imagefile import exec_image_save_dialog |
53 | 52 |
|
54 | 53 | 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 |
56 | 56 |
|
57 | 57 | from plotpy.events import StatefulEventFilter |
58 | 58 | from plotpy.interfaces.items import IBasePlotItem |
@@ -327,7 +327,7 @@ def __init__(self, manager: PlotManager) -> None: |
327 | 327 | super().__init__(manager, _("Aspect ratio"), tip=None, toolbar_id=None) |
328 | 328 | self.action.setEnabled(True) |
329 | 329 |
|
330 | | - def create_action_menu(self, manager: PlotManager) -> QW.QMenu: |
| 330 | + def create_action_menu(self, manager: PlotManager) -> QMenu: |
331 | 331 | """Create and return menu for the tool's action""" |
332 | 332 | self.ar_param = AspectRatioParam(_("Aspect ratio")) |
333 | 333 | menu = QW.QMenu() |
@@ -428,7 +428,7 @@ def update_status(self, plot: BasePlot) -> None: |
428 | 428 | item = plot.get_last_active_item(IVoiImageItemType) |
429 | 429 | panel = self.manager.get_panel(self.panel_id) |
430 | 430 | for action in panel.toolbar.actions(): |
431 | | - if isinstance(action, QAction): |
| 431 | + if isinstance(action, QW.QAction): |
432 | 432 | action.setEnabled(item is not None) |
433 | 433 |
|
434 | 434 |
|
@@ -557,7 +557,7 @@ def __init__(self, manager: PlotManager, toolbar_id=DefaultToolbarID) -> None: |
557 | 557 | ) |
558 | 558 | self.masked_image = None # associated masked image item |
559 | 559 |
|
560 | | - def create_action_menu(self, manager: PlotManager) -> QW.QMenu: |
| 560 | + def create_action_menu(self, manager: PlotManager) -> QMenu: |
561 | 561 | """Create and return the tool's action menu for a given manager. |
562 | 562 |
|
563 | 563 | Args: |
@@ -912,16 +912,16 @@ class RotationCenterTool(InteractiveTool): |
912 | 912 | Args: |
913 | 913 | manager: PlotManager instance |
914 | 914 | toolbar_id: toolbar id to use. Defaults to DefaultToolbarID.. Defaults to |
915 | | - DefaultToolbarID. |
| 915 | + DefaultToolbarID. |
916 | 916 | title: tool title. Defaults to None. |
917 | 917 | icon: tool icon filename. Defaults to None. |
918 | 918 | tip: user tip to be displayed. Defaults to None. |
919 | 919 | switch_to_default_tool: Flag to switch to default tool. Defaults to True. |
920 | 920 | 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. |
922 | 922 | rotation_center: True if image already has a rotation center, False otherwise. |
923 | 923 | 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. |
925 | 925 |
|
926 | 926 | """ |
927 | 927 |
|
@@ -1006,7 +1006,7 @@ def action_triggered(self, checked: bool) -> None: |
1006 | 1006 | if self.rotation_center and self.filter is not None: |
1007 | 1007 | self.mouse_press(self.filter, QC.QEvent(QC.QEvent.Type.MouseButtonPress)) |
1008 | 1008 |
|
1009 | | - def mouse_press(self, filter: StatefulEventFilter, event: QC.QEvent) -> None: |
| 1009 | + def mouse_press(self, filter: StatefulEventFilter, event: QEvent) -> None: |
1010 | 1010 | """We create a new shape if it's the first point |
1011 | 1011 | otherwise we add a new point. |
1012 | 1012 |
|
|
0 commit comments