-
Notifications
You must be signed in to change notification settings - Fork 2
fix #66 : Compare colors #68
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
fix #66 : Compare colors #68
Conversation
| raise ValueError("Expected None or LinearGradient instance for `bg_gradient` argument") | ||
| if bg_value is not None and not (isinstance(bg_value, np.ndarray) and bg_value.ndim == 2): | ||
| raise ValueError("Expected None or 2D Numpy ndarray with shape {} for `bg_value` argument" | ||
| .format(self._data.shape)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you use the precise shape in the error message but not in the check. I guess you should replace bg_value.ndim == 2 by bg_value.shape == self._data.shape.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I should.
larray_editor/arraymodel.py
Outdated
| value = bg_value.data.flat[idx] | ||
| return self.bg_gradient[value] | ||
| i, j = index.row(), index.column() | ||
| return self.bg_gradient[self.bg_value[i][j]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use self.bg_value[i, j]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot that bg_value is a Numpy ndarray.
| self.current_filter = {} | ||
| self.la_data = la.aslarray(data) | ||
| self.bg_value = la.aslarray(bg_value) if bg_value is not None else None | ||
| self.bg_gradient = bg_gradient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think storing/handling the bg_gradient in the adapter adds any value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the changes made in PR #64 works fine as long as we do not play with user defined gradient.
In case of user defined gradient, it is overwritten as soon as we call the method reset_minmax() from DataArrayModel.
In the current commit, bg_gradient is first overwritten by reset_minmax() and then reset to the user defined gradient but the call to self.data_model.set_background(self.bg_gradient, bg_value_2D) at the end of update_filtered_data in the Adapter. This is bad, I know...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that will do for now. I will fix that in the "gradient combobox" branch I just spoke about because I need to touch that code anyway.
2b6186e to
bda109b
Compare
|
could you squash the 2 commits? |
No description provided.