diff --git a/gmc/file_widgets/multiple_sources_one_destination.py b/gmc/file_widgets/multiple_sources_one_destination.py index 3a1513c..3537567 100644 --- a/gmc/file_widgets/multiple_sources_one_destination.py +++ b/gmc/file_widgets/multiple_sources_one_destination.py @@ -1,3 +1,4 @@ +from __future__ import annotations from typing import Callable from PyQt5 import QtCore, QtWidgets from ..utils import separator, get_icon @@ -7,6 +8,7 @@ FilesystemTitle, ) from itertools import zip_longest +from ..application import GMCArguments Qt = QtCore.Qt tr: Callable[[str], str] = lambda text: QtCore.QCoreApplication.translate( @@ -19,7 +21,7 @@ class MultipleSourcesOneDestination: SOURCE_TITLES = ["First Image", "Second Image"] @classmethod - def create_data_widget(cls, mdi_area, settings, extra_args): + def create_data_widget(cls, mdi_area, settings, extra_args: GMCArguments): def _on_open_src(view_idx, new_tab): view = cls._source_widget.views()[view_idx] dst_dir = cls._destination_widget.get_root_qdir() diff --git a/gmc/file_widgets/one_source_one_destination.py b/gmc/file_widgets/one_source_one_destination.py index f286d07..02b8b1a 100644 --- a/gmc/file_widgets/one_source_one_destination.py +++ b/gmc/file_widgets/one_source_one_destination.py @@ -1,8 +1,10 @@ -from typing import Any, Callable, Sequence +from __future__ import annotations +from typing import Callable, Sequence from PyQt5 import QtCore, QtWidgets, QtGui from ..utils import separator, new_action from ..views.filesystem_widget import SingleFilesystemWidget, FilesystemTitle from ..settings import settings +from ..application import GMCArguments Qt = QtCore.Qt MB = QtWidgets.QMessageBox @@ -14,7 +16,7 @@ class OneSourceOneDestination: @classmethod def create_data_widget( - cls, mdi_area: QtWidgets.QMdiArea, extra_args: dict[str, Any] + cls, mdi_area: QtWidgets.QMdiArea, extra_args: GMCArguments ) -> QtWidgets.QSplitter: """ :param cls: like `gmc.schemas.tagged_objects.TaggedObjects` @@ -197,32 +199,32 @@ def __init__( def _get_default_actions(self): """:returns: actions, every markup window should have""" - def mod(*keys: int) -> tuple[int, ...]: + def mod(*keys: Qt.Key) -> tuple[Qt.Key, ...]: return ( keys - + tuple(key + Qt.SHIFT for key in keys) - + tuple(key + Qt.ALT for key in keys) + + tuple(key + Qt.Modifier.SHIFT for key in keys) + + tuple(key + Qt.Modifier.ALT for key in keys) ) self._prev_action = new_action( self, "prev", tr("Previous File"), - mod(Qt.Key_P, Qt.Key_PageUp, Qt.Key_Backspace), + mod(Qt.Key.Key_P, Qt.Key.Key_PageUp, Qt.Key.Key_Backspace), triggered=lambda: self._go(-1), ) self._next_action = new_action( self, "next", tr("Next File"), - mod(Qt.Key_N, Qt.Key_PageDown, Qt.Key_Space), + mod(Qt.Key.Key_N, Qt.Key.Key_PageDown, Qt.Key.Key_Space), triggered=lambda: self._go(1), ) _save_action = new_action( self, "save", tr("Save"), - (Qt.CTRL + Qt.Key_S,), + (Qt.Modifier.CTRL + Qt.Key.Key_S,), triggered=lambda: self._schema.save_markup(), ) diff --git a/gmc/schemas/tagged_objects/__init__.py b/gmc/schemas/tagged_objects/__init__.py index 083927c..77307b7 100644 --- a/gmc/schemas/tagged_objects/__init__.py +++ b/gmc/schemas/tagged_objects/__init__.py @@ -19,6 +19,7 @@ from ...utils.read_properties import read_properties from ...utils import get_icon, separator, new_action, tr, clipboard from ...file_widgets.one_source_one_destination import OneSourceOneDestination +from ...application import GMCArguments Qt = QtCore.Qt MB = QtWidgets.QMessageBox @@ -360,7 +361,7 @@ def __init__(self, markup_window, default_actions): @classmethod def create_data_widget( - cls, mdi_area: QtWidgets.QMdiArea, extra_args: dict[str, Any] + cls, mdi_area: QtWidgets.QMdiArea, extra_args: GMCArguments ): splitter = super().create_data_widget(mdi_area, extra_args) iterpolate_act = new_action( diff --git a/gmc/utils/__init__.py b/gmc/utils/__init__.py index d93f292..6e4f5f0 100644 --- a/gmc/utils/__init__.py +++ b/gmc/utils/__init__.py @@ -29,7 +29,7 @@ def new_action( parent: QObject, icon: str | QIcon, text: str, - shortcuts: tuple[str | QKeySequence.StandardKey | Qt.Key, ...] = (), + shortcuts: tuple[str | QKeySequence.StandardKey | Qt.Key | int, ...] = (), **kwargs: Any, ) -> QAction: sequences = [QKeySequence(s) for s in shortcuts]