              if self._stop:
                  logger.debug("Stop received. Terminating")
                  break
  
              if self._toggle_preview_mask:
                  trainer.toggle_mask()
                  self._toggle_preview_mask = False
  
              if self._refresh_preview and viewer is not None:
                  if self._args.redirect_gui:
                      print("\n")
                      logger.info("[Preview Updated]")
                      if os.path.isfile(self._gui_preview_trigger):
 
</s> remove                 if self._args.redirect_gui:
 </s> add                 if self._args.redirect_gui:  # Remove any gui trigger files following an update </s> remove                     if os.path.isfile(self._gui_preview_trigger):
                        logger.debug("Removing gui trigger file: %s", self._gui_preview_trigger)
                        os.remove(self._gui_preview_trigger)
 </s> add                     for filename in self._gui_triggers.values():
                        if os.path.isfile(filename):
                            logger.debug("Removing gui trigger file: %s", filename)
                            os.remove(filename)
 </s> remove                     if not preview_trigger_set and os.path.isfile(self._gui_preview_trigger):
 </s> add                     if os.path.isfile(self._gui_triggers["mask_toggle"]):
                        self._toggle_preview_mask = True

                    if not preview_trigger_set and os.path.isfile(self._gui_triggers["update"]): </s> remove                 if is_preview and cv_key == ord("t"):
 </s> add                 if is_preview and cv_key == ord("m"):
              if self._stop:
                  logger.debug("Stop received. Terminating")
                  break
  




              if self._refresh_preview and viewer is not None:
                  if self._args.redirect_gui:
                      print("\n")
                      logger.info("[Preview Updated]")
                      if os.path.isfile(self._gui_preview_trigger):
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Updates
  - Change shortcut key to M
  - Slight optimizations
  - GUI support for mask toggling 
scripts/train.py