feat: add dialog icons and image properties
This commit is contained in:
@@ -28,5 +28,5 @@ def main() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def _build_icons(ctx: AdvancedContext) -> None:
|
def _build_icons(ctx: AdvancedContext) -> None:
|
||||||
|
build_standard_icons(ctx)
|
||||||
build_non_standard_icons(ctx)
|
build_non_standard_icons(ctx)
|
||||||
#build_standard_icons(ctx)
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ _DEFAULT_BLD_CONFIG = artrender.BlenderConfig(VANILLA_ARTIFACT_HW, VANILLA_ARTIF
|
|||||||
|
|
||||||
# TODO: For easy testing, we only build 32x32 and 48x48.
|
# TODO: For easy testing, we only build 32x32 and 48x48.
|
||||||
# Enable full generation after testing.
|
# Enable full generation after testing.
|
||||||
_FD_THUMBNAIL_HWS: tuple[int, ...] = (32, 48, 1024)
|
_FD_THUMBNAIL_HWS: tuple[int, ...] = (32, 48)
|
||||||
# _FD_THUMBNAIL_HWS: tuple[int, ...] = (16, 32, 48, 64, 128, 256)
|
# _FD_THUMBNAIL_HWS: tuple[int, ...] = (16, 32, 48, 64, 128, 256)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from ..assemblicon.context import AdvancedContext
|
from ..assemblicon.context import AdvancedContext
|
||||||
|
from .action_icons import build_action_icons
|
||||||
from .mimetype_icons import build_mimetype_icons
|
from .mimetype_icons import build_mimetype_icons
|
||||||
from .application_icons import build_application_icons
|
from .application_icons import build_application_icons
|
||||||
|
|
||||||
@@ -6,3 +7,4 @@ from .application_icons import build_application_icons
|
|||||||
def build_non_standard_icons(ctx: AdvancedContext) -> None:
|
def build_non_standard_icons(ctx: AdvancedContext) -> None:
|
||||||
build_mimetype_icons(ctx)
|
build_mimetype_icons(ctx)
|
||||||
build_application_icons(ctx)
|
build_application_icons(ctx)
|
||||||
|
build_action_icons(ctx)
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import PIL.Image
|
||||||
|
from ..assemblicon.context import AdvancedContext, FdContext
|
||||||
|
from ..assemblicon.artproc import (
|
||||||
|
anchor_to_pos,
|
||||||
|
align_alpha_composite,
|
||||||
|
VerticalAnchor,
|
||||||
|
HorizontalAnchor,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def build_action_icons(ctx: AdvancedContext) -> None:
|
||||||
|
_build_image_properties_icon(ctx)
|
||||||
|
|
||||||
|
|
||||||
|
def _build_image_properties_icon(ctx: AdvancedContext) -> None:
|
||||||
|
art = ctx.load_temporary_artifact("image-jpeg.png")
|
||||||
|
|
||||||
|
info_mark = ctx.load_temporary_artifact("dialog-infomation.png")
|
||||||
|
resized_info_mark = info_mark.resize((500, 500), PIL.Image.Resampling.LANCZOS)
|
||||||
|
|
||||||
|
align_alpha_composite(
|
||||||
|
art,
|
||||||
|
resized_info_mark,
|
||||||
|
anchor_to_pos(art, HorizontalAnchor.Right, VerticalAnchor.Bottom),
|
||||||
|
anchor_to_pos(resized_info_mark, HorizontalAnchor.Right, VerticalAnchor.Bottom),
|
||||||
|
)
|
||||||
|
|
||||||
|
# save artifact
|
||||||
|
ctx.save_fd_artifact(art, FdContext.Actions, "image-properties")
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
from ..assemblicon.context import AdvancedContext
|
from ..assemblicon.context import AdvancedContext
|
||||||
from .action_icons import build_action_icons
|
from .action_icons import build_action_icons
|
||||||
|
from .status_icons import build_status_icons
|
||||||
|
|
||||||
|
|
||||||
def build_standard_icons(ctx: AdvancedContext) -> None:
|
def build_standard_icons(ctx: AdvancedContext) -> None:
|
||||||
build_action_icons(ctx)
|
build_action_icons(ctx)
|
||||||
|
build_status_icons(ctx)
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
from ..assemblicon.context import AdvancedContext, FdContext
|
||||||
|
|
||||||
|
|
||||||
|
def build_status_icons(ctx: AdvancedContext) -> None:
|
||||||
|
_build_dialog_icons(ctx)
|
||||||
|
|
||||||
|
|
||||||
|
def _build_dialog_icons(ctx: AdvancedContext) -> None:
|
||||||
|
# save dialog icon with FreeDesktop icon and temp icon for reuse.
|
||||||
|
art = ctx.render_svg_then_load(
|
||||||
|
ctx.input_artifact("dialog-infomation.svg"),
|
||||||
|
ctx.temporary_artifact("dialog-infomation.png"),
|
||||||
|
)
|
||||||
|
with art:
|
||||||
|
ctx.save_fd_artifact(art, FdContext.Status, "dialog-infomation")
|
||||||
|
|
||||||
|
art = ctx.render_svg_then_load(
|
||||||
|
ctx.input_artifact("dialog-warning.svg"),
|
||||||
|
ctx.temporary_artifact("dialog-warning.png"),
|
||||||
|
)
|
||||||
|
with art:
|
||||||
|
ctx.save_fd_artifact(art, FdContext.Status, "dialog-warning")
|
||||||
|
|
||||||
|
art = ctx.render_svg_then_load(
|
||||||
|
ctx.input_artifact("dialog-error.svg"),
|
||||||
|
ctx.temporary_artifact("dialog-error.png"),
|
||||||
|
)
|
||||||
|
with art:
|
||||||
|
ctx.save_fd_artifact(art, FdContext.Status, "dialog-error")
|
||||||
Reference in New Issue
Block a user