          for iteration in range(1, self._args.iterations + 1):
              logger.trace("Training iteration: %s", iteration)  # type:ignore
              save_iteration = iteration % self._args.save_interval == 0 or iteration == 1
  
              if self._preview.should_toggle_mask():
                  trainer.toggle_mask()
                  self._preview.request_refresh()
  
              if self._preview.should_refresh():
                  viewer = display_func
 
</s> remove                 self._preview.request_refresh()
 </s> add                 update_preview_images = True </s> remove             if self._preview.should_refresh():
 </s> add             if self._preview.should_refresh or gui_triggers["refresh"] or update_preview_images: </s> remove 
 </s> add                 retval[trigger] = True
            if self._preview.should_toggle_mask or gui_triggers["mask"]:
          for iteration in range(1, self._args.iterations + 1):
              logger.trace("Training iteration: %s", iteration)  # type:ignore
              save_iteration = iteration % self._args.save_interval == 0 or iteration == 1
  
            if self._preview.should_toggle_mask or gui_triggers["mask"]:
                  trainer.toggle_mask()
                  self._preview.request_refresh()
  
              if self._preview.should_refresh():
                  viewer = display_func
keep keep keep keep replace keep keep keep keep keep
 Training - Use custom preview pop-out 
scripts/train.py