          return retval
  
      def should_refresh(self) -> bool:
          """ bool: Check whether the preview should be updated and return the value. If ``True`` is
          returned then resets the refresh trigger back to ``False`` """
          if not self._active:
 
</s> remove         """ Check whether the preview should be updated and return the value. If ``True`` is
        returned then resets the refresh trigger back to ``False``

        Returns
        -------
        bool
            ``True`` if the preview should be refreshed otherwise ``False``. """
        with self._lock:
            retval = self._triggers["refresh"]
            if retval:
                logger.debug("Sending should refresh")
                self._triggers["refresh"] = False
            return retval
 </s> add         """ bool: Check whether the preview should be updated and return the value. If ``True`` is
        returned then resets the refresh trigger back to ``False`` """
        if not self._active:
            return False
        retval = self._triggers["refresh"].is_set()
        if retval:
            logger.debug("Sending should refresh")
            self._triggers["refresh"].clear()
        return retval </s> remove         """ Check whether the mask should be toggled and return the value. If ``True`` is returned
        then resets mask toggle back to ``False``

        Returns
        -------
        bool
            ``True`` if the mask should be toggled otherwise ``False``. """
        with self._lock:
            retval = self._triggers["toggle_mask"]
            if retval:
                logger.debug("Sending toggle mask")
                self._triggers["toggle_mask"] = False
 </s> add         """ bool: Check whether the mask should be toggled and return the value. If ``True`` is
        returned then resets mask toggle back to ``False`` """
        if not self._active:
            return False
        retval = self._triggers["toggle_mask"].is_set()
        if retval:
            logger.debug("Sending toggle mask")
            self._triggers["toggle_mask"].clear() </s> remove         """ Check whether a save request has been made. If ``True`` is returned then :attr:`_save`
        is set back to ``False``

        Returns
        -------
        bool
            ``True`` if a save has been requested otherwise ``False``. """
        with self._lock:
            retval = self._triggers["save"]
            if retval:
                logger.debug("Sending should save")
                self._triggers["save"] = False
 </s> add         """ bool: Check whether a save request has been made. If ``True`` is returned then save
        trigger is set back to ``False`` """
        if not self._active:
            return False
        retval = self._triggers["save"].is_set()
        if retval:
            logger.debug("Sending should save")
            self._triggers["save"].clear() </s> remove class Preview():
    """ Holds the pop up preview window and options relating to the preview in the window and the
    GUI. Thread safe to take requests from the main thread and the training thread. """
    def __init__(self) -> None:
        self._lock = Lock()
        self._dpi: float = 0.0
        self._triggers: Dict[str, bool] = dict(toggle_mask=False,
                                               full_size=False,
                                               refresh=False,
                                               save=False,
                                               quit=False)
        self._needs_update: bool = False
        self._preview_buffer: Dict[str, np.ndarray] = {}
        self._images: Dict[str, Tuple[figure.Figure, Tuple[float, float]]] = {}
        self._resize_ids: List[Tuple[figure.Figure, int]] = []
        self._callbacks = dict(f="full_size",
                               m="toggle_mask",
                               r="refresh",
                               s="save",
                               enter="quit")
        self._configure_matplotlib()

    def _toggle_size(self) -> None:  # pylint:disable=unused-argument
        """ Toggle between actual size and screen-fit size. """
        self._triggers["full_size"] = not self._triggers["full_size"]
        self._set_resize_callback()

    @classmethod
    def _configure_matplotlib(cls):
        """ Remove `F`, 'S' and 'R' from their default bindings and stop Matplotlib from stealing
        focus """
        rcParams["keymap.fullscreen"] = [k for k in rcParams["keymap.fullscreen"] if k != "f"]
        rcParams["keymap.save"] = [k for k in rcParams["keymap.save"] if k != "s"]
        rcParams["keymap.home"] = [k for k in rcParams["keymap.home"] if k != "r"]
        rcParams["figure.raise_window"] = False
 </s> add class PreviewInterface():
    """ Run the preview window in a thread and interface with it
    @property
          return retval
  
    @property
      def should_refresh(self) -> bool:
          """ bool: Check whether the preview should be updated and return the value. If ``True`` is
          returned then resets the refresh trigger back to ``False`` """
          if not self._active:
keep add keep keep keep keep
 Training - Use custom preview pop-out 
scripts/train.py