Repository navigation
Adding begin/end with support - #264
Merged
Merged
Conversation
See: pyimgui#255 The 18 begin_* functions now return Cython classes that have __enter__ and __exit__ methods to guarantee the corresponding end_* function is called. Note: documentation still needs to be added.
aaravrav
approved these changes
Feb 28, 2022
Member
|
This is awesome, thanks a lot! For me, it looks very great like that. I am willing to merge it. Let me know when you think it is ready to be merged (w.r.t. the documentation etc). If you want to let the documentation part for later as another PR it is possible, we'll create an issue tagged as 'todo'. (support for 2.7 will be dropped in |
Author
|
I just pushed another commit with eq methods for all the return values that were bool or tuples since some existing code may do things like Other than that I think it's ready to merge and make a todo issue for the docs. |
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See: #255
I've added context manager support for all 18 begin/end pairs. I don't see this as a replacement for the old style, but as a complementary style. Old code should continue to work as is. New code that wants/needs to handle exceptions can use the context managers to ensure the imgui stack is not corrupted.
The changes are backwards compatible in the following sense:
I've added extensive testing for all of the things added/changed. The biggest thing missing would be to update the documentation, but I'd like to get feedback before attempting to do that.
Edit: See https://cython.readthedocs.io/en/latest/src/userguide/extension_types.html#fast-instantiation for why I use the cinit + new trick.