Tophness2022 commited on
Commit
bebcae1
·
1 Parent(s): ba35fb6

remove previous queue autosave if queue cleared

Browse files
Files changed (1) hide show
  1. wgp.py +10 -1
wgp.py CHANGED
@@ -700,6 +700,15 @@ def clear_queue_action(state):
700
  if aborted_current or cleared_pending:
701
  gen["prompts_max"] = 0
702
 
 
 
 
 
 
 
 
 
 
703
  if aborted_current and cleared_pending:
704
  gr.Info("Queue cleared and current generation aborted.")
705
  elif aborted_current:
@@ -3792,7 +3801,7 @@ def generate_video_tab(update_form = False, state_dict = None, ui_defaults = Non
3792
  inputs = [state, model_choice],
3793
  outputs=queue_df
3794
  ).then(
3795
- fn=lambda s: gr.Accordion(open=True) if len(get_gen_info(s).get("queue", [])) > 1 else gr.update(), # Expand if queue has items (len > 1 assumes placeholder)
3796
  inputs=[state],
3797
  outputs=[queue_accordion]
3798
  ).then(
 
700
  if aborted_current or cleared_pending:
701
  gen["prompts_max"] = 0
702
 
703
+ if cleared_pending:
704
+ try:
705
+ if os.path.isfile(AUTOSAVE_FILENAME):
706
+ os.remove(AUTOSAVE_FILENAME)
707
+ print(f"Clear Queue: Deleted autosave file '{AUTOSAVE_FILENAME}'.")
708
+ except OSError as e:
709
+ print(f"Clear Queue: Error deleting autosave file '{AUTOSAVE_FILENAME}': {e}")
710
+ gr.Warning(f"Could not delete the autosave file '{AUTOSAVE_FILENAME}'. You may need to remove it manually.")
711
+
712
  if aborted_current and cleared_pending:
713
  gr.Info("Queue cleared and current generation aborted.")
714
  elif aborted_current:
 
3801
  inputs = [state, model_choice],
3802
  outputs=queue_df
3803
  ).then(
3804
+ fn=lambda s: gr.Accordion(open=True) if len(get_gen_info(s).get("queue", [])) > 1 else gr.update(),
3805
  inputs=[state],
3806
  outputs=[queue_accordion]
3807
  ).then(