refactor: rename some job names
This commit is contained in:
@@ -3,7 +3,7 @@ from .assemblicon.highlevel.environment import Environment
|
|||||||
from .assemblicon.highlevel.context import Context
|
from .assemblicon.highlevel.context import Context
|
||||||
from .assemblicon.logger import APP_LOGGER as LOGGER
|
from .assemblicon.logger import APP_LOGGER as LOGGER
|
||||||
from .cli import parse
|
from .cli import parse
|
||||||
from .types import AuroraPrologue
|
from .types import AuroraPrologue, AuroraContext
|
||||||
from . import std_icons, nostd_icons
|
from . import std_icons, nostd_icons
|
||||||
|
|
||||||
|
|
||||||
@@ -17,6 +17,9 @@ def main() -> None:
|
|||||||
env = Environment(prologue)
|
env = Environment(prologue)
|
||||||
ctx = Context(env)
|
ctx = Context(env)
|
||||||
|
|
||||||
|
# create our special temporary subdirectory
|
||||||
|
env.temporary_artifact("component").mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
register(ctx)
|
register(ctx)
|
||||||
ctx.run(opts.selection)
|
ctx.run(opts.selection)
|
||||||
@@ -24,6 +27,6 @@ def main() -> None:
|
|||||||
LOGGER.fatal("Runtime error: %s", e)
|
LOGGER.fatal("Runtime error: %s", e)
|
||||||
|
|
||||||
|
|
||||||
def register(ctx: Context) -> None:
|
def register(ctx: AuroraContext) -> None:
|
||||||
std_icons.register(ctx)
|
std_icons.register(ctx)
|
||||||
nostd_icons.register(ctx)
|
nostd_icons.register(ctx)
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ class Environment(Generic[P]):
|
|||||||
|
|
||||||
def __init__(self, prologue: P) -> None:
|
def __init__(self, prologue: P) -> None:
|
||||||
self.__prologue = prologue
|
self.__prologue = prologue
|
||||||
|
self.__temp_dir = tempfile.TemporaryDirectory()
|
||||||
|
|
||||||
# construct basic layout of temporary directory
|
# construct basic layout of temporary directory
|
||||||
self.temporary_artifact(_TEMP_USER_DIR).mkdir(parents=True, exist_ok=True)
|
self.temporary_artifact(_TEMP_USER_DIR).mkdir(parents=True, exist_ok=True)
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ from ..assemblicon.lowlevel.artproc import (
|
|||||||
def register(ctx: AuroraContext) -> None:
|
def register(ctx: AuroraContext) -> None:
|
||||||
ctx.register(
|
ctx.register(
|
||||||
"nostd/action/image-properties",
|
"nostd/action/image-properties",
|
||||||
("nostd/mimetype/image-jpeg", "std/status/dialog-*"),
|
("nostd/mimetype/image-jpeg", "std/status/dialog-infomation"),
|
||||||
_build_image_properties_icon,
|
_build_image_properties_icon,
|
||||||
)
|
)
|
||||||
ctx.register(
|
ctx.register(
|
||||||
"nostd/action/image-zoom-original",
|
"nostd/action/image-zoom-original",
|
||||||
("nostd/mimetype/image-jpeg", "std/action/zoom-*"),
|
("nostd/mimetype/image-jpeg", "component/triangles"),
|
||||||
_build_image_zoom_original_icon,
|
_build_image_zoom_original_icon,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -44,16 +44,16 @@ def _build_image_properties_icon(env: AuroraEnvironment) -> None:
|
|||||||
|
|
||||||
def _build_image_zoom_original_icon(env: AuroraEnvironment) -> None:
|
def _build_image_zoom_original_icon(env: AuroraEnvironment) -> None:
|
||||||
# load triangle assets
|
# load triangle assets
|
||||||
triangle_left = env.load_temporary_artifact("triangle-left.png").resize(
|
tri_left = env.load_temporary_artifact("component", "triangle-left.png").resize(
|
||||||
(300, 300), PIL.Image.Resampling.LANCZOS
|
(300, 300), PIL.Image.Resampling.LANCZOS
|
||||||
)
|
)
|
||||||
triangle_down = env.load_temporary_artifact("triangle-down.png").resize(
|
tri_down = env.load_temporary_artifact("component", "triangle-down.png").resize(
|
||||||
(300, 300), PIL.Image.Resampling.LANCZOS
|
(300, 300), PIL.Image.Resampling.LANCZOS
|
||||||
)
|
)
|
||||||
triangle_right = env.load_temporary_artifact("triangle-right.png").resize(
|
tri_right = env.load_temporary_artifact("component", "triangle-right.png").resize(
|
||||||
(300, 300), PIL.Image.Resampling.LANCZOS
|
(300, 300), PIL.Image.Resampling.LANCZOS
|
||||||
)
|
)
|
||||||
triangle_up = env.load_temporary_artifact("triangle-up.png").resize(
|
tri_up = env.load_temporary_artifact("component", "triangle-up.png").resize(
|
||||||
(300, 300), PIL.Image.Resampling.LANCZOS
|
(300, 300), PIL.Image.Resampling.LANCZOS
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -73,33 +73,27 @@ def _build_image_zoom_original_icon(env: AuroraEnvironment) -> None:
|
|||||||
)
|
)
|
||||||
align_alpha_composite(
|
align_alpha_composite(
|
||||||
icon,
|
icon,
|
||||||
triangle_left,
|
tri_left,
|
||||||
art_anchor_to_offset(icon, HorizontalAnchor.Left, VerticalAnchor.Center),
|
art_anchor_to_offset(icon, HorizontalAnchor.Left, VerticalAnchor.Center),
|
||||||
art_anchor_to_offset(
|
art_anchor_to_offset(tri_left, HorizontalAnchor.Left, VerticalAnchor.Center),
|
||||||
triangle_left, HorizontalAnchor.Left, VerticalAnchor.Center
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
align_alpha_composite(
|
align_alpha_composite(
|
||||||
icon,
|
icon,
|
||||||
triangle_right,
|
tri_right,
|
||||||
art_anchor_to_offset(icon, HorizontalAnchor.Right, VerticalAnchor.Center),
|
art_anchor_to_offset(icon, HorizontalAnchor.Right, VerticalAnchor.Center),
|
||||||
art_anchor_to_offset(
|
art_anchor_to_offset(tri_right, HorizontalAnchor.Right, VerticalAnchor.Center),
|
||||||
triangle_right, HorizontalAnchor.Right, VerticalAnchor.Center
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
align_alpha_composite(
|
align_alpha_composite(
|
||||||
icon,
|
icon,
|
||||||
triangle_up,
|
tri_up,
|
||||||
art_anchor_to_offset(icon, HorizontalAnchor.Center, VerticalAnchor.Top),
|
art_anchor_to_offset(icon, HorizontalAnchor.Center, VerticalAnchor.Top),
|
||||||
art_anchor_to_offset(triangle_up, HorizontalAnchor.Center, VerticalAnchor.Top),
|
art_anchor_to_offset(tri_up, HorizontalAnchor.Center, VerticalAnchor.Top),
|
||||||
)
|
)
|
||||||
align_alpha_composite(
|
align_alpha_composite(
|
||||||
icon,
|
icon,
|
||||||
triangle_down,
|
tri_down,
|
||||||
art_anchor_to_offset(icon, HorizontalAnchor.Center, VerticalAnchor.Bottom),
|
art_anchor_to_offset(icon, HorizontalAnchor.Center, VerticalAnchor.Bottom),
|
||||||
art_anchor_to_offset(
|
art_anchor_to_offset(tri_down, HorizontalAnchor.Center, VerticalAnchor.Bottom),
|
||||||
triangle_down, HorizontalAnchor.Center, VerticalAnchor.Bottom
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# save it
|
# save it
|
||||||
|
|||||||
@@ -12,24 +12,22 @@ from ..assemblicon.lowlevel.artproc import (
|
|||||||
|
|
||||||
|
|
||||||
def register(ctx: AuroraContext) -> None:
|
def register(ctx: AuroraContext) -> None:
|
||||||
ctx.register("nostd/mimetype/image-jpeg", (), _build_image_icons)
|
ctx.register("component/image-base", (), build_image_base_icon)
|
||||||
|
ctx.register("nostd/mimetype/image-jpeg", ("component/image-base",), build_jpg_icon)
|
||||||
|
|
||||||
|
|
||||||
IMAGE_INNER_RECT = Rectangle(Point(20 * 4, 52 * 4), Point(236 * 4, 204 * 4))
|
IMAGE_INNER_RECT = Rectangle(Point(20 * 4, 52 * 4), Point(236 * 4, 204 * 4))
|
||||||
|
|
||||||
|
|
||||||
def _build_image_icons(env: AuroraEnvironment) -> None:
|
def build_image_base_icon(env: AuroraEnvironment) -> None:
|
||||||
# build image base
|
env.render_svg(
|
||||||
image_base = env.render_svg_then_load(
|
|
||||||
env.input_artifact("component", "image-base.svg"),
|
env.input_artifact("component", "image-base.svg"),
|
||||||
|
env.temporary_artifact("component", "image-base.png"),
|
||||||
)
|
)
|
||||||
# load image base
|
|
||||||
with image_base:
|
|
||||||
_build_jpg_icon(env, image_base)
|
|
||||||
|
|
||||||
|
|
||||||
def _build_jpg_icon(env: AuroraEnvironment, base: Artifact) -> None:
|
def build_jpg_icon(env: AuroraEnvironment) -> None:
|
||||||
jpg_image = base.copy()
|
jpg_image = env.load_temporary_artifact("component", "image-base.png")
|
||||||
|
|
||||||
jpg_image_inner = env.load_input_bitmap_artifact(
|
jpg_image_inner = env.load_input_bitmap_artifact(
|
||||||
"ext", "bitmap", "Niinsaare_järv.jpg"
|
"ext", "bitmap", "Niinsaare_järv.jpg"
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
from ..types import AuroraContext
|
from ..types import AuroraContext
|
||||||
from . import action_icons, status_icons, mimetype_icons
|
from . import components, action_icons, status_icons, mimetype_icons
|
||||||
|
|
||||||
|
|
||||||
def register(ctx: AuroraContext) -> None:
|
def register(ctx: AuroraContext) -> None:
|
||||||
|
components.register(ctx)
|
||||||
action_icons.register(ctx)
|
action_icons.register(ctx)
|
||||||
mimetype_icons.register(ctx)
|
mimetype_icons.register(ctx)
|
||||||
status_icons.register(ctx)
|
status_icons.register(ctx)
|
||||||
|
|||||||
@@ -11,7 +11,14 @@ def register(ctx: AuroraContext) -> None:
|
|||||||
ctx.register("std/action/object-rotate-*", (), build_object_rotate_icons)
|
ctx.register("std/action/object-rotate-*", (), build_object_rotate_icons)
|
||||||
|
|
||||||
ctx.register(
|
ctx.register(
|
||||||
"std/action/zoom-[original|fit-best]", (), build_zoom_origin_and_fit_best_icons
|
"component/triangles",
|
||||||
|
("component/generic-background",),
|
||||||
|
build_zoom_triangle_icons,
|
||||||
|
)
|
||||||
|
ctx.register(
|
||||||
|
"std/action/zoom-[original|fit-best]",
|
||||||
|
("component/triangles",),
|
||||||
|
build_zoom_origin_and_fit_best_icons,
|
||||||
)
|
)
|
||||||
ctx.register("std/action/zoom-[in|out]", (), build_zoom_in_out_icons)
|
ctx.register("std/action/zoom-[in|out]", (), build_zoom_in_out_icons)
|
||||||
|
|
||||||
@@ -60,51 +67,53 @@ def build_object_rotate_icons(env: AuroraEnvironment) -> None:
|
|||||||
env.save_fd_artifact(art, FdContext.Actions, "object-rotate-right")
|
env.save_fd_artifact(art, FdContext.Actions, "object-rotate-right")
|
||||||
|
|
||||||
|
|
||||||
def build_zoom_origin_and_fit_best_icons(env: AuroraEnvironment) -> None:
|
def build_zoom_triangle_icons(env: AuroraEnvironment) -> None:
|
||||||
# load triangle assets
|
# load triangle and background assets
|
||||||
triangle = env.render_svg_then_load(env.input_artifact("component", "triangle.svg"))
|
tri = env.render_svg_then_load(env.input_artifact("component", "triangle.svg"))
|
||||||
background = env.render_svg_then_load(
|
bg = env.load_temporary_artifact("component", "generic-background.png")
|
||||||
env.input_artifact("component", "background.svg")
|
|
||||||
)
|
|
||||||
|
|
||||||
# create 4 triangle icons for following building
|
# create 4 triangle icons for following building
|
||||||
triangle_left = env.new_artifact()
|
tri_left = env.new_artifact()
|
||||||
triangle_left.paste(background, (0, 0), triangle)
|
tri_left.paste(bg, (0, 0), tri)
|
||||||
triangle = triangle.transpose(PIL.Image.Transpose.ROTATE_90)
|
tri = tri.transpose(PIL.Image.Transpose.ROTATE_90)
|
||||||
|
|
||||||
triangle_down = env.new_artifact()
|
tri_down = env.new_artifact()
|
||||||
triangle_down.paste(background, (0, 0), triangle)
|
tri_down.paste(bg, (0, 0), tri)
|
||||||
triangle = triangle.transpose(PIL.Image.Transpose.ROTATE_90)
|
tri = tri.transpose(PIL.Image.Transpose.ROTATE_90)
|
||||||
|
|
||||||
triangle_right = env.new_artifact()
|
tri_right = env.new_artifact()
|
||||||
triangle_right.paste(background, (0, 0), triangle)
|
tri_right.paste(bg, (0, 0), tri)
|
||||||
triangle = triangle.transpose(PIL.Image.Transpose.ROTATE_90)
|
tri = tri.transpose(PIL.Image.Transpose.ROTATE_90)
|
||||||
|
|
||||||
triangle_up = env.new_artifact()
|
tri_up = env.new_artifact()
|
||||||
triangle_up.paste(background, (0, 0), triangle)
|
tri_up.paste(bg, (0, 0), tri)
|
||||||
|
|
||||||
# save them for reuse
|
# save them for reuse
|
||||||
env.save_temporary_artifact(triangle_left, "triangle-left.png")
|
env.save_temporary_artifact(tri_left, "component", "triangle-left.png")
|
||||||
env.save_temporary_artifact(triangle_down, "triangle-down.png")
|
env.save_temporary_artifact(tri_down, "component", "triangle-down.png")
|
||||||
env.save_temporary_artifact(triangle_right, "triangle-right.png")
|
env.save_temporary_artifact(tri_right, "component", "triangle-right.png")
|
||||||
env.save_temporary_artifact(triangle_up, "triangle-up.png")
|
env.save_temporary_artifact(tri_up, "component", "triangle-up.png")
|
||||||
|
|
||||||
|
|
||||||
|
def build_zoom_origin_and_fit_best_icons(env: AuroraEnvironment) -> None:
|
||||||
|
# load triangle assets
|
||||||
|
tri_left = env.load_temporary_artifact("component", "triangle-left.png")
|
||||||
|
tri_down = env.load_temporary_artifact("component", "triangle-down.png")
|
||||||
|
tri_right = env.load_temporary_artifact("component", "triangle-right.png")
|
||||||
|
tri_up = env.load_temporary_artifact("component", "triangle-up.png")
|
||||||
|
|
||||||
# build icons
|
# build icons
|
||||||
with triangle_left, triangle_down, triangle_right, triangle_up:
|
with tri_left, tri_down, tri_right, tri_up:
|
||||||
build_zoom_origin_icon(
|
build_zoom_origin_icon(env, tri_left, tri_down, tri_right, tri_up)
|
||||||
env, triangle_left, triangle_down, triangle_right, triangle_up
|
build_zoom_fit_best_icon(env, tri_left, tri_down, tri_right, tri_up)
|
||||||
)
|
|
||||||
build_zoom_fit_best_icon(
|
|
||||||
env, triangle_left, triangle_down, triangle_right, triangle_up
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def build_zoom_origin_icon(
|
def build_zoom_origin_icon(
|
||||||
env: AuroraEnvironment,
|
env: AuroraEnvironment,
|
||||||
triangle_left: Artifact,
|
tri_left: Artifact,
|
||||||
triangle_down: Artifact,
|
tri_down: Artifact,
|
||||||
triangle_right: Artifact,
|
tri_right: Artifact,
|
||||||
triangle_up: Artifact,
|
tri_up: Artifact,
|
||||||
) -> None:
|
) -> None:
|
||||||
# TODO: finihs this in future
|
# TODO: finihs this in future
|
||||||
pass
|
pass
|
||||||
@@ -112,10 +121,10 @@ def build_zoom_origin_icon(
|
|||||||
|
|
||||||
def build_zoom_fit_best_icon(
|
def build_zoom_fit_best_icon(
|
||||||
env: AuroraEnvironment,
|
env: AuroraEnvironment,
|
||||||
triangle_left: Artifact,
|
tri_left: Artifact,
|
||||||
triangle_down: Artifact,
|
tri_down: Artifact,
|
||||||
triangle_right: Artifact,
|
tri_right: Artifact,
|
||||||
triangle_up: Artifact,
|
tri_up: Artifact,
|
||||||
) -> None:
|
) -> None:
|
||||||
# TODO: finihs this in future
|
# TODO: finihs this in future
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import PIL.Image
|
||||||
|
from ..types import AuroraContext, AuroraEnvironment
|
||||||
|
|
||||||
|
|
||||||
|
def register(ctx: AuroraContext) -> None:
|
||||||
|
ctx.register("component/generic-background", (), build_generic_background)
|
||||||
|
|
||||||
|
|
||||||
|
def build_generic_background(env: AuroraEnvironment) -> None:
|
||||||
|
env.render_svg(
|
||||||
|
env.input_artifact("component", "generic-background.svg"),
|
||||||
|
env.temporary_artifact("component", "generic-background.png"),
|
||||||
|
)
|
||||||
@@ -4,7 +4,9 @@ from ..assemblicon.highlevel.environment import FdContext
|
|||||||
|
|
||||||
def register(ctx: AuroraContext) -> None:
|
def register(ctx: AuroraContext) -> None:
|
||||||
ctx.register(
|
ctx.register(
|
||||||
"std/status/dialog-*", ("nostd/mimetype/image-jpeg"), build_image_x_generic
|
"std/mimetype/image-x-generic",
|
||||||
|
("nostd/mimetype/image-jpeg",),
|
||||||
|
build_image_x_generic,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ from ..assemblicon.highlevel.environment import FdContext
|
|||||||
|
|
||||||
|
|
||||||
def register(ctx: AuroraContext) -> None:
|
def register(ctx: AuroraContext) -> None:
|
||||||
ctx.register("std/status/dialog-*", (), build_dialog_icons)
|
ctx.register("std/status/dialog-infomation", (), build_dialog_infomation_icon)
|
||||||
|
ctx.register("std/status/dialog-warning", (), build_dialog_warning_icon)
|
||||||
|
ctx.register("std/status/dialog-error", (), build_dialog_error_icon)
|
||||||
|
ctx.register("std/status/dialog-question", (), build_dialog_question_icon)
|
||||||
|
|
||||||
|
|
||||||
def build_dialog_icons(env: AuroraEnvironment) -> None:
|
def build_dialog_infomation_icon(env: AuroraEnvironment) -> None:
|
||||||
# save dialog icon with FreeDesktop icon and temp icon for reuse.
|
# save dialog icon with FreeDesktop icon and temp icon for reuse.
|
||||||
art = env.render_svg_then_load(
|
art = env.render_svg_then_load(
|
||||||
env.input_artifact("dialog-infomation.svg"),
|
env.input_artifact("dialog-infomation.svg"),
|
||||||
@@ -15,6 +18,9 @@ def build_dialog_icons(env: AuroraEnvironment) -> None:
|
|||||||
with art:
|
with art:
|
||||||
env.save_fd_artifact(art, FdContext.Status, "dialog-infomation")
|
env.save_fd_artifact(art, FdContext.Status, "dialog-infomation")
|
||||||
|
|
||||||
|
|
||||||
|
def build_dialog_warning_icon(env: AuroraEnvironment) -> None:
|
||||||
|
# save dialog icon with FreeDesktop icon and temp icon for reuse.
|
||||||
art = env.render_svg_then_load(
|
art = env.render_svg_then_load(
|
||||||
env.input_artifact("dialog-warning.svg"),
|
env.input_artifact("dialog-warning.svg"),
|
||||||
env.temporary_artifact("dialog-warning.png"),
|
env.temporary_artifact("dialog-warning.png"),
|
||||||
@@ -22,6 +28,9 @@ def build_dialog_icons(env: AuroraEnvironment) -> None:
|
|||||||
with art:
|
with art:
|
||||||
env.save_fd_artifact(art, FdContext.Status, "dialog-warning")
|
env.save_fd_artifact(art, FdContext.Status, "dialog-warning")
|
||||||
|
|
||||||
|
|
||||||
|
def build_dialog_error_icon(env: AuroraEnvironment) -> None:
|
||||||
|
# save dialog icon with FreeDesktop icon and temp icon for reuse.
|
||||||
art = env.render_svg_then_load(
|
art = env.render_svg_then_load(
|
||||||
env.input_artifact("dialog-error.svg"),
|
env.input_artifact("dialog-error.svg"),
|
||||||
env.temporary_artifact("dialog-error.png"),
|
env.temporary_artifact("dialog-error.png"),
|
||||||
@@ -29,4 +38,14 @@ def build_dialog_icons(env: AuroraEnvironment) -> None:
|
|||||||
with art:
|
with art:
|
||||||
env.save_fd_artifact(art, FdContext.Status, "dialog-error")
|
env.save_fd_artifact(art, FdContext.Status, "dialog-error")
|
||||||
|
|
||||||
|
|
||||||
|
def build_dialog_question_icon(env: AuroraEnvironment) -> None:
|
||||||
# TODO: add dialog-question generation
|
# TODO: add dialog-question generation
|
||||||
|
# # save dialog icon with FreeDesktop icon and temp icon for reuse.
|
||||||
|
# art = env.render_svg_then_load(
|
||||||
|
# env.input_artifact("dialog-question.svg"),
|
||||||
|
# env.temporary_artifact("dialog-question.png"),
|
||||||
|
# )
|
||||||
|
# with art:
|
||||||
|
# env.save_fd_artifact(art, FdContext.Status, "dialog-question")
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user