-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from wojtryb/development
Deploy 1.5.0
- Loading branch information
Showing
164 changed files
with
2,792 additions
and
1,313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
# SPDX-FileCopyrightText: © 2022-2023 Wojciech Trybus <[email protected]> | ||
# SPDX-FileCopyrightText: © 2022-2024 Wojciech Trybus <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
__version__ = "1.4.2" | ||
"""Importable information about the plugin.""" | ||
|
||
from api_krita.wrappers import Version | ||
|
||
__version__ = Version(1, 5, 0) | ||
"""Version of the Shortcut Composer plugin.""" | ||
|
||
__required_krita_version__ = Version(5, 2, 2) | ||
"""Version of krita required by the plugin to work.""" | ||
|
||
__author__ = "Wojciech Trybus" | ||
"""Maintainer of the plugin.""" | ||
|
||
__license__ = "GPL-3.0-or-later" | ||
"""Plugin license.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# SPDX-FileCopyrightText: © 2022-2023 Wojciech Trybus <[email protected]> | ||
# SPDX-FileCopyrightText: © 2022-2024 Wojciech Trybus <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
""" | ||
|
@@ -14,8 +14,29 @@ | |
|
||
sys.path.append(directory := os.path.dirname(__file__)) | ||
|
||
from .shortcut_composer import ShortcutComposer # noqa | ||
from .api_krita import Krita # noqa | ||
Krita.add_extension(ShortcutComposer) | ||
|
||
sys.path.remove(directory) | ||
def main() -> None: | ||
from PyQt5.QtWidgets import QMessageBox | ||
from .INFO import __version__, __required_krita_version__ | ||
from .api_krita import Krita # noqa | ||
|
||
if Krita.version < __required_krita_version__: | ||
warning_box = QMessageBox() | ||
warning_box.setIcon(QMessageBox.Warning) | ||
warning_box.setWindowTitle("Shortcut composer version mismatch") | ||
warning_box.setText( | ||
"Shortcut Composer will not load.\n\n" | ||
f"The plugin in version {__version__} requires higher " | ||
"Krita version:\n\n" | ||
f"Krita version: {Krita.version}\n" | ||
f"Required Krita version: {__required_krita_version__}\n\n" | ||
"Upgrade your Krita, or downgrade the plugin.") | ||
warning_box.setStandardButtons(QMessageBox.Ok) | ||
warning_box.exec_() | ||
return | ||
|
||
from .shortcut_composer import ShortcutComposer # noqa | ||
Krita.add_extension(ShortcutComposer) | ||
|
||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
# SPDX-FileCopyrightText: © 2022-2023 Wojciech Trybus <[email protected]> | ||
# SPDX-FileCopyrightText: © 2022-2024 Wojciech Trybus <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
""" | ||
Implementation of complex actions. | ||
Make sure that every complex action implemented here has a definition in | ||
`shortcut_composer.action` file. Otherwise the action will not be | ||
visible in `keyboard shortcuts` menu in krita settings. | ||
NOTE: Make sure that every complex action implemented here has a | ||
definition in `shortcut_composer.action` file. Otherwise the action | ||
will not be visible in `keyboard shortcuts` menu in krita settings. | ||
""" | ||
|
||
import templates | ||
from typing import List | ||
|
||
from PyQt5.QtGui import QColor | ||
|
||
from api_krita.enums import Action, Tool, Toggle, BlendingMode, TransformMode | ||
from core_components import instructions, controllers | ||
from data_components import ( | ||
RotationDeadzoneStrategy, | ||
PieDeadzoneStrategy, | ||
CurrentLayerStack, | ||
DeadzoneStrategy, | ||
PickStrategy, | ||
Slider, | ||
Range, | ||
Tag, | ||
) | ||
infinity = float("inf") | ||
Tag) | ||
|
||
INFINITY = float("inf") | ||
|
||
def create_actions() -> List[templates.RawInstructions]: return [ | ||
|
||
def create_actions() -> list[templates.RawInstructions]: return [ | ||
# Switch between FREEHAND BRUSH and the MOVE tool | ||
templates.TemporaryKey( | ||
name="Temporary move tool", | ||
|
@@ -107,7 +107,7 @@ def create_actions() -> List[templates.RawInstructions]: return [ | |
instructions=[instructions.UndoOnPress()], | ||
horizontal_slider=Slider( | ||
controller=controllers.UndoController(), | ||
values=Range(-infinity, infinity), | ||
values=Range(-INFINITY, INFINITY), | ||
deadzone=100, | ||
), | ||
), | ||
|
@@ -132,7 +132,7 @@ def create_actions() -> List[templates.RawInstructions]: return [ | |
instructions=[instructions.TemporaryOn(Toggle.ISOLATE_LAYER)], | ||
horizontal_slider=Slider( | ||
controller=controllers.TimeController(), | ||
values=Range(0, infinity), | ||
values=Range(0, INFINITY), | ||
), | ||
vertical_slider=Slider( | ||
controller=controllers.ActiveLayerController(), | ||
|
@@ -170,12 +170,12 @@ def create_actions() -> List[templates.RawInstructions]: return [ | |
name="Scroll canvas zoom or rotation", | ||
horizontal_slider=Slider( | ||
controller=controllers.CanvasRotationController(), | ||
values=Range(-infinity, infinity), | ||
values=Range(-INFINITY, INFINITY), | ||
sensitivity_scale=10, | ||
), | ||
vertical_slider=Slider( | ||
controller=controllers.CanvasZoomController(), | ||
values=Range(0, infinity), | ||
values=Range(0, INFINITY), | ||
sensitivity_scale=10, | ||
), | ||
), | ||
|
@@ -246,7 +246,7 @@ def create_actions() -> List[templates.RawInstructions]: return [ | |
name="Pick painting blending modes", | ||
controller=controllers.BlendingModeController(), | ||
instructions=[instructions.SetBrushOnNonPaintable()], | ||
deadzone_strategy=DeadzoneStrategy.PICK_TOP, | ||
deadzone_strategy=PieDeadzoneStrategy.PICK_TOP, | ||
values=[ | ||
BlendingMode.NORMAL, | ||
BlendingMode.OVERLAY, | ||
|
@@ -280,7 +280,7 @@ def create_actions() -> List[templates.RawInstructions]: return [ | |
templates.PieMenu( | ||
name="Pick transform tool modes", | ||
controller=controllers.TransformModeController(), | ||
deadzone_strategy=DeadzoneStrategy.PICK_TOP, | ||
deadzone_strategy=PieDeadzoneStrategy.PICK_TOP, | ||
values=[ | ||
TransformMode.FREE, | ||
TransformMode.PERSPECTIVE, | ||
|
@@ -297,7 +297,7 @@ def create_actions() -> List[templates.RawInstructions]: return [ | |
name="Pick brush presets (red)", | ||
controller=controllers.PresetController(), | ||
instructions=[instructions.SetBrushOnNonPaintable()], | ||
deadzone_strategy=DeadzoneStrategy.PICK_PREVIOUS, | ||
deadzone_strategy=PieDeadzoneStrategy.PICK_PREVIOUS, | ||
values=Tag("★ My Favorites"), | ||
background_color=QColor(95, 65, 65, 190), | ||
active_color=QColor(200, 70, 70), | ||
|
@@ -309,7 +309,7 @@ def create_actions() -> List[templates.RawInstructions]: return [ | |
name="Pick brush presets (green)", | ||
controller=controllers.PresetController(), | ||
instructions=[instructions.SetBrushOnNonPaintable()], | ||
deadzone_strategy=DeadzoneStrategy.PICK_PREVIOUS, | ||
deadzone_strategy=PieDeadzoneStrategy.PICK_PREVIOUS, | ||
values=Tag("RGBA"), | ||
background_color=QColor(65, 95, 65, 190), | ||
active_color=QColor(70, 200, 70), | ||
|
@@ -321,7 +321,7 @@ def create_actions() -> List[templates.RawInstructions]: return [ | |
name="Pick brush presets (blue)", | ||
controller=controllers.PresetController(), | ||
instructions=[instructions.SetBrushOnNonPaintable()], | ||
deadzone_strategy=DeadzoneStrategy.PICK_PREVIOUS, | ||
deadzone_strategy=PieDeadzoneStrategy.PICK_PREVIOUS, | ||
values=Tag("Erasers"), | ||
background_color=QColor(70, 70, 105, 190), | ||
active_color=QColor(110, 160, 235), | ||
|
@@ -334,12 +334,34 @@ def create_actions() -> List[templates.RawInstructions]: return [ | |
name="Pick local brush presets", | ||
controller=controllers.PresetController(), | ||
instructions=[instructions.SetBrushOnNonPaintable()], | ||
deadzone_strategy=DeadzoneStrategy.PICK_PREVIOUS, | ||
deadzone_strategy=PieDeadzoneStrategy.PICK_PREVIOUS, | ||
values=[], | ||
save_local=True, | ||
active_color=QColor(234, 172, 0), | ||
), | ||
|
||
# Use rotation widget to rotate the canvas. | ||
templates.RotationSelector( | ||
name="Rotate canvas", | ||
controller=controllers.CanvasRotationController(), | ||
is_counterclockwise=False, | ||
offset=0, | ||
inverse_zones=False, | ||
divisions=24, | ||
deadzone_strategy=RotationDeadzoneStrategy.KEEP_CHANGE, | ||
), | ||
|
||
# Use rotation widget to rotate current brush preset. | ||
templates.RotationSelector( | ||
name="Rotate brush", | ||
controller=controllers.BrushRotationController(), | ||
is_counterclockwise=True, | ||
offset=90, | ||
inverse_zones=False, | ||
divisions=24, | ||
deadzone_strategy=RotationDeadzoneStrategy.KEEP_CHANGE, | ||
), | ||
|
||
# ....................................... | ||
# Insert your actions implementation here | ||
# ....................................... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# SPDX-FileCopyrightText: © 2022-2023 Wojciech Trybus <[email protected]> | ||
# SPDX-FileCopyrightText: © 2022-2024 Wojciech Trybus <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# SPDX-FileCopyrightText: © 2022-2023 Wojciech Trybus <[email protected]> | ||
# SPDX-FileCopyrightText: © 2022-2024 Wojciech Trybus <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
"""Contains utility actions to register in krita.""" | ||
|
||
from .transform_actions import TransformModeActions, TransformModeFinder | ||
|
||
__all__ = ["TransformModeActions", "TransformModeFinder"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
# SPDX-FileCopyrightText: © 2022-2023 Wojciech Trybus <[email protected]> | ||
# SPDX-FileCopyrightText: © 2022-2024 Wojciech Trybus <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
from typing import Dict, Optional | ||
from functools import partial, partialmethod | ||
|
||
from PyQt5.QtCore import QTimer | ||
from PyQt5.QtWidgets import ( | ||
QWidgetAction, | ||
QToolButton, | ||
QPushButton, | ||
QWidget, | ||
) | ||
QWidget) | ||
|
||
from ..enums import Tool, TransformMode | ||
from ..core_api import KritaInstance | ||
|
@@ -27,7 +25,7 @@ class TransformModeActions: | |
|
||
def __init__(self, window) -> None: | ||
self._finder = TransformModeFinder() | ||
self._actions: Dict[TransformMode, QWidgetAction] = {} | ||
self._actions: dict[TransformMode, QWidgetAction] = {} | ||
self._create_actions(window) | ||
|
||
def _create_actions(self, window) -> None: | ||
|
@@ -84,7 +82,7 @@ class TransformModeFinder: | |
""" | ||
|
||
def __init__(self) -> None: | ||
self._mode_buttons: Dict[TransformMode, QToolButton] = {} | ||
self._mode_buttons: dict[TransformMode, QToolButton] = {} | ||
self._transform_options: QWidget | ||
self._apply_button: QPushButton | ||
|
||
|
@@ -111,7 +109,7 @@ def activate_mode(self, mode: TransformMode, apply: bool) -> None: | |
self._apply_button.click() | ||
self._mode_buttons[mode].click() | ||
|
||
def get_active_mode(self) -> Optional[TransformMode]: | ||
def get_active_mode(self) -> TransformMode | None: | ||
for mode, button in self._mode_buttons.items(): | ||
if button.isChecked(): | ||
return mode | ||
|
Oops, something went wrong.