parser.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:aniwall 作者: worron 项目源码 文件源码
def _load_image_data(self, file_, source):
        """Read image settings from SVG tags"""
        tree = etree.parse(source, self.parser)
        root = tree.getroot()
        xhtml = "{%s}" % root.nsmap[None]

        imagedata = ImageData(file_, tree)

        transform_tag = root.find(".//%s*[@id='transform']" % xhtml)
        imagedata.set_transform(transform_tag)

        background_tag = root.find(".//%s*[@id='background']" % xhtml)
        imagedata.set_background(background_tag)

        counter = count(1)
        while True:
            index = next(counter)
            id_ = "color" + str(index)
            tag = root.find(".//%s*[@id='%s']" % (xhtml, id_))
            if tag is None:
                break
            imagedata.set_color(tag, id_)

        return imagedata
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号