feat: template delete, whole-reset relocation, and compact param/export rows
- Template delete: add a 删除 button (reuses template_service.delete_template) with a confirm dialog; hidden for built-ins like 保存; reloads and re-selects the first built-in after deletion, persisting the new selection. - Whole reset: move the template-wide reset out of the template area to the bottom of the transform panel and rename it to 位置尺寸旋转重置为当前模板, so it sits with the params it resets, beside the three per-section resets. - Compact layout: pair X/Y and 宽/高 onto single rows (short labels), and put the export 格式/质量 selectors on one row. Sync logic unchanged. Docs: PRD 6.6, UI design 7.1/7.2/7.3/7.4/7.5/10, tasks.md 17.4/17.5/17.6. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -277,6 +277,8 @@ class MainWindow(QMainWindow):
|
||||
self.transform_panel.reset_position.connect(lambda: self._reset_aspect("pos"))
|
||||
self.transform_panel.reset_size.connect(lambda: self._reset_aspect("size"))
|
||||
self.transform_panel.reset_rotation.connect(lambda: self._reset_aspect("rot"))
|
||||
# Whole reset: restore position + size + rotation to the selected template
|
||||
self.transform_panel.reset_all.connect(self._reset_all_to_template)
|
||||
|
||||
# ── Template panel ─────────────────────────────────────────────────
|
||||
# Template selection updates canvas, param panel, and queue template
|
||||
@@ -403,6 +405,18 @@ class MainWindow(QMainWindow):
|
||||
new.rotation = tpl.rotation
|
||||
self._apply_preview_transform(new)
|
||||
|
||||
def _reset_all_to_template(self):
|
||||
"""Restore position + size + rotation to the selected template at once."""
|
||||
tpl = self.template_panel.current_template_state()
|
||||
cur = self.image_canvas.get_transform()
|
||||
if tpl is None or cur is None:
|
||||
return
|
||||
new = TransformState(
|
||||
x=tpl.x, y=tpl.y, width=tpl.width, height=tpl.height,
|
||||
rotation=tpl.rotation, keep_aspect_ratio=cur.keep_aspect_ratio,
|
||||
)
|
||||
self._apply_preview_transform(new)
|
||||
|
||||
def _apply_preview_transform(self, state):
|
||||
"""Push a transform to the canvas + panels as if it were a user edit."""
|
||||
self.image_canvas.set_transform(state)
|
||||
|
||||
Reference in New Issue
Block a user