Conversation
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.
Description
This fixes some crashes when a Qt method with bool arguments takes a
np.boolargument instead. This fixes the crashes I have found. It is not a general solution, and there could be other similar crashes.Unfortunately, one error looks like this:
In this case, just because
radiusis annp.float,radius < 6will benp.bool. This is then passed toFieldOfView.setVisible, which is the inheritedQGraphicsItem.setVisible,and this one takes aboolargument. The difference in type causes an exception.Considering that numpy types are everywhere, one has to:
This PR does the second in a few instances. Several methods that take a bool as argument will cast it explictly before passing it to
setVisible. This means littering the code with bool casts, just because a numpy type might be passed. Not nice.Overriding the methods is not nice either. It would mean that every class that inherits from QGraphicsItem needs to have a
setVisiblemethod where the argument is cast and theQGraphicsItem.setVisibleis called.Then the question is to what other methods and types this applies. There doesn't seem to be an issue with float arguments. I do not know if this is caused by changes in numpy or by changes in the Qt python bindings.
Interface impacts
Testing
Unit tests
Independent check of unit tests by [REVIEWER NAME]
Functional tests
No functional testing.