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)
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)
def glyphs(self): xml = Glyph.xml_from_file(self.file_path) return [Glyph(g).__dict__ for g in xml.xpath("//glyph")]
def glyphs(self): xml = Glyph.xml_from_file(self.file_path) return [Glyph(g).__dict__ for g in xml.xpath("//glyph")]