feat: thumbnail grid, aspect-aware templates, and UI hierarchy polish
Material list: - Switch asset list from one-per-row to a wrapping thumbnail grid (IconMode cards: thumbnail + corner checkbox + elided name, subfolder moved to tooltip). Templates: - Template.to_transform_state now contains-fits the print inside the target box by the print's native aspect ratio (no stretch); falls back to the box when print size is unknown. - Feed print native size into template_panel for aspect-aware fitting. - Shrink built-in template boxes to realistic print proportions. UI hierarchy: - Promote 打开文件夹 buttons to primary (filled accent). - Add inline 归零 (reset angle) and a 重置位置/尺寸/角度 button to the transform panel; wire it to re-apply the selected template. - Hide 保存 for built-in templates instead of leaving it greyed. Docs: record template box/contain behavior (PRD) and the grid layout, button hierarchy, and reset/save-visibility rules (UI design). Tests: add 3 aspect-fit cases for to_transform_state. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+13
-1
@@ -269,6 +269,9 @@ class MainWindow(QMainWindow):
|
||||
self.image_canvas.transform_changed.connect(self._on_transform_changed)
|
||||
self.transform_panel.transform_changed.connect(self._on_transform_changed)
|
||||
|
||||
# Reset position/size/angle back to the selected template
|
||||
self.transform_panel.reset_to_template.connect(self.template_panel._reset_to_template)
|
||||
|
||||
# ── Template panel ─────────────────────────────────────────────────
|
||||
# Template selection updates canvas, param panel, and queue template
|
||||
self.template_panel.template_applied.connect(self.image_canvas.set_transform)
|
||||
@@ -305,6 +308,13 @@ class MainWindow(QMainWindow):
|
||||
path = str(asset.path)
|
||||
self.image_canvas.load_print(path)
|
||||
self.export_panel.set_print(path)
|
||||
# Tell template panel the print dimensions for aspect-aware fitting
|
||||
try:
|
||||
from PIL import Image as _PilImage
|
||||
with _PilImage.open(path) as img:
|
||||
self.template_panel.set_print_size(img.width, img.height)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _on_queue_item_activated(self, item):
|
||||
"""Load a queue item into the canvas and arm fine-tune tracking."""
|
||||
@@ -321,11 +331,13 @@ class MainWindow(QMainWindow):
|
||||
if item.transform:
|
||||
self.image_canvas.set_transform(item.transform)
|
||||
self.transform_panel.set_transform(item.transform)
|
||||
# Keep template panel garment size in sync
|
||||
# Keep template panel garment and print size in sync
|
||||
try:
|
||||
from PIL import Image as _PilImage
|
||||
with _PilImage.open(garment_path) as img:
|
||||
self.template_panel.set_garment_size(img.width, img.height)
|
||||
with _PilImage.open(print_path) as img:
|
||||
self.template_panel.set_print_size(img.width, img.height)
|
||||
except Exception:
|
||||
pass
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user