  
  class PreviewTrain(DisplayOptionalPage):  # pylint: disable=too-many-ancestors
      """ Training preview image(s) """
      def __init__(self, *args, **kwargs) -> None:
          self.update_preview = get_config().tk_vars.update_preview
          super().__init__(*args, **kwargs)
  
      def add_options(self) -> None:
          """ Add the additional options """
          self._add_option_refresh()
 
</s> remove         get_images().previewoutput[0].save(filename)
        logger.debug("Saved preview to %s", filename)
 </s> add         self._preview.save(filename) </s> remove     @classmethod
    def _output_helptext(cls) -> None:
 </s> add     @property
    def master_frame(self) -> tk.Frame:
        """ :class:`tkinter.Frame`: The master frame that holds the preview window """
        return self._master_frame

    def pack(self, *args, **kwargs):
        """ Redirect calls to pack the widget to pack the actual :attr:`_master_frame`.

        Takes standard :class:`tkinter.Frame` pack arguments
        """
        logger.debug("Packing master frame: (args: %s, kwargs: %s)", args, kwargs)
        self._master_frame.pack(*args, **kwargs)

    def save(self, location: str) -> None:
        """ Save action to be performed when save button pressed from the GUI.

        location: str
            Full path to the folder to save the preview image to
        """
        self._image.save_preview(location)

    def remove_option_controls(self) -> None:
        """ Remove the taskbar options controls when the preview is disabled in the GUI """
        self._taskbar.destroy_widgets()

    def _output_helptext(self) -> None: </s> remove         Parameters
        ----------
        event: :class:`tkinter.Event`
            The resize event object
        """
        logger.trace("Resizing preview image")  # type:ignore
        framesize: Optional[Tuple[int, int]] = (event.width, event.height)
        # Sometimes image is resized before frame is drawn
        framesize = None if framesize == (1, 1) else framesize
        get_images().resize_image(self.name, framesize)
        self.reload()

    def reload(self) -> None:
        """ Reload the preview image """
        logger.trace("Reloading preview image")  # type:ignore
        self.previewimage = get_images().previewtrain[self.name][1]
        self.canvas.itemconfig(self.imgcanvas, image=self.previewimage)

    def save_preview(self, location: str) -> None:
        """ Save the figure to file.

        Parameters
        ----------
        location: str
            The full path to the location to save the preview image
        """
        filename = self.name
        now = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
        filename = os.path.join(location, f"{filename}_{now}.png")
        cast("Image.Image", get_images().previewtrain[self.name][0]).save(filename)
        logger.debug("Saved preview to %s", filename)
        print(f"Saved preview to {filename}")
 </s> add         self._display.save(location)
        logger.debug("Initializing %s (args: %s, kwargs: %s)",
                     self.__class__.__name__, args, kwargs)
        self._preview = get_images().preview_train
        self._display: Optional[PreviewTk] = None
  
  class PreviewTrain(DisplayOptionalPage):  # pylint: disable=too-many-ancestors
      """ Training preview image(s) """
      def __init__(self, *args, **kwargs) -> None:
        logger.debug("Initializing %s (args: %s, kwargs: %s)",
                     self.__class__.__name__, args, kwargs)
        self._preview = get_images().preview_train
        self._display: Optional[PreviewTk] = None
          super().__init__(*args, **kwargs)
  
      def add_options(self) -> None:
          """ Add the additional options """
          self._add_option_refresh()
keep keep keep keep replace keep keep keep keep keep
 GUI - Preview updates
  - Training preview. Embed preview pop-out window
  - Bugfix - convert/extract previews 
lib/gui/display_command.py