Open Mark2Mark opened 2 years ago
del(Layer.shapes[0])
Thanks!
Is there an easy way to distinguish between paths and components?
When a user wants to only delete either or.
I know one could type check as on objc, but for the regular python user? It’s not all too clear with the .shapes
I think.
del(layer.paths[0])
→ del(Layer.shapes[0])
You can use shapeType
.
Thanks!
Should anyone add that to the Documentation?
I linked to the documentation. Or what other documentation do you use?
Didn’t see that it is a link. I also linked mine, though (twice 😉 ) Tried to point y’all to the part under GSLayer > paths, where it says:
# access all paths
for path in layer.paths:
print(path)
# delete path
del(layer.paths[0]) # <------------- this is what I am talking about.
# copy paths from another layer
import copy
layer.paths = copy.copy(anotherlayer.paths)
Yes, that part is wrong.
I’d love to help with the docu, but I have no access or clue how it is generated. Hence I can only drop all my findings here.
The docu is generated from the comments in the wrapper file. It uses a script to extract the comments and then uses sphinx to build the html. https://github.com/schriftgestalt/GlyphsSDK/tree/Glyphs3/ObjectWrapper/Sphinx%20Documentation
The formatting is a bit tricky (indentation and empty lines). I can clean it up if needed.
>>> TypeError: 'GSProxyShapes' object doesn't support item deletion
The documentation claims that it is possible like that.
Also: what’s the proper API now to delete/add paths?