          self.display_item = get_images().previewtrain
  
      def display_item_process(self) -> None:
          """ Display the preview(s) resized as appropriate """
          logger.trace("Displaying preview")  # type:ignore
          sortednames = sorted(list(get_images().previewtrain.keys()))
          existing = self.subnotebook_get_titles_ids()
          should_update = self.update_preview.get()
  
          for name in sortednames:
              if name not in existing:
                  self.add_child(name)
              elif should_update:
                  tab_id = existing[name]
                  self.update_child(tab_id, name)
  
          if should_update:
              self.update_preview.set(False)
  
      def add_child(self, name: str) -> None:
          """ Add the preview canvas child
  
          Parameters
          ----------
          name: str
              The name of the notebook tab to add
          """
          logger.debug("Adding child")
          preview = PreviewTrainCanvas(self.subnotebook, name)
          preview = self.subnotebook_add_page(name, widget=preview)
          Tooltip(preview, text=self.helptext, wrap_length=200)
          self.vars["modified"].set(get_images().previewtrain[name][2])
  
      def update_child(self, tab_id: int, name: str) -> None:
          """ Update the preview canvas
  
          Parameters
          ----------
          tab_id: int
              The index of the tab to update
 
</s> remove         Parameters
        ----------
        tab_id: int
            The index of the tab to update
        name: str
            The name of the tab to update
        """
        logger.debug("Updating preview")
        if self.vars["modified"].get() != get_images().previewtrain[name][2]:
            self.vars["modified"].set(get_images().previewtrain[name][2])
            widget = self.subnotebook_page_from_id(tab_id)
            widget.reload()
 </s> add         logger.debug("Displaying preview")
        self._display = PreviewTk(self._preview.buffer, self.subnotebook, self.optsframe, None)
        self.subnotebook_add_page(self.tabname, widget=self._display.master_frame) </s> remove         get_images().load_training_preview()
        self.display_item = get_images().previewtrain
 </s> add         logger.debug("Preview loaded")
        self.display_item = True </s> remove         for preview in self.subnotebook.children.values():
            preview.save_preview(location)


class PreviewTrainCanvas(ttk.Frame):  # pylint: disable=too-many-ancestors
    """ Canvas to hold a training preview image

    Parameters
    ----------
    parent: :class:`tkinter.ttk.Notebook`
        The notebook that the training image canvas belongs to
    previewname: str
        The name of the preview image displayed in the canvas
    """
    def __init__(self, parent: ttk.Notebook, previewname: str) -> None:
        logger.debug("Initializing %s: (previewname: '%s')", self.__class__.__name__, previewname)
        ttk.Frame.__init__(self, parent)

        self.name = previewname
        get_images().resize_image(self.name, None)
        self.previewimage = get_images().previewtrain[self.name][1]

        self.canvas = tk.Canvas(self, bd=0, highlightthickness=0)
        self.canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        self.imgcanvas = self.canvas.create_image(0,
                                                  0,
                                                  image=self.previewimage,
                                                  anchor=tk.NW)
        self.bind("<Configure>", self.resize)
        logger.debug("Initialized %s:", self.__class__.__name__)

    def resize(self, event: tk.Event) -> None:
        """  Resize the image to fit the frame, maintaining aspect ratio
 </s> add  </s> remove         lblpreview = ttk.Label(preview, image=get_images().previewoutput[1])
 </s> add         lblpreview = ttk.Label(preview, image=self._preview.image) </s> remove         Parameters
        ----------
        name: str
            The name of the training image to be resized
        frame_dims: tuple, optional
            The (width (`int`), height (`int`)) of the display panel that will display the preview.
            ``None`` if the frame dimensions are not known.
 </s> add         Should be called when terminating tasks, or when Faceswap starts up or shuts down.
        if self.subnotebook.children:
            return
          self.display_item = get_images().previewtrain
  
      def display_item_process(self) -> None:
          """ Display the preview(s) resized as appropriate """
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
        if self.subnotebook.children:
            return
  
          Parameters
          ----------
          tab_id: int
              The index of the tab to update
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace 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