with context for newDrawing() / endDrawing()
👋
I find myself more and more running drawBot outside of the app, and I often encapsulate my code between newDrawing() and endDrawing(). Would you be open to add a with context as with savedState() to the API?
If yes, I could take care of opening a pull request using savedState as a reference : )
Yes.
What name do you propose?
with newDrawing():
....
Or a new name?
I assume
with newDrawing():
...
could cause overshadowing issues, right?
What about a simple
with drawing():
...
?
Maybe too simple?
Or maybe even "Drawing" (cap-D)?
Yep!
+1
why capitalise? it will not be a class name
Not sure this should be an argument, but in drawbot-skia, the place to implement this, is a class named "Drawing" :) https://github.com/justvanrossum/drawbot-skia/blob/master/src/drawbot_skia/drawing.py
But in terms of API is should probably just be a contextlib.contextmanager function, indeed not unlike savedState(). Perhaps "drawing" is fine, too.