99from functools import wraps
1010from typing import TYPE_CHECKING
1111
12- import qtpy
12+ from . import QtModuleNotInstalledError
1313
1414if TYPE_CHECKING :
15- from qtpy .QtWidgets import QAction
15+ from .QtWidgets import QAction
1616
1717
1818def _wrap_missing_optional_dep_error (
1919 attr_error ,
2020 * ,
2121 import_error ,
22- wrapper = qtpy . QtModuleNotInstalledError ,
22+ wrapper = QtModuleNotInstalledError ,
2323 ** wrapper_kwargs ,
2424):
2525 """Create a __cause__-chained wrapper error for a missing optional dep."""
@@ -72,8 +72,8 @@ def possibly_static_exec_(cls, *args, **kwargs):
7272
7373def set_shortcut (self , shortcut , old_set_shortcut ):
7474 """Ensure that the type of `shortcut` is compatible to `QAction.setShortcut`."""
75- from qtpy .QtCore import Qt
76- from qtpy .QtGui import QKeySequence
75+ from .QtCore import Qt
76+ from .QtGui import QKeySequence
7777
7878 if isinstance (shortcut , (QKeySequence .StandardKey , Qt .Key , int )):
7979 shortcut = QKeySequence (shortcut )
@@ -82,8 +82,8 @@ def set_shortcut(self, shortcut, old_set_shortcut):
8282
8383def set_shortcuts (self , shortcuts , old_set_shortcuts ):
8484 """Ensure that the type of `shortcuts` is compatible to `QAction.setShortcuts`."""
85- from qtpy .QtCore import Qt
86- from qtpy .QtGui import QKeySequence
85+ from .QtCore import Qt
86+ from .QtGui import QKeySequence
8787
8888 if isinstance (
8989 shortcuts ,
@@ -104,8 +104,8 @@ def set_shortcuts(self, shortcuts, old_set_shortcuts):
104104
105105def add_action (self , * args , old_add_action ):
106106 """Re-order arguments of `addAction` to backport compatibility with Qt>=6.3."""
107- from qtpy .QtCore import QObject , Qt
108- from qtpy .QtGui import QIcon , QKeySequence
107+ from .QtCore import QObject , Qt
108+ from .QtGui import QIcon , QKeySequence
109109
110110 action : QAction
111111 icon : QIcon
0 commit comments