页面ui更新
This commit is contained in:
parent
fcc43390c6
commit
57b8a035b8
|
|
@ -9,7 +9,7 @@
|
||||||
├ 左:识别图 + 已点清单 ─────┬─ 右:绿提示 + 大预览 ─┤
|
├ 左:识别图 + 已点清单 ─────┬─ 右:绿提示 + 大预览 ─┤
|
||||||
│ 识别整图 / 菜名 / 数量 │ │ 流畅预览 + 识别框叠加 │
|
│ 识别整图 / 菜名 / 数量 │ │ 流畅预览 + 识别框叠加 │
|
||||||
├──────────────────────────┴───────────────────────┤
|
├──────────────────────────┴───────────────────────┤
|
||||||
│ 底栏:暂停/继续扫描|选图识别|清空|设置 │
|
│ 底栏:暂停/继续扫描|选图识别|清空|待学习库 │
|
||||||
└──────────────────────────────────────────────────┘
|
└──────────────────────────────────────────────────┘
|
||||||
|
|
||||||
预览约 25fps 刷帧;识别按「动→静保持」触发一次,框叠在实时画面上。
|
预览约 25fps 刷帧;识别按「动→静保持」触发一次,框叠在实时画面上。
|
||||||
|
|
@ -1393,21 +1393,13 @@ class BaseDishApp(PendingLearningUIMixin):
|
||||||
panel = tk.Frame(parent, bg=c["surface"], highlightbackground=c["border"], highlightthickness=1)
|
panel = tk.Frame(parent, bg=c["surface"], highlightbackground=c["border"], highlightthickness=1)
|
||||||
panel.pack(fill=tk.BOTH, expand=True)
|
panel.pack(fill=tk.BOTH, expand=True)
|
||||||
|
|
||||||
head = tk.Frame(panel, bg=c["surface"])
|
# 识别整图:放在清单上方(去掉「已点菜品」标题栏,把空间留给预览)
|
||||||
head.pack(fill=tk.X, padx=12, pady=(12, 8))
|
|
||||||
tk.Label(head, text="已点菜品", bg=c["surface"], fg=c["text"],
|
|
||||||
font=FONTS["h1"]).pack(side=tk.LEFT)
|
|
||||||
self.cart_count_label = tk.Label(head, text="0 项", bg=c["surface"], fg=c["muted"],
|
|
||||||
font=FONTS["small"])
|
|
||||||
self.cart_count_label.pack(side=tk.RIGHT)
|
|
||||||
|
|
||||||
# 识别整图:放在清单上方空白区
|
|
||||||
img_wrap = tk.Frame(
|
img_wrap = tk.Frame(
|
||||||
panel, bg=c["pos_row_alt"],
|
panel, bg=c["pos_row_alt"],
|
||||||
highlightbackground=c["border"], highlightthickness=1,
|
highlightbackground=c["border"], highlightthickness=1,
|
||||||
height=168,
|
height=220,
|
||||||
)
|
)
|
||||||
img_wrap.pack(fill=tk.X, padx=8, pady=(0, 8))
|
img_wrap.pack(fill=tk.X, padx=8, pady=(8, 8))
|
||||||
img_wrap.pack_propagate(False)
|
img_wrap.pack_propagate(False)
|
||||||
self.cart_result_label = tk.Label(
|
self.cart_result_label = tk.Label(
|
||||||
img_wrap,
|
img_wrap,
|
||||||
|
|
@ -1431,10 +1423,9 @@ class BaseDishApp(PendingLearningUIMixin):
|
||||||
tk.Label(cols, text=text, bg=c["pos_row_alt"], fg=c["muted"],
|
tk.Label(cols, text=text, bg=c["pos_row_alt"], fg=c["muted"],
|
||||||
font=FONTS["small"], width=w, anchor="w").pack(side=tk.LEFT, padx=4, pady=6)
|
font=FONTS["small"], width=w, anchor="w").pack(side=tk.LEFT, padx=4, pady=6)
|
||||||
|
|
||||||
# 已点清单禁止滑动(内容直接铺开,不出现滚动条)
|
# 已点清单可滚动:菜品多时下滑查看
|
||||||
self._cart_canvas = None
|
wrap, self.cart_frame, self._cart_canvas = self._make_scroll_area(panel, c["surface"])
|
||||||
self.cart_frame = tk.Frame(panel, bg=c["surface"])
|
wrap.pack(fill=tk.BOTH, expand=True, padx=4, pady=4)
|
||||||
self.cart_frame.pack(fill=tk.BOTH, expand=True, padx=4, pady=4)
|
|
||||||
return panel
|
return panel
|
||||||
|
|
||||||
def _build_pos_preview(self, parent, c):
|
def _build_pos_preview(self, parent, c):
|
||||||
|
|
@ -1584,8 +1575,7 @@ class BaseDishApp(PendingLearningUIMixin):
|
||||||
command=self.clear_cart).pack(side=tk.LEFT, padx=(0, 10))
|
command=self.clear_cart).pack(side=tk.LEFT, padx=(0, 10))
|
||||||
self.setup_pending_learning_ui(inner, side=tk.LEFT, fill=tk.NONE, expand=False,
|
self.setup_pending_learning_ui(inner, side=tk.LEFT, fill=tk.NONE, expand=False,
|
||||||
padx=(0, 10), pady=0)
|
padx=(0, 10), pady=0)
|
||||||
PillButton(inner, text="设置", variant="secondary",
|
# 设置入口仅保留顶栏,避免底栏重复
|
||||||
command=self.show_settings_dialog).pack(side=tk.RIGHT)
|
|
||||||
# 相机状态同步需要该属性;真正学菜按钮在设置页创建
|
# 相机状态同步需要该属性;真正学菜按钮在设置页创建
|
||||||
self.camera_add_btn = self.camera_btn
|
self.camera_add_btn = self.camera_btn
|
||||||
self._refresh_record_btn()
|
self._refresh_record_btn()
|
||||||
|
|
@ -3305,6 +3295,13 @@ class BaseDishApp(PendingLearningUIMixin):
|
||||||
|
|
||||||
if hasattr(self, "cart_count_label"):
|
if hasattr(self, "cart_count_label"):
|
||||||
self.cart_count_label.config(text=f"{len(self._cart)} 项")
|
self.cart_count_label.config(text=f"{len(self._cart)} 项")
|
||||||
|
canvas = getattr(self, "_cart_canvas", None)
|
||||||
|
if canvas is not None:
|
||||||
|
try:
|
||||||
|
self.cart_frame.update_idletasks()
|
||||||
|
canvas.configure(scrollregion=canvas.bbox("all"))
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
def render_result_dock(self, dishes, labeled_path=None, frame_bgr=None):
|
def render_result_dock(self, dishes, labeled_path=None, frame_bgr=None):
|
||||||
"""识别结果写入购物车(含未知),并刷新左侧识别标注图。"""
|
"""识别结果写入购物车(含未知),并刷新左侧识别标注图。"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue