Hermes Bot commited on
Commit
478118a
·
1 Parent(s): f1bf63c

Fix gallery metadata handler to correctly extract path and add proper debug

Browse files
Files changed (1) hide show
  1. ui/events/run_handlers.py +4 -3
ui/events/run_handlers.py CHANGED
@@ -116,11 +116,11 @@ def create_run_event(prefix: str, task_type: str, ui_components: dict):
116
  )
117
  # When a user selects an image from the global Gallery tab, load its generation info
118
  def _show_meta(selected_path, *_):
119
- # `selected_path` may be a string (filepath) or a list of filepaths.
120
  try:
121
- # Normalise to a single path
122
  path = selected_path[0] if isinstance(selected_path, (list, tuple)) else selected_path
123
- print(f"[DEBUG] Gallery selected path: {path}")
124
  from PIL import Image
125
  with Image.open(path) as im:
126
  meta = im.info.get("parameters", "")
@@ -129,6 +129,7 @@ def create_run_event(prefix: str, task_type: str, ui_components: dict):
129
  meta = ""
130
  # If no metadata present, show a friendly placeholder.
131
  return meta if meta else "(ไม่มีข้อมูลเมตาดาต้า)"
 
132
  # Connect the select event of the global gallery to update its metadata textbox
133
  gallery_tab = ui_components.get('gallery')
134
  if gallery_tab:
 
116
  )
117
  # When a user selects an image from the global Gallery tab, load its generation info
118
  def _show_meta(selected_path, *_):
119
+ # `selected_path` may be a string (filepath) or a list/tuple of filepaths.
120
  try:
121
+ # Normalise to a single path (first element if it's a tuple/list)
122
  path = selected_path[0] if isinstance(selected_path, (list, tuple)) else selected_path
123
+ print(f"[DEBUG] Normalised gallery path: {path}")
124
  from PIL import Image
125
  with Image.open(path) as im:
126
  meta = im.info.get("parameters", "")
 
129
  meta = ""
130
  # If no metadata present, show a friendly placeholder.
131
  return meta if meta else "(ไม่มีข้อมูลเมตาดาต้า)"
132
+
133
  # Connect the select event of the global gallery to update its metadata textbox
134
  gallery_tab = ui_components.get('gallery')
135
  if gallery_tab: