From 098e1ae013a2395ecdba14e83d50882e2e819493 Mon Sep 17 00:00:00 2001 From: Wojciech Trybus Date: Sat, 6 Apr 2024 16:30:27 +0200 Subject: [PATCH 1/3] Fix the RotationSelector settings dialog showing offscreen on Windows --- shortcut_composer/INFO.py | 2 +- .../templates/rotation_menu_utils/rotation_settings.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/shortcut_composer/INFO.py b/shortcut_composer/INFO.py index 95e6c4a9..bd1ee3ac 100644 --- a/shortcut_composer/INFO.py +++ b/shortcut_composer/INFO.py @@ -5,7 +5,7 @@ from api_krita.wrappers import Version -__version__ = Version(1, 5, 2) +__version__ = Version(1, 5, 3, "dev") """Version of the Shortcut Composer plugin.""" __required_krita_version__ = Version(5, 2, 2) diff --git a/shortcut_composer/templates/rotation_menu_utils/rotation_settings.py b/shortcut_composer/templates/rotation_menu_utils/rotation_settings.py index 3ab1f946..6274d4f7 100644 --- a/shortcut_composer/templates/rotation_menu_utils/rotation_settings.py +++ b/shortcut_composer/templates/rotation_menu_utils/rotation_settings.py @@ -1,11 +1,10 @@ # SPDX-FileCopyrightText: © 2022-2024 Wojciech Trybus # SPDX-License-Identifier: GPL-3.0-or-later +from PyQt5.QtWidgets import QDialog from PyQt5.QtCore import Qt, QSize -from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import QVBoxLayout -from api_krita.pyqt import BaseWidget from composer_utils import ButtonsLayout from config_system.ui import ( ConfigFormWidget, @@ -17,7 +16,7 @@ from .rotation_config import RotationConfig -class RotationSettings(BaseWidget): +class RotationSettings(QDialog): """Widget that allows to change values in passed config.""" def __init__(self, config: RotationConfig) -> None: @@ -127,7 +126,6 @@ def __init__(self, config: RotationConfig) -> None: def show(self) -> None: """Show the dialog after refreshing all its elements.""" self.refresh() - self.move_center(QCursor.pos()) return super().show() def apply(self) -> None: From 91ad1deb7e1eb00de1190222fcdfb0e585c52241 Mon Sep 17 00:00:00 2001 From: Wojciech Trybus Date: Sat, 6 Apr 2024 16:30:27 +0200 Subject: [PATCH 2/3] Fix the setting buttons without a parent not being at corner of qmdArea --- shortcut_composer/api_krita/pyqt/round_button.py | 2 +- shortcut_composer/composer_utils/label/label_widget.py | 2 +- .../label/label_widget_impl/text_label_widget.py | 2 +- shortcut_composer/templates/pie_menu_utils/pie_widget.py | 4 ++-- .../templates/rotation_menu_utils/rotation_widget.py | 2 +- shortcut_composer/templates/rotation_selector.py | 3 +++ 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/shortcut_composer/api_krita/pyqt/round_button.py b/shortcut_composer/api_krita/pyqt/round_button.py index a01845a1..21c1ae68 100644 --- a/shortcut_composer/api_krita/pyqt/round_button.py +++ b/shortcut_composer/api_krita/pyqt/round_button.py @@ -44,7 +44,7 @@ def __init__( def show(self) -> None: """Change the size and repaint the button.""" radius = self._radius_callback() - self.setGeometry(0, 0, radius*2, radius*2) + self.resize(radius*2, radius*2) active_color = self._active_color_callback() background_color = self._background_color_callback() diff --git a/shortcut_composer/composer_utils/label/label_widget.py b/shortcut_composer/composer_utils/label/label_widget.py index 9ac9a59a..6accc49b 100644 --- a/shortcut_composer/composer_utils/label/label_widget.py +++ b/shortcut_composer/composer_utils/label/label_widget.py @@ -39,7 +39,7 @@ def __init__( self.label = label self._label_widget_style = label_widget_style - self.setGeometry(0, 0, self.icon_radius*2, self.icon_radius*2) + self.resize(self.icon_radius*2, self.icon_radius*2) self.setCursor(Qt.ArrowCursor) self._draggable = True diff --git a/shortcut_composer/composer_utils/label/label_widget_impl/text_label_widget.py b/shortcut_composer/composer_utils/label/label_widget_impl/text_label_widget.py index 35fa7e91..88b75b91 100644 --- a/shortcut_composer/composer_utils/label/label_widget_impl/text_label_widget.py +++ b/shortcut_composer/composer_utils/label/label_widget_impl/text_label_widget.py @@ -40,7 +40,7 @@ def _create_pyqt_label(self) -> QLabel: label = QLabel(self) label.setText(to_display.value) label.setAlignment(Qt.AlignCenter) - label.setGeometry(0, 0, round(height*2), round(height)) + label.resize(round(height*2), round(height)) label.setFont(self._font) label.move(self.center.x()-height, self.center.y()-height//2) diff --git a/shortcut_composer/templates/pie_menu_utils/pie_widget.py b/shortcut_composer/templates/pie_menu_utils/pie_widget.py index 8be6a91b..dd7d781d 100644 --- a/shortcut_composer/templates/pie_menu_utils/pie_widget.py +++ b/shortcut_composer/templates/pie_menu_utils/pie_widget.py @@ -45,7 +45,7 @@ def __init__( ) -> None: AnimatedWidget.__init__(self, parent, Config.PIE_ANIMATION_TIME.read()) diameter = 2*style_holder.pie_style.widget_radius - self.setGeometry(0, 0, diameter, diameter) + self.resize(diameter, diameter) self.setAcceptDrops(True) self.setWindowFlags(( @@ -171,4 +171,4 @@ def _type(self) -> type | None: def _reset(self) -> None: """Set widget geometry according to style.""" diameter = 2*self._style_holder.pie_style.widget_radius - self.setGeometry(0, 0, diameter, diameter) + self.resize(diameter, diameter) diff --git a/shortcut_composer/templates/rotation_menu_utils/rotation_widget.py b/shortcut_composer/templates/rotation_menu_utils/rotation_widget.py index 270d797e..8ec4fb29 100644 --- a/shortcut_composer/templates/rotation_menu_utils/rotation_widget.py +++ b/shortcut_composer/templates/rotation_menu_utils/rotation_widget.py @@ -55,7 +55,7 @@ def paintEvent(self, event: QPaintEvent) -> None: def _resize(self) -> None: """Change the widget window to value required by its configuration.""" - self.setGeometry(0, 0, self._diameter, self._diameter) + self.resize(self._diameter, self._diameter) @property def _diameter(self) -> int: diff --git a/shortcut_composer/templates/rotation_selector.py b/shortcut_composer/templates/rotation_selector.py index ac588e3b..1148de7b 100644 --- a/shortcut_composer/templates/rotation_selector.py +++ b/shortcut_composer/templates/rotation_selector.py @@ -171,6 +171,9 @@ def on_key_press(self) -> None: if (self._config.IS_WIDGET_HIDDEN.read() and not self._rotation_settings.isVisible()): self._global_settings_button.show() + mdiArea = Krita.get_active_mdi_area() + self._global_settings_button.move( + mdiArea.mapToGlobal(mdiArea.pos())) def on_every_key_release(self) -> None: """Handle the key release event.""" From 1e46fd8a7fd90cee6e836e55489bf8079c5f3349 Mon Sep 17 00:00:00 2001 From: Wojciech Trybus Date: Sat, 6 Apr 2024 16:30:27 +0200 Subject: [PATCH 3/3] Bump plugin version --- README.md | 2 +- shortcut_composer/INFO.py | 2 +- shortcut_composer/manual.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 063c9599..7d7dd4d3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Shortcut composer **v1.5.2** +# Shortcut composer **v1.5.3** [![python](https://img.shields.io/badge/Python-3.10-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org) [![Code style: black](https://img.shields.io/badge/code%20style-autopep8-333333.svg)](https://pypi.org/project/autopep8/) diff --git a/shortcut_composer/INFO.py b/shortcut_composer/INFO.py index bd1ee3ac..aba19f29 100644 --- a/shortcut_composer/INFO.py +++ b/shortcut_composer/INFO.py @@ -5,7 +5,7 @@ from api_krita.wrappers import Version -__version__ = Version(1, 5, 3, "dev") +__version__ = Version(1, 5, 3) """Version of the Shortcut Composer plugin.""" __required_krita_version__ = Version(5, 2, 2) diff --git a/shortcut_composer/manual.html b/shortcut_composer/manual.html index c51ff2f3..49f26782 100644 --- a/shortcut_composer/manual.html +++ b/shortcut_composer/manual.html @@ -9,7 +9,7 @@ -

Shortcut composer v1.5.2

+

Shortcut composer v1.5.3


Extension for painting application Krita, which allows to create custom, complex keyboard shortcuts.

The plugin adds new shortcuts of the following types: