Ejemplo n.º 1
0
    def add_uuids_and_sort_glyphs(self):
        """Gives ids to all of the glyphs in the XML file."""
        xml = Glyph.xml_from_file(self.file_path)

        glyphs = xml.xpath("//glyphs")[0]
        glyphs[:] = sorted(glyphs, key=lambda glyph: Glyph.name_from_xml(glyph))

        for glyph in glyphs:
            if 'uuid' not in glyph.keys():
                glyph.set('uuid', Glyph.make_uuid())

        self.write_xml_to_file(xml)
Ejemplo n.º 2
0
    def add_uuids_and_sort_glyphs(self):
        """Gives ids to all of the glyphs in the XML file."""
        xml = Glyph.xml_from_file(self.file_path)

        glyphs = xml.xpath("//glyphs")[0]
        glyphs[:] = sorted(glyphs,
                           key=lambda glyph: Glyph.name_from_xml(glyph))

        for glyph in glyphs:
            if 'uuid' not in glyph.keys():
                glyph.set('uuid', Glyph.make_uuid())

        self.write_xml_to_file(xml)
Ejemplo n.º 3
0
 def glyphs(self):
     xml = Glyph.xml_from_file(self.file_path)
     return [Glyph(g).__dict__ for g in xml.xpath("//glyph")]
Ejemplo n.º 4
0
 def glyphs(self):
     xml = Glyph.xml_from_file(self.file_path)
     return [Glyph(g).__dict__ for g in xml.xpath("//glyph")]