              draw = ImageDraw.Draw(img)
              draw.rectangle(((0, 0), (thumbnail_size, thumbnail_size)), outline="#E5E5E5", width=1)
              samples.append(np.array(img))
          samples = np.array(samples)
          self.previewcache["filenames"] = (self.previewcache["filenames"] +
                                            show_files)[-num_images:]
          cache = self.previewcache["images"]
          if cache is None:
              logger.debug("Creating new cache")
              cache = samples[-num_images:]
          else:
              logger.debug("Appending to existing cache")
 
</s> remove         self.previewcache["images"] = cache
        logger.debug("Cache shape: %s", self.previewcache["images"].shape)

    @staticmethod
    def get_preview_samples(imagefiles, num_images, thumbnail_size):
        """ Return a subset of the imagefiles images
            Exclude final file so we don't accidentally load a file that is being saved """
        logger.debug("num_images: %s", num_images)
        samples = list()
        start_idx = len(imagefiles) - (num_images + 1)
        end_idx = len(imagefiles) - 1
        logger.debug("start_idx: %s, end_idx: %s", start_idx, end_idx)
        show_files = sorted(imagefiles, key=os.path.getctime)[start_idx: end_idx]
        for fname in show_files:
            img = Image.open(fname)
            width, height = img.size
            scaling = thumbnail_size / max(width, height)
            logger.debug("image width: %s, height: %s, scaling: %s", width, height, scaling)
            img = img.resize((int(width * scaling), int(height * scaling)))
            if img.size[0] != img.size[1]:
                # Pad to square
                new_img = Image.new("RGB", (thumbnail_size, thumbnail_size))
                new_img.paste(img, ((thumbnail_size - img.size[0])//2,
                                    (thumbnail_size - img.size[1])//2))
                img = new_img
            draw = ImageDraw.Draw(img)
            draw.rectangle(((0, 0), (thumbnail_size, thumbnail_size)), outline="#E5E5E5", width=1)
            samples.append(np.array(img))
        samples = np.array(samples)
        logger.debug("Samples shape: %s", samples.shape)
        return show_files, samples

    def place_previews(self, frame_dims):
        """ Stack the preview images to fit display """
        if self.previewcache.get("images", None) is None:
 </s> add         self._previewcache["images"] = cache
        logger.debug("Cache shape: %s", self._previewcache["images"].shape)

    def _place_previews(self, frame_dims):
        """ Format the preview thumbnails stored in the cache into a grid fitting the display
        panel.

        Parameters
        ----------
        frame_dims: tuple
            The (width (`int`), height (`int`)) of the display panel that will display the preview

        Returns
        :class:`PIL.Image`:
            The final preview display image
        """
        if self._previewcache.get("images", None) is None: </s> remove         self.previewcache["placeholder"] = placeholder
 </s> add         self._previewcache["placeholder"] = placeholder </s> remove     def create_placeholder(self, thumbnail_size):
        """ Create a placeholder image for when there are fewer samples available
            then columns to display them """
 </s> add     def _create_placeholder(self, thumbnail_size):
        """ Create a placeholder image for when there are fewer thumbnails available
        than columns to display them.

        Parameters
        ----------
        thumbnail_size: int
            The size of the thumbnail that the placeholder should replicate
        """ </s> remove         self.pathoutput = None
        self.previewoutput = None
        self.previewtrain = dict()
        self.previewcache = dict(modified=None,  # cache for extract and convert
                                 images=None,
                                 filenames=list(),
                                 placeholder=None)
 </s> add         self._pathoutput = None
        self._previewoutput = None
        self._previewtrain = dict()
        self._previewcache = dict(modified=None,  # cache for extract and convert
                                  images=None,
                                  filenames=list(),
                                  placeholder=None) </s> remove     def clear_image_cache(self):
        """ Clear all cached images """
 </s> add     def _clear_image_cache(self):
        """ Clear all cached images. """
        self._previewcache["filenames"] = (self._previewcache["filenames"] +
                                           show_files)[-num_images:]
        cache = self._previewcache["images"]
              draw = ImageDraw.Draw(img)
              draw.rectangle(((0, 0), (thumbnail_size, thumbnail_size)), outline="#E5E5E5", width=1)
              samples.append(np.array(img))
          samples = np.array(samples)
        self._previewcache["filenames"] = (self._previewcache["filenames"] +
                                           show_files)[-num_images:]
        cache = self._previewcache["images"]
        self._previewcache["filenames"] = (self._previewcache["filenames"] +
                                           show_files)[-num_images:]
        cache = self._previewcache["images"]
        self._previewcache["filenames"] = (self._previewcache["filenames"] +
                                           show_files)[-num_images:]
        cache = self._previewcache["images"]
          if cache is None:
              logger.debug("Creating new cache")
              cache = samples[-num_images:]
          else:
              logger.debug("Appending to existing cache")
keep keep keep keep replace replace replace keep keep keep keep keep
 GUI Updates (#940)

* lib.gui: Update icons
* tools.cli: Add video filetype flag to mask input
* lib.gui.popup_configure: Refresh GUI on config save
* lib.gui._config: Add Icon size and load last session options
* lib.gui.control_helper - Add control modification tracking
* lib.gui - Add Projects and Last Session
- Main root title handled by projects
- Add Hotkeys
- Create projects module
- split fsw and fst filetypes
- Add last_session saving

* lib.project
- Documentation
- Ask confirm on closing unsaved project
-Fixups

* Track model folder changes
- Shuffle some globals
- Activate System Verbosity for GUI

* lib.gui.utils - Documentation and clean up
- lib.gui.custom_widgets - Create and document

* Add GUI config option to disable auto loading model stats 
lib/gui/utils.py