This is a section of a script that I think used to work but no longer does.
myLayers = Glyphs.font.selectedLayers
for layer in myLayers:
pixelatedGlyph = False
for component in layer.components:
if component.name in ["_pixel", "_part.smartPixel"]:
pixelatedGlyph = True
layer.color = 0
component.name = "_pixel.multi"
layer.decomposeComponents()
/_pixel.multi is a glyph that contains four small circles instead of the one large circle in /_pixel and /_part.smartPixel.
After completing this part of the script, the selected glyph still shows one large circle for each component in the Edit view, even though if I select any of them the Show Info box shows it as “/_pixel.multi” (and in fact if I double click on it it opens up that multi glyph). In other words, the name is updated but the visual representation is not (and thus the decompose that comes right after doesn’t work right).
Is there some kind of update function I can build into the script to make sure the correct component gets operated on? Or is there a better scripting strategy for trading out component references?