def add_image_info_cb(self, viewer, channel, info):

        save_thumb = self.settings.get('cache_thumbs', False)

        # Do we already have this thumb loaded?
        chname = channel.name
        thumbkey = self.get_thumb_key(chname, info.name, info.path)
        thumbpath = self.get_thumbpath(info.path)

        with self.thmblock:
            try:
                bnch = self.thumbDict[thumbkey]
                # if these are not equal then the mtime must have
                # changed on the file, better reload and regenerate
                if bnch.thumbpath == thumbpath:
                    return
            except __HOLE__:
                pass

        # Is there a cached thumbnail image on disk we can use?
        image = None
        if (thumbpath is not None) and os.path.exists(thumbpath):
            save_thumb = False
            try:
                # try to load the thumbnail image
                image = self.fv.load_image(thumbpath)
            except Exception as e:
                pass

        try:
            if image is None:
                # no luck loading thumbnail, try to load the full image
                image = info.image_loader(info.path)

            # make sure name is consistent
            image.set(name=info.name)

            self.fv.gui_do(self._make_thumb, chname, image, info.name,
                           info.path, thumbkey, info.image_future,
                           save_thumb=save_thumb,
                           thumbpath=thumbpath)

        except Exception as e:
            self.logger.error("Error generating thumbnail for '%s': %s" % (
                info.path, str(e)))
            # TODO: generate "broken thumb"?
dataset/ETHPy150Open ejeschke/ginga/ginga/misc/plugins/Thumbs.py/Thumbs.add_image_info_cb