Skip to content

Commit

Permalink
Merge pull request #73 from wojtryb/development
Browse files Browse the repository at this point in the history
Deploy 1.4.2
  • Loading branch information
wojtryb authored Nov 12, 2023
2 parents 48d965a + a526c9c commit 7bee5b7
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 119 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Shortcut composer **v1.4.1**
# Shortcut composer **v1.4.2**

[![python](https://img.shields.io/badge/Python-3.8-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/)
Expand Down
2 changes: 1 addition & 1 deletion shortcut_composer/INFO.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-FileCopyrightText: © 2022-2023 Wojciech Trybus <[email protected]>
# SPDX-License-Identifier: GPL-3.0-or-later

__version__ = "1.4.1"
__version__ = "1.4.2"
__author__ = "Wojciech Trybus"
__license__ = "GPL-3.0-or-later"
211 changes: 126 additions & 85 deletions shortcut_composer/api_krita/enums/blending_mode.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# SPDX-FileCopyrightText: © 2022-2023 Wojciech Trybus <[email protected]>
# SPDX-License-Identifier: GPL-3.0-or-later

from typing import Optional
from .helpers import EnumGroup, Group


Expand All @@ -13,85 +12,79 @@ class BlendingMode(EnumGroup):
"""

_arithmetic = Group("Arithmetic")
ADD = "add", "Addition"
ADD = "add"
DIVIDE = "divide"
INVERSE_SUBTRACT = "inverse_subtract"
MULTIPLY = "multiply"
SUBTRACT = "subtract"

_binary = Group("Binary")
AND = "and", "AND"
CONVERSE = "converse", "CONVERSE"
IMPLICATION = "implication", "IMPLICATION"
NAND = "nand", "NAND"
NOR = "nor", "NOR"
NOT_CONVERSE = "not_converse", "NOT_CONVERSE"
NOT_IMPLICATION = "not_implication", "NOT_IMPLICATION"
OR = "or", "OR"
XNOR = "xnor", "XNOR"
XOR = "xor", "XOR"
AND = "and"
CONVERSE = "converse"
IMPLICATION = "implication"
NAND = "nand"
NOR = "nor"
NOT_CONVERSE = "not_converse"
NOT_IMPLICATION = "not_implication"
OR = "or"
XNOR = "xnor"
XOR = "xor"

_darken = Group("Darken")
BURN = "burn"
DARKEN = "darken"
DARKER_COLOR = "darker color"
EASY_BURN = "easy burn"
FOG_DARKEN_IFS_ILLUSIONS = (
"fog_darken_ifs_illusions",
"Fog Darken (IFS Illusions)")
FOG_DARKEN_IFS_ILLUSIONS = "fog_darken_ifs_illusions"
GAMMA_DARK = "gamma_dark"
LINEAR_BURN = "linear_burn"
SHADE_IFS_ILLUSIONS = (
"shade_ifs_illusions"
"Shade (IFS Illusions)")
SHADE_IFS_ILLUSIONS = "shade_ifs_illusions"

_hsi = Group("HSI")
COLOR_HSI = "color_hsi", "Color HSI"
DEC_INTENSITY = "dec_intensity", "Decrease Intensity"
DEC_SATURATION_HSI = "dec_saturation_hsi", "Decrease Saturation HSI"
HUE_HSI = "hue_hsi", "Hue HSI"
INC_INTENSITY = "inc_intensity", "Increase Intensity"
INC_SATURATION_HSI = "inc_saturation_hsi", "Increase Saturation HSI"
COLOR_HSI = "color_hsi"
DEC_INTENSITY = "dec_intensity"
DEC_SATURATION_HSI = "dec_saturation_hsi"
HUE_HSI = "hue_hsi"
INC_INTENSITY = "inc_intensity"
INC_SATURATION_HSI = "inc_saturation_hsi"
INTENSITY = "intensity"
SATURATION_HSI = "saturation_hsi", "Saturation HSI"
SATURATION_HSI = "saturation_hsi"

_hsl = Group("HSL")
COLOR_HSL = "color_hsl", "Color HSL"
DEC_LIGHTNESS = "dec_lightness", "Decrease Lightness"
DEC_SATURATION_HSL = "dec_saturation_hsl", "Decrease Saturation HSL"
HUE_HSL = "hue_hsl", "Hue HSL"
INC_LIGHTNESS = "inc_lightness", "Increase Lightness"
INC_SATURATION_HSL = "inc_saturation_hsl", "Increase Saturation HSL"
COLOR_HSL = "color_hsl"
DEC_LIGHTNESS = "dec_lightness"
DEC_SATURATION_HSL = "dec_saturation_hsl"
HUE_HSL = "hue_hsl"
INC_LIGHTNESS = "inc_lightness"
INC_SATURATION_HSL = "inc_saturation_hsl"
LIGHTNESS = "lightness"
SATURATION_HSL = "saturation_hsl", "Saturation HSL"
SATURATION_HSL = "saturation_hsl"

_hsv = Group("HSV")
COLOR_HSV = "color_hsv", "Color HSV"
DEC_SATURATION_HSV = "dec_saturation_hsv", "Decrease Saturation HSV"
DEC_VALUE = "dec_value", "Decrease Value"
HUE_HSV = "hue_hsv", "Hue HSV"
INC_SATURATION_HSV = "inc_saturation_hsv", "Increase Saturation HSV"
INC_VALUE = "inc_value", "Increase Value"
SATURATION_HSV = "saturation_hsv", "Saturation HSV"
COLOR_HSV = "color_hsv"
DEC_SATURATION_HSV = "dec_saturation_hsv"
DEC_VALUE = "dec_value"
HUE_HSV = "hue_hsv"
INC_SATURATION_HSV = "inc_saturation_hsv"
INC_VALUE = "inc_value"
SATURATION_HSV = "saturation_hsv"
VALUE = "value"

_hsy = Group("HSY")
COLOR = "color"
DEC_LUMINOSITY = "dec_luminosity", "Decrease Luminosity"
DEC_SATURATION = "dec_saturation", "Decrease Saturation"
DEC_LUMINOSITY = "dec_luminosity"
DEC_SATURATION = "dec_saturation"
HUE = "hue"
INC_LUMINOSITY = "inc_luminosity", "Increase Luminosity"
INC_SATURATION = "inc_saturation", "Increase Saturation"
INC_LUMINOSITY = "inc_luminosity"
INC_SATURATION = "inc_saturation"
LUMINIZE = "luminize"
SATURATION = "saturation"

_lighten = Group("Lighten")
DODGE = "dodge"
EASY_DODGE = "easy dodge"
FLAT_LIGHT = "flat_light"
FOG_LIGHTEN_IFS_ILLUSIONS = (
"fog_lighten_ifs_illusions",
"Fog Lighten (IFS Illusions)")
FOG_LIGHTEN_IFS_ILLUSIONS = "fog_lighten_ifs_illusions"
GAMMA_ILLUMINATION = "gamma_illumination"
GAMMA_LIGHT = "gamma_light"
HARD_LIGHT = "hard_light"
Expand All @@ -100,25 +93,21 @@ class BlendingMode(EnumGroup):
LINEAR_DODGE = "linear_dodge"
LINEAR_LIGHT = "linear light"
LUMINOSITY_SAI = "luminosity_sai"
PNORM_A = "pnorm_a", "P-Norm A"
PNORM_B = "pnorm_b", "P-Norm B"
PNORM_A = "pnorm_a"
PNORM_B = "pnorm_b"
PIN_LIGHT = "pin_light"
SCREEN = "screen"
SOFT_LIGHT_IFS_ILLUSIONS = (
"soft_light_ifs_illusions",
"Soft Light (IFS Illusions)")
SOFT_LIGHT_PEGTOP_DELPHI = (
"soft_light_pegtop_delphi"
"Soft Light (Pegtio-Delphi)")
SOFT_LIGHT = "soft_light", "Soft Light (Photoshop)"
SOFT_LIGHT_SVG = "soft_light_svg", "Soft Light (SVG)"
SOFT_LIGHT_IFS_ILLUSIONS = "soft_light_ifs_illusions"
SOFT_LIGHT_PEGTOP_DELPHI = "soft_light_pegtop_delphi"
SOFT_LIGHT = "soft_light"
SOFT_LIGHT_SVG = "soft_light_svg"
SUPER_LIGHT = "super_light"
TINT_IFS_ILLUSIONS = "tint_ifs_illusions", "Tint (IFS Illusions)"
TINT_IFS_ILLUSIONS = "tint_ifs_illusions"
VIVID_LIGHT = "vivid_light"

_misc = Group("Misc")
BUMPMAP = "bumpmap"
COMBINE_NORMAL = "combine_normal", "Combine Normal Map"
COMBINE_NORMAL = "combine_normal"
COPY = "copy"
COPY_BLUE = "copy_blue"
COPY_GREEN = "copy_green"
Expand All @@ -138,13 +127,11 @@ class BlendingMode(EnumGroup):
GRAIN_MERGE = "grain_merge"
GREATER = "greater"
HARD_MIX = "hard mix"
HARD_MIX_PHOTOSHOP = "hard_mix_photoshop", "Hard Mix (Photoshop)"
HARD_MIX_SOFTER_PHOTOSHOP = (
"hard_mix_softer_photoshop",
"Hard Mix Softer (Photoshop)")
HARD_MIX_PHOTOSHOP = "hard_mix_photoshop"
HARD_MIX_SOFTER_PHOTOSHOP = "hard_mix_softer_photoshop"
HARD_OVERLAY = "hard overlay"
INTERPOLATION = "interpolation"
INTERPOLATION_2X = "interpolation 2x", "Interpolation - 2X"
INTERPOLATION_2X = "interpolation 2x"
NORMAL = "normal"
OVERLAY = "overlay"
PARALLEL = "parallel"
Expand All @@ -155,14 +142,10 @@ class BlendingMode(EnumGroup):

_modulo = Group("Modulo")
DIVISIVE_MODULO = "divisive_modulo"
DIVISIVE_MODULO_CONTINUOUS = (
"divisive_modulo_continuous",
"Divisive Modulo - Continuous")
MODULO_CONTINUOUS = "modulo_continuous", "Modulo - Continuous"
DIVISIVE_MODULO_CONTINUOUS = "divisive_modulo_continuous"
MODULO_CONTINUOUS = "modulo_continuous"
MODULO_SHIFT = "modulo_shift"
MODULO_SHIFT_CONTINUOUS = (
"modulo_shift_continuous",
"Modulo Shift - Continuous")
MODULO_SHIFT_CONTINUOUS = "modulo_shift_continuous"

_negative = Group("Negative")
ADDITIVE_SUBTRACTIVE = "additive_subtractive"
Expand All @@ -174,24 +157,82 @@ class BlendingMode(EnumGroup):

_quadratic = Group("Quadratic")
FREEZE = "freeze"
FREEZE_REFLECT = "freeze_reflect", "Freeze-Reflect"
FREEZE_REFLECT = "freeze_reflect"
GLOW = "glow"
GLOW_HEAT = "glow_heat", "Glow-Heat"
GLOW_HEAT = "glow_heat"
HEAT = "heat"
HEAT_GLOW = "heat_glow", "Heat-Glow"
HEAT_GLOW_FREEZE_REFLECT_HYBRID = (
"heat_glow_freeze_reflect_hybrid"
"Heat-Glow & Freeze-Reflect Hybrid")
HEAT_GLOW = "heat_glow"
HEAT_GLOW_FREEZE_REFLECT_HYBRID = "heat_glow_freeze_reflect_hybrid"
REFLECT = "reflect"
REFLECT_FREEZE = "reflect_freeze", "Reflect-Freeze"

def __init__(self, value: str, pretty_name: Optional[str] = None):
self._value_ = value
self._custom_pretty_name = pretty_name
REFLECT_FREEZE = "reflect_freeze"

@property
def pretty_name(self) -> str:
"""Format blending mode name as in Krita Blending Mode combobox."""
if self._custom_pretty_name is not None:
return self._custom_pretty_name
return self.name.replace("_", " ").title()
"""Format tool name as in Krita Blending Mode combobox."""
if self in PRETTY_NAMES:
return PRETTY_NAMES[self]
return self.name.replace('_', ' ').title()


PRETTY_NAMES = {
BlendingMode.ADD: "Addition",
BlendingMode.AND: "AND",
BlendingMode.CONVERSE: "CONVERSE",
BlendingMode.IMPLICATION: "IMPLICATION",
BlendingMode.NAND: "NAND",
BlendingMode.NOR: "NOR",
BlendingMode.NOT_CONVERSE: "NOT_CONVERSE",
BlendingMode.NOT_IMPLICATION: "NOT_IMPLICATION",
BlendingMode.OR: "OR",
BlendingMode.XNOR: "XNOR",
BlendingMode.XOR: "XOR",
BlendingMode.FOG_DARKEN_IFS_ILLUSIONS: "Fog Darken (IFS Illusions)",
BlendingMode.SHADE_IFS_ILLUSIONS: "Shade (IFS Illusions)",
BlendingMode.COLOR_HSI: "Color HSI",
BlendingMode.DEC_INTENSITY: "Decrease Intensity",
BlendingMode.DEC_SATURATION_HSI: "Decrease Saturation HSI",
BlendingMode.HUE_HSI: "Hue HSI",
BlendingMode.INC_INTENSITY: "Increase Intensity",
BlendingMode.INC_SATURATION_HSI: "Increase Saturation HSI",
BlendingMode.SATURATION_HSI: "Saturation HSI",
BlendingMode.COLOR_HSL: "Color HSL",
BlendingMode.DEC_LIGHTNESS: "Decrease Lightness",
BlendingMode.DEC_SATURATION_HSL: "Decrease Saturation HSL",
BlendingMode.HUE_HSL: "Hue HSL",
BlendingMode.INC_LIGHTNESS: "Increase Lightness",
BlendingMode.INC_SATURATION_HSL: "Increase Saturation HSL",
BlendingMode.SATURATION_HSL: "Saturation HSL",
BlendingMode.COLOR_HSV: "Color HSV",
BlendingMode.DEC_SATURATION_HSV: "Decrease Saturation HSV",
BlendingMode.DEC_VALUE: "Decrease Value",
BlendingMode.HUE_HSV: "Hue HSV",
BlendingMode.INC_SATURATION_HSV: "Increase Saturation HSV",
BlendingMode.INC_VALUE: "Increase Value",
BlendingMode.SATURATION_HSV: "Saturation HSV",
BlendingMode.DEC_LUMINOSITY: "Decrease Luminosity",
BlendingMode.DEC_SATURATION: "Decrease Saturation",
BlendingMode.INC_LUMINOSITY: "Increase Luminosity",
BlendingMode.INC_SATURATION: "Increase Saturation",
BlendingMode.FOG_LIGHTEN_IFS_ILLUSIONS: "Fog Lighten (IFS Illusions)",
BlendingMode.PNORM_A: "P-Norm A",
BlendingMode.PNORM_B: "P-Norm B",
BlendingMode.SOFT_LIGHT_IFS_ILLUSIONS: "Soft Light (IFS Illusions)",
BlendingMode.SOFT_LIGHT_PEGTOP_DELPHI: "Soft Light (Pegtio-Delphi)",
BlendingMode.SOFT_LIGHT: "Soft Light (Photoshop)",
BlendingMode.SOFT_LIGHT_SVG: "Soft Light (SVG)",
BlendingMode.TINT_IFS_ILLUSIONS: "Tint (IFS Illusions)",
BlendingMode.COMBINE_NORMAL: "Combine Normal Map",
BlendingMode.HARD_MIX_PHOTOSHOP: "Hard Mix (Photoshop)",
BlendingMode.HARD_MIX_SOFTER_PHOTOSHOP: "Hard Mix Softer (Photoshop)",
BlendingMode.INTERPOLATION_2X: "Interpolation - 2X",
BlendingMode.DIVISIVE_MODULO_CONTINUOUS: "Divisive Modulo - Continuous",
BlendingMode.MODULO_CONTINUOUS: "Modulo - Continuous",
BlendingMode.MODULO_SHIFT_CONTINUOUS: "Modulo Shift - Continuous",
BlendingMode.FREEZE_REFLECT: "Freeze-Reflect",
BlendingMode.GLOW_HEAT: "Glow-Heat",
BlendingMode.HEAT_GLOW: "Heat-Glow",
BlendingMode.HEAT_GLOW_FREEZE_REFLECT_HYBRID:
"Heat-Glow & Freeze-Reflect Hybrid",
BlendingMode.REFLECT_FREEZE: "Reflect-Freeze",

}
31 changes: 18 additions & 13 deletions shortcut_composer/api_krita/enums/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@

from krita import Krita as Api

from typing import Optional
from PyQt5.QtGui import QIcon
from .helpers import EnumGroup, Group


class Tool(EnumGroup):

_vectors = Group("Vectors")
SHAPE_SELECT = "InteractionTool", "Select Shapes Tool"
SHAPE_SELECT = "InteractionTool"
TEXT = "SvgTextTool"
EDIT_SHAPES = "PathTool"
CALLIGRAPHY = "KarbonCalligraphyTool", "Calligraphy"
CALLIGRAPHY = "KarbonCalligraphyTool"

_painting = Group("Painting")
FREEHAND_BRUSH = "KritaShape/KisToolBrush"
Expand All @@ -33,16 +32,16 @@ class Tool(EnumGroup):
MOVE = "KritaTransform/KisToolMove"
CROP = "KisToolCrop"
GRADIENT = "KritaFill/KisToolGradient"
COLOR_SAMPLER = "KritaSelected/KisToolColorSampler", "Color Sampler"
COLOR_SAMPLER = "KritaSelected/KisToolColorSampler"
COLORIZE_MASK = "KritaShape/KisToolLazyBrush"
SMART_PATCH = "KritaShape/KisToolSmartPatch"
FILL = "KritaFill/KisToolFill"
ENCLOSE_AND_FILL = "KisToolEncloseAndFill", "Enclose and Fill Tool"
ENCLOSE_AND_FILL = "KisToolEncloseAndFill"

_utility = Group("Utility")
ASSISTANTS = "KisAssistantTool", "Assistant Tool"
ASSISTANTS = "KisAssistantTool"
MEASUREMENT = "KritaShape/KisToolMeasure"
REFERENCE = "ToolReferenceImages", "Reference Images Tool"
REFERENCE = "ToolReferenceImages"

_selection = Group("Selection")
RECTANGULAR_SELECTION = "KisToolSelectRectangular"
Expand All @@ -58,15 +57,11 @@ class Tool(EnumGroup):
ZOOM = "ZoomTool"
PAN = "PanTool"

def __init__(self, value: str, pretty_name: Optional[str] = None):
self._value_ = value
self._custom_pretty_name = pretty_name

@property
def pretty_name(self) -> str:
"""Format tool name as in Krita Blending Mode combobox."""
if self._custom_pretty_name is not None:
return self._custom_pretty_name
if self in PRETTY_NAMES:
return PRETTY_NAMES[self]
return f"{self.name.replace('_', ' ').title()} Tool"

def activate(self):
Expand All @@ -81,3 +76,13 @@ def is_paintable(cls, tool: 'Tool') -> bool:
def icon(self) -> QIcon:
"""Return the icon of this tool."""
return Api.instance().action(self.value).icon()


PRETTY_NAMES = {
Tool.SHAPE_SELECT: "Select Shapes Tool",
Tool.CALLIGRAPHY: "Calligraphy",
Tool.COLOR_SAMPLER: "Color Sampler",
Tool.ENCLOSE_AND_FILL: "Enclose and Fill Tool",
Tool.ASSISTANTS: "Assistant Tool",
Tool.REFERENCE: "Reference Images Tool",
}
5 changes: 0 additions & 5 deletions shortcut_composer/api_krita/pyqt/custom_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ def move_center(self, new_center: QPoint) -> None:
"""Move the widget by providing a new center point."""
self.move(new_center-self.center) # type: ignore

def setGeometry(self, ax: int, ay: int, aw: int, ah: int) -> None:
center = self.center_global
super().setGeometry(ax, ay, aw, ah)
self.move_center(center)


class AnimatedWidget(QWidget):
"""Adds the fade-in animation when the widget is shown (60 FPS)."""
Expand Down
Loading

0 comments on commit 7bee5b7

Please sign in to comment.