Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete path with del(Layer.paths[0]) not supported #74

Open
Mark2Mark opened this issue Aug 22, 2022 · 10 comments
Open

delete path with del(Layer.paths[0]) not supported #74

Mark2Mark opened this issue Aug 22, 2022 · 10 comments

Comments

@Mark2Mark
Copy link
Contributor

Mark2Mark commented Aug 22, 2022

>>> 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?

@schriftgestalt
Copy link
Owner

schriftgestalt commented Aug 22, 2022

del(Layer.shapes[0])

@Mark2Mark
Copy link
Contributor Author

Mark2Mark commented Aug 23, 2022

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.

  • The documentation needs an update then. del(layer.paths[0])del(Layer.shapes[0])

@florianpircher
Copy link

You can use shapeType.

@Mark2Mark
Copy link
Contributor Author

Thanks!

Should anyone add that to the Documentation?

@florianpircher
Copy link

I linked to the documentation. Or what other documentation do you use?

@Mark2Mark
Copy link
Contributor Author

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)

@florianpircher
Copy link

Yes, that part is wrong.

@Mark2Mark
Copy link
Contributor Author

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.

@schriftgestalt
Copy link
Owner

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

@schriftgestalt
Copy link
Owner

The formatting is a bit tricky (indentation and empty lines). I can clean it up if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants