'Create image structures for each icon files.'

def setup_images(self):

    for (img_name, iconfile) in self.icons_files.items():
        if (iconfile is None):
            logger.warning('No    icon    found    for    application    "%s"    (%s)    switch    to    text    mode', img_name, iconfile)
            textbox = base._TextBox()
            textbox._configure(self.qtile, self.bar)
            textbox.layout = self.drawer.textlayout(textbox.text, textbox.foreground, textbox.font, textbox.fontsize, textbox.fontshadow, markup=textbox.markup)
            textbox.text = img_name
            textbox.calculate_length()
            self.icons_widths[img_name] = textbox.width
            self.surfaces[img_name] = textbox
            continue
        else:
            try:
                img = cairocffi.ImageSurface.create_from_png(iconfile)
            except cairocffi.Error:
                logger.exception('Error    loading    icon    for    application    "%s"    (%s)', img_name, iconfile)
                return
        input_width = img.get_width()
        input_height = img.get_height()
        sp = (input_height / (self.bar.height - 4))
        width = int((input_width / sp))
        imgpat = cairocffi.SurfacePattern(img)
        scaler = cairocffi.Matrix()
        scaler.scale(sp, sp)
        scaler.translate((self.padding * (-1)), (-2))
        imgpat.set_matrix(scaler)
        imgpat.set_filter(cairocffi.FILTER_BEST)
        self.surfaces[img_name] = imgpat
        self.icons_widths[img_name] = width
