feat: 原创「环序」标志;双视图与侧栏优化;工位管理;帮助完善
- 原创应用标志「环序/Cycle-Step」:tools/gen-icon.py 重写 + 工具栏 Logo 同源,小尺寸简化版 - 条形时序视图:标题/副标题精简、双刻度值置于分区与刻度线之间、时间默认内嵌、依赖线箭头收窄、同泳道箭头接色块外侧、图注自动避让 - 圆周时序视图:去掉色块描边、环宽与间隙优化、度数外侧标时间、方向箭头外移;固定顺时针(移除逆时针) - 左侧栏:编辑工位/编辑相位分区入口;双击画布色块或动作行进入编辑;至少保留一个动作/泳道 - 右侧栏:移除重复的编辑操作、导出与单位卡片;文件浏览器新增「桌面」快捷入口 - AI 对话框:字号优化并新增「编辑示例」;节拍统计移除无依据的预估产能 - 文档:README 与 docs/HELP.md 全面更新;dist 同步重建
This commit is contained in:
+87
-55
@@ -1,11 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate the Sequence Diagram Studio application icon.
|
||||
|
||||
A clock / cycle dial that reflects the product spirit: one turn = one cycle,
|
||||
12 o'clock origin, clockwise phase progression.
|
||||
Original mark, designed for this product ("Cycle-Step" / 环序):
|
||||
|
||||
Design note: the badge uses a **bright cyan→violet gradient** with a **white
|
||||
clock** so the icon stays legible on both light and dark taskbars.
|
||||
1. A rounded square tile with a deep navy gradient — a neutral stage that
|
||||
stays legible on both light and dark Windows taskbars.
|
||||
2. A **gapped ring**: one turn = one cycle = 360 deg; the gap at the top
|
||||
marks the 0 deg origin (12 o'clock).
|
||||
3. A **step-function polyline**: the sequence of actions advancing in time
|
||||
(a timing/step chart, which is exactly what this tool draws).
|
||||
4. An **origin dot** sitting in the ring gap, plus a terminal node dot.
|
||||
|
||||
Everything is composed from primitive geometry (ring, polyline, circles) and
|
||||
does not reproduce, trace, or approximate any existing brand mark.
|
||||
|
||||
Outputs:
|
||||
windows/runner/resources/app_icon.ico (multi-size, for the Windows build)
|
||||
@@ -21,18 +28,29 @@ OUT_ICO = os.path.join(ROOT, "windows", "runner", "resources", "app_icon.ico")
|
||||
OUT_PNG = os.path.join(ROOT, "demo", "app-icon.png")
|
||||
|
||||
S = 1024
|
||||
BG_TOP = (76, 201, 240, 255) # #4CC9F0 cyan
|
||||
BG_BOT = (124, 92, 255, 255) # #7C5CFF violet
|
||||
WHITE = (255, 255, 255, 255)
|
||||
WHITE_SOFT = (255, 255, 255, 170)
|
||||
NAVY = (11, 16, 24, 255) # #0B1018
|
||||
EDGE = (255, 255, 255, 90)
|
||||
INSET = 56 # transparent margin around the tile
|
||||
TILE = S - 2 * INSET
|
||||
|
||||
TILE_TOP = (24, 33, 61, 255) # #18213D
|
||||
TILE_BOT = (12, 18, 38, 255) # #0C1226
|
||||
EDGE = (255, 255, 255, 38)
|
||||
RING = (76, 201, 240, 255) # #4CC9F0 accent cyan
|
||||
STEP = (255, 209, 102, 255) # #FFD166 amber
|
||||
ORIGIN = (255, 255, 255, 255)
|
||||
END = (52, 211, 153, 255) # #34D399
|
||||
|
||||
CX = CY = S // 2
|
||||
|
||||
|
||||
def lerp(a, b, t):
|
||||
return tuple(round(a[i] + (b[i] - a[i]) * t) for i in range(4))
|
||||
|
||||
|
||||
def polar(cx, cy, r, deg):
|
||||
t = math.radians(deg - 90)
|
||||
return (cx + r * math.cos(t), cy + r * math.sin(t))
|
||||
|
||||
|
||||
def rounded_mask(size, radius, inset=0):
|
||||
m = Image.new("L", (size, size), 0)
|
||||
d = ImageDraw.Draw(m)
|
||||
@@ -44,76 +62,90 @@ def rounded_mask(size, radius, inset=0):
|
||||
return m
|
||||
|
||||
|
||||
def polar(cx, cy, r, deg):
|
||||
t = math.radians(deg - 90)
|
||||
return (cx + r * math.cos(t), cy + r * math.sin(t))
|
||||
def draw_ring(img, r_ring, ring_w, gap_deg, color):
|
||||
"""Draw a circular arc with a gap centred at 12 o'clock and round caps."""
|
||||
outer = r_ring + ring_w / 2
|
||||
inner = r_ring - ring_w / 2
|
||||
mask = Image.new("L", (S, S), 0)
|
||||
md = ImageDraw.Draw(mask)
|
||||
md.ellipse([CX - outer, CY - outer, CX + outer, CY + outer], fill=255)
|
||||
md.ellipse([CX - inner, CY - inner, CX + inner, CY + inner], fill=0)
|
||||
# Cut the gap wedge (centred on the top, i.e. -90 deg).
|
||||
a0 = polar(CX, CY, outer + 8, -90 - gap_deg / 2)
|
||||
a1 = polar(CX, CY, outer + 8, -90 + gap_deg / 2)
|
||||
md.polygon([(CX, CY), a0, a1], fill=0)
|
||||
# Round caps at both arc ends.
|
||||
for deg in (-90 + gap_deg / 2, -90 - gap_deg / 2):
|
||||
p = polar(CX, CY, r_ring, deg)
|
||||
md.ellipse([p[0] - ring_w / 2, p[1] - ring_w / 2,
|
||||
p[0] + ring_w / 2, p[1] + ring_w / 2], fill=255)
|
||||
img.paste(color, (0, 0), mask)
|
||||
|
||||
|
||||
def build_master():
|
||||
def draw_steps(img, pts, width, color):
|
||||
"""Draw a step polyline with rounded joins and caps."""
|
||||
d = ImageDraw.Draw(img)
|
||||
d.line(pts, fill=color, width=width, joint="curve")
|
||||
for p in pts:
|
||||
d.ellipse([p[0] - width / 2, p[1] - width / 2,
|
||||
p[0] + width / 2, p[1] + width / 2], fill=color)
|
||||
|
||||
|
||||
def build_master(simplified=False):
|
||||
img = Image.new("RGBA", (S, S), (0, 0, 0, 0))
|
||||
|
||||
# Bright gradient body.
|
||||
# --- tile with a vertical navy gradient ---
|
||||
body = Image.new("RGBA", (S, S), (0, 0, 0, 0))
|
||||
bd = ImageDraw.Draw(body)
|
||||
for y in range(S):
|
||||
bd.line([(0, y), (S, y)], fill=lerp(BG_TOP, BG_BOT, y / (S - 1)))
|
||||
mask = rounded_mask(S, 210, inset=48)
|
||||
img.paste(body, (0, 0), mask)
|
||||
|
||||
draw = ImageDraw.Draw(img)
|
||||
# Subtle inner edge to separate from the taskbar.
|
||||
draw.rounded_rectangle(
|
||||
[48, 48, S - 1 - 48, S - 1 - 48],
|
||||
radius=210,
|
||||
bd.line([(0, y), (S, y)], fill=lerp(TILE_TOP, TILE_BOT, y / (S - 1)))
|
||||
img.paste(body, (0, 0), rounded_mask(S, int(0.27 * TILE), inset=INSET))
|
||||
ImageDraw.Draw(img).rounded_rectangle(
|
||||
[INSET, INSET, S - 1 - INSET, S - 1 - INSET],
|
||||
radius=int(0.27 * TILE),
|
||||
outline=EDGE,
|
||||
width=5,
|
||||
)
|
||||
|
||||
cx = cy = S // 2
|
||||
r_ring = 300
|
||||
ring_w = 40
|
||||
# --- mark ---
|
||||
r_ring = 0.293 * TILE
|
||||
ring_w = (0.085 if simplified else 0.062) * TILE
|
||||
draw_ring(img, r_ring, ring_w, 68, RING)
|
||||
|
||||
# White outer ring (the cycle).
|
||||
draw.ellipse(
|
||||
[cx - r_ring - ring_w // 2, cy - r_ring - ring_w // 2,
|
||||
cx + r_ring + ring_w // 2, cy + r_ring + ring_w // 2],
|
||||
outline=WHITE,
|
||||
width=ring_w,
|
||||
)
|
||||
# origin dot in the ring gap (0 deg / 12 o'clock)
|
||||
d = ImageDraw.Draw(img)
|
||||
od = (0.050 if simplified else 0.042) * TILE
|
||||
op = (CX, CY - r_ring)
|
||||
d.ellipse([op[0] - od, op[1] - od, op[0] + od, op[1] + od], fill=ORIGIN)
|
||||
|
||||
# 12 tick marks; 12/3/6/9 are longer and thicker.
|
||||
for d in range(0, 360, 30):
|
||||
major = d % 90 == 0
|
||||
r1 = r_ring - 96
|
||||
r2 = r_ring - (52 if major else 74)
|
||||
draw.line(
|
||||
[polar(cx, cy, r1, d), polar(cx, cy, r2, d)],
|
||||
fill=WHITE if major else WHITE_SOFT,
|
||||
width=16 if major else 9,
|
||||
)
|
||||
# step-function polyline (sequence of actions)
|
||||
sw = (0.085 if simplified else 0.057) * TILE
|
||||
p1 = (CX - 0.146 * TILE, CY + 0.088 * TILE)
|
||||
p2 = (CX - 0.010 * TILE, CY + 0.088 * TILE)
|
||||
p3 = (CX - 0.010 * TILE, CY - 0.059 * TILE)
|
||||
p4 = (CX + 0.166 * TILE, CY - 0.059 * TILE)
|
||||
draw_steps(img, [p1, p2, p3, p4], int(sw), STEP)
|
||||
|
||||
# Clock hands: classic 10:10 pose, navy for contrast on white.
|
||||
for r, deg, col, w in ((170, 305, NAVY, 34), (240, 55, NAVY, 26)):
|
||||
hx, hy = polar(cx, cy, r, deg)
|
||||
draw.line([(cx, cy), (hx, hy)], fill=col, width=w)
|
||||
draw.ellipse([hx - w / 2, hy - w / 2, hx + w / 2, hy + w / 2], fill=col)
|
||||
|
||||
# Hub.
|
||||
draw.ellipse([cx - 30, cy - 30, cx + 30, cy + 30], fill=NAVY)
|
||||
draw.ellipse([cx - 12, cy - 12, cx + 12, cy + 12], fill=WHITE)
|
||||
# terminal node dot
|
||||
ed = (0.050 if simplified else 0.037) * TILE
|
||||
d.ellipse([p4[0] - ed, p4[1] - ed, p4[0] + ed, p4[1] + ed], fill=END)
|
||||
|
||||
return img
|
||||
|
||||
|
||||
def main():
|
||||
master = build_master()
|
||||
master = build_master(False)
|
||||
small = build_master(True)
|
||||
os.makedirs(os.path.dirname(OUT_ICO), exist_ok=True)
|
||||
os.makedirs(os.path.dirname(OUT_PNG), exist_ok=True)
|
||||
|
||||
master.save(OUT_PNG)
|
||||
|
||||
sizes = [256, 128, 64, 48, 32, 24, 16]
|
||||
frames = [master.resize((s, s), Image.LANCZOS) for s in sizes]
|
||||
frames = []
|
||||
for s in sizes:
|
||||
src = small if s <= 32 else master
|
||||
frames.append(src.resize((s, s), Image.LANCZOS))
|
||||
frames[0].save(
|
||||
OUT_ICO,
|
||||
format="ICO",
|
||||
|
||||
Reference in New Issue
Block a user