feat: split rotation and flip icon build functions
This commit is contained in:
@@ -124,6 +124,7 @@ def link_artifact(src: Path, dst: Path) -> None:
|
||||
f'No common directory between "{src}" and "{dst}", '
|
||||
f"can not create relative symlink."
|
||||
)
|
||||
|
||||
# SAFETY: the symlink target must always be stored with POSIX
|
||||
# separators ("/"). On Windows, "relative_to" yields a
|
||||
# backslash-separated path, and "symlink_to" stores the target string
|
||||
|
||||
@@ -21,24 +21,36 @@ def register(ctx: AuroraContext) -> None:
|
||||
)
|
||||
|
||||
ctx.register(
|
||||
"std/action/object-flip-*",
|
||||
"std/action/object-flip-horizontal",
|
||||
(
|
||||
SvgSource("object-flip-horizontal.svg"),
|
||||
SvgSource("object-flip-vertical.svg"),
|
||||
FdArtSink(FdContext.Actions, "object-flip-horizontal"),
|
||||
FdArtSink(FdContext.Actions, "object-flip-vertical"),
|
||||
),
|
||||
build_object_flip_icons,
|
||||
build_object_flip_horizontal_icon,
|
||||
)
|
||||
ctx.register(
|
||||
"std/action/object-rotate-*",
|
||||
"std/action/object-flip-vertical",
|
||||
(
|
||||
SvgSource("object-flip-vertical.svg"),
|
||||
FdArtSink(FdContext.Actions, "object-flip-vertical"),
|
||||
),
|
||||
build_object_flip_vertical_icon,
|
||||
)
|
||||
ctx.register(
|
||||
"std/action/object-rotate-left",
|
||||
(
|
||||
SvgSource("object-rotate-left.svg"),
|
||||
SvgSource("object-rotate-right.svg"),
|
||||
FdArtSink(FdContext.Actions, "object-rotate-left"),
|
||||
),
|
||||
build_object_rotate_left_icon,
|
||||
)
|
||||
ctx.register(
|
||||
"std/action/object-rotate-right",
|
||||
(
|
||||
SvgSource("object-rotate-right.svg"),
|
||||
FdArtSink(FdContext.Actions, "object-rotate-right"),
|
||||
),
|
||||
build_object_rotate_icons,
|
||||
build_object_rotate_right_icon,
|
||||
)
|
||||
|
||||
ctx.register(
|
||||
@@ -92,34 +104,32 @@ def build_go_icons(
|
||||
go_mask = go_mask.transpose(PIL.Image.Transpose.ROTATE_90)
|
||||
|
||||
|
||||
def build_object_flip_icons(
|
||||
env: AuroraEnvironment,
|
||||
horizontal_src: SvgSource,
|
||||
vertical_src: SvgSource,
|
||||
horizontal_sink: FdArtSink,
|
||||
vertical_sink: FdArtSink,
|
||||
def build_object_flip_horizontal_icon(
|
||||
env: AuroraEnvironment, src: SvgSource, sink: FdArtSink
|
||||
) -> None:
|
||||
art = horizontal_src.pull(env)
|
||||
with art:
|
||||
horizontal_sink.push(env, art)
|
||||
art = vertical_src.pull(env)
|
||||
with art:
|
||||
vertical_sink.push(env, art)
|
||||
with src.pull(env) as art:
|
||||
sink.push(env, art)
|
||||
|
||||
|
||||
def build_object_rotate_icons(
|
||||
env: AuroraEnvironment,
|
||||
left_src: SvgSource,
|
||||
right_src: SvgSource,
|
||||
left_sink: FdArtSink,
|
||||
right_sink: FdArtSink,
|
||||
def build_object_flip_vertical_icon(
|
||||
env: AuroraEnvironment, src: SvgSource, sink: FdArtSink
|
||||
) -> None:
|
||||
art = left_src.pull(env)
|
||||
with art:
|
||||
left_sink.push(env, art)
|
||||
art = right_src.pull(env)
|
||||
with art:
|
||||
right_sink.push(env, art)
|
||||
with src.pull(env) as art:
|
||||
sink.push(env, art)
|
||||
|
||||
|
||||
def build_object_rotate_left_icon(
|
||||
env: AuroraEnvironment, src: SvgSource, sink: FdArtSink
|
||||
) -> None:
|
||||
with src.pull(env) as art:
|
||||
sink.push(env, art)
|
||||
|
||||
|
||||
def build_object_rotate_right_icon(
|
||||
env: AuroraEnvironment, src: SvgSource, sink: FdArtSink
|
||||
) -> None:
|
||||
with src.pull(env) as art:
|
||||
sink.push(env, art)
|
||||
|
||||
|
||||
def build_zoom_origin_and_fit_best_icons(
|
||||
|
||||
Reference in New Issue
Block a user