@@ -291,7 +291,8 @@ def _create_param_widgets(self, data, parent_layout, prefix=""):
291291 # 跳过这些选项,因为已经用下拉框替代或不需要在UI中显示
292292 # realcugan_model 将通过 upscale_ratio 动态下拉框处理
293293 # batch_concurrent 并发处理已隐藏
294- if full_key in ["cli.load_text" , "cli.template" , "cli.generate_and_export" , "cli.colorize_only" , "cli.upscale_only" , "upscale.realcugan_model" , "cli.batch_concurrent" ]:
294+ # gimp_font 已废弃,使用 font_path 代替
295+ if full_key in ["cli.load_text" , "cli.template" , "cli.generate_and_export" , "cli.colorize_only" , "cli.upscale_only" , "upscale.realcugan_model" , "cli.batch_concurrent" , "render.gimp_font" ]:
295296 continue
296297
297298 label_text = key
@@ -349,7 +350,29 @@ def showPopup(self):
349350 container = QWidget ()
350351 hbox = QHBoxLayout (container )
351352 hbox .setContentsMargins (0 , 0 , 0 , 0 )
352- combo = QComboBox ()
353+
354+ # 创建自定义ComboBox,在下拉时刷新提示词列表
355+ class RefreshablePromptComboBox (QComboBox ):
356+ def __init__ (self , controller_ref , parent = None ):
357+ super ().__init__ (parent )
358+ self .controller_ref = controller_ref
359+
360+ def showPopup (self ):
361+ current_text = self .currentText ()
362+ self .clear ()
363+ prompt_files = self .controller_ref .get_hq_prompt_options ()
364+ if prompt_files :
365+ self .addItems (prompt_files )
366+ # 恢复之前选择的值
367+ if current_text :
368+ index = self .findText (current_text )
369+ if index >= 0 :
370+ self .setCurrentIndex (index )
371+ else :
372+ self .setCurrentText (current_text )
373+ super ().showPopup ()
374+
375+ combo = RefreshablePromptComboBox (self .controller )
353376 prompt_files = self .controller .get_hq_prompt_options ()
354377 if prompt_files :
355378 combo .addItems (prompt_files )
0 commit comments