              if self._preview.should_toggle_mask():
                  trainer.toggle_mask()
                  self._preview.request_refresh()
  
              if self._preview.should_refresh():
                  viewer = display_func
              else:
                  viewer = None
  
              timelapse = self._timelapse if save_iteration else {}
 
</s> remove                 self._preview.request_refresh()
 </s> add                 update_preview_images = True </s> remove             if self._preview.should_toggle_mask():
 </s> add             if self._preview.should_toggle_mask or gui_triggers["mask"]:
            if self._preview.should_refresh or gui_triggers["refresh"] or update_preview_images:
              if self._preview.should_toggle_mask():
                  trainer.toggle_mask()
                  self._preview.request_refresh()
  
            if self._preview.should_refresh or gui_triggers["refresh"] or update_preview_images:
                  viewer = display_func
              else:
                  viewer = None
  
              timelapse = self._timelapse if save_iteration else {}
keep keep keep keep replace keep keep keep keep keep
 Training - Use custom preview pop-out 
scripts/train.py