Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0d6aa63e6 | ||
|
|
765375f04c | ||
|
|
a563917aa8 |
@@ -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
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
from ..types import AuroraContext, AuroraEnvironment
|
||||
from ..assemblicon.highlevel.utils import FdContext, WinCategory, MacCategory
|
||||
from ..assemblicon.highlevel.source import SvgSource, TempArtSource, NewArtSource
|
||||
from ..assemblicon.highlevel.sink import FdArtSink, WinArtSink, MacArtSink
|
||||
from ..assemblicon.highlevel.source import (
|
||||
SvgSource,
|
||||
TempArtSource,
|
||||
NewArtSource,
|
||||
BlenderSource,
|
||||
)
|
||||
from ..assemblicon.highlevel.sink import FdArtSink, WinArtSink, MacArtSink, TempArtSink
|
||||
from ..assemblicon.lowlevel.artproc import (
|
||||
art_anchor_to_offset,
|
||||
default_art_resize,
|
||||
@@ -22,11 +27,20 @@ def register(ctx: AuroraContext) -> None:
|
||||
WinArtSink(WinCategory.Application, "sarasacw-picture"),
|
||||
MacArtSink(MacCategory.Application, "sarasacw-picture"),
|
||||
),
|
||||
build_sarasacw_picture_icons,
|
||||
build_sarasacw_picture_icon,
|
||||
)
|
||||
ctx.register(
|
||||
"nostd/application/notepad",
|
||||
(
|
||||
BlenderSource("app", "notepad.blend"),
|
||||
TempArtSink("notepad.png"),
|
||||
WinArtSink(WinCategory.Application, "notepad"),
|
||||
),
|
||||
build_notepad_icon,
|
||||
)
|
||||
|
||||
|
||||
def build_sarasacw_picture_icons(
|
||||
def build_sarasacw_picture_icon(
|
||||
env: AuroraEnvironment,
|
||||
frame_src: SvgSource,
|
||||
inner_src: TempArtSource,
|
||||
@@ -55,3 +69,14 @@ def build_sarasacw_picture_icons(
|
||||
fd_sink.push(env, app)
|
||||
win_sink.push(env, app)
|
||||
mac_sink.push(env, app)
|
||||
|
||||
|
||||
def build_notepad_icon(
|
||||
env: AuroraEnvironment,
|
||||
src: BlenderSource,
|
||||
temp_sink: TempArtSink,
|
||||
win_sink: WinArtSink,
|
||||
) -> None:
|
||||
src.pull_to_temp(env, temp_sink)
|
||||
with temp_sink.repull(env) as art:
|
||||
win_sink.push(env, art)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import PIL.Image
|
||||
from ..types import AuroraContext, AuroraEnvironment
|
||||
from ..assemblicon.geometry import Rectangle, Point
|
||||
from ..assemblicon.lowlevel.artproc import default_art_resize, align_alpha_composite
|
||||
from ..assemblicon.highlevel.utils import FdContext
|
||||
from ..assemblicon.highlevel.source import SvgSource, TempArtSource
|
||||
from ..assemblicon.highlevel.sink import FdArtSink
|
||||
@@ -21,24 +23,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(
|
||||
@@ -56,6 +70,9 @@ def register(ctx: AuroraContext) -> None:
|
||||
ctx.register(
|
||||
"std/action/zoom-[in|out]",
|
||||
(
|
||||
TempArtSource("component", "magnifying-glass.png"),
|
||||
TempArtSource("component", "plus.png"),
|
||||
TempArtSource("component", "minus.png"),
|
||||
FdArtSink(FdContext.Actions, "zoom-in"),
|
||||
FdArtSink(FdContext.Actions, "zoom-out"),
|
||||
),
|
||||
@@ -92,34 +109,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(
|
||||
@@ -136,7 +151,26 @@ def build_zoom_origin_and_fit_best_icons(
|
||||
|
||||
|
||||
def build_zoom_in_out_icons(
|
||||
env: AuroraEnvironment, zoom_in_sink: FdArtSink, zoom_out_sink: FdArtSink
|
||||
env: AuroraEnvironment,
|
||||
magnifying_glass_source: TempArtSource,
|
||||
plus_source: TempArtSource,
|
||||
minus_source: TempArtSource,
|
||||
zoom_in_sink: FdArtSink,
|
||||
zoom_out_sink: FdArtSink,
|
||||
) -> None:
|
||||
# TODO: finish this in future
|
||||
pass
|
||||
magnifying_glass = magnifying_glass_source.pull(env)
|
||||
magnifying_glass_rect = Rectangle.from_padding_rect(
|
||||
Point(665, 355), 200, 200, 200, 200
|
||||
)
|
||||
|
||||
inner_size = (magnifying_glass_rect.width, magnifying_glass_rect.height)
|
||||
plus = default_art_resize(plus_source.pull(env), *inner_size)
|
||||
minus = default_art_resize(minus_source.pull(env), *inner_size)
|
||||
|
||||
zoom_in = magnifying_glass.copy()
|
||||
align_alpha_composite(zoom_in, plus, magnifying_glass_rect.pos1, Point(0, 0))
|
||||
zoom_in_sink.push(env, zoom_in)
|
||||
|
||||
zoom_out = magnifying_glass.copy()
|
||||
align_alpha_composite(zoom_out, minus, magnifying_glass_rect.pos1, Point(0, 0))
|
||||
zoom_out_sink.push(env, zoom_out)
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import PIL.Image
|
||||
from ..types import AuroraContext, AuroraEnvironment
|
||||
from ..assemblicon.highlevel.source import SvgSource, TempArtSource, NewArtSource
|
||||
from ..assemblicon.highlevel.source import (
|
||||
SvgSource,
|
||||
TempArtSource,
|
||||
NewArtSource,
|
||||
BlenderSource,
|
||||
)
|
||||
from ..assemblicon.highlevel.sink import TempArtSink
|
||||
|
||||
|
||||
@@ -26,6 +31,26 @@ def register(ctx: AuroraContext) -> None:
|
||||
),
|
||||
build_triangle_icons,
|
||||
)
|
||||
ctx.register(
|
||||
"component/plus_minus",
|
||||
(
|
||||
TempArtSource("component", "generic-background.png"),
|
||||
SvgSource("component", "plus.svg"),
|
||||
SvgSource("component", "minus.svg"),
|
||||
NewArtSource(),
|
||||
TempArtSink("component", "plus.png"),
|
||||
TempArtSink("component", "minus.png"),
|
||||
),
|
||||
build_plus_minus_icons,
|
||||
)
|
||||
ctx.register(
|
||||
"component/magnifying-glass",
|
||||
(
|
||||
BlenderSource("component", "magnifying-glass.blend"),
|
||||
TempArtSink("component", "magnifying-glass.png"),
|
||||
),
|
||||
build_magnifying_glass_icon,
|
||||
)
|
||||
|
||||
|
||||
def build_generic_background(
|
||||
@@ -69,3 +94,31 @@ def build_triangle_icons(
|
||||
sink_down.push(env, tri_down)
|
||||
sink_right.push(env, tri_right)
|
||||
sink_up.push(env, tri_up)
|
||||
|
||||
|
||||
def build_plus_minus_icons(
|
||||
env: AuroraEnvironment,
|
||||
bg_src: TempArtSource,
|
||||
plus_src: SvgSource,
|
||||
minus_src: SvgSource,
|
||||
new_art: NewArtSource,
|
||||
plus_sink: TempArtSink,
|
||||
minus_sink: TempArtSink,
|
||||
) -> None:
|
||||
bg = bg_src.pull(env)
|
||||
|
||||
plus = plus_src.pull(env)
|
||||
art = new_art.pull()
|
||||
art.paste(bg, (0, 0), plus)
|
||||
plus_sink.push(env, art)
|
||||
|
||||
minus = minus_src.pull(env)
|
||||
art = new_art.pull()
|
||||
art.paste(bg, (0, 0), minus)
|
||||
minus_sink.push(env, art)
|
||||
|
||||
|
||||
def build_magnifying_glass_icon(
|
||||
env: AuroraEnvironment, src: BlenderSource, sink: TempArtSink
|
||||
) -> None:
|
||||
src.pull_to_temp(env, sink)
|
||||
|
||||
Reference in New Issue
Block a user