-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add a widget for settings like Camera that can be saved with names #294
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #294 +/- ##
==========================================
+ Coverage 71.86% 73.70% +1.83%
==========================================
Files 26 27 +1
Lines 3220 3388 +168
==========================================
+ Hits 2314 2497 +183
+ Misses 906 891 -15 ☔ View full report in Codecov by Sentry. |
8e220c0
to
af067b8
Compare
af067b8
to
5d0d88f
Compare
@JuanCab -- it may be easiest to review these changes in commit order now. The first few commits are small, and made to lay the groundwork for the new custom widgets. The commit to add the custom widget and the commit to add its tests are pretty chunky... |
Instructions for student testers
|
A few things that @Tanner728 found:
There were a couple other things I'm opening issues for. |
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.
Changes for deleting items code makes sense AND the tests seem to cover all the possibilities I can think of.
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.
See notes about the documentation, the actual code seems sound.
I didn't know I could go commit by commit, doing that now. It is easier! |
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.
Documentation tweaks requested... looks like a very challenging customization, you did a lot here!
Name of the item type to be displayed in the widget. Must be one of | ||
"camera", "observatory", "passband_map", "Camera", "Observatory" | ||
or "PassbandMap". | ||
""" |
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.
Documentation is missing the keyword _testing_path
... is that meant to eventually go away?
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 wasn't sure how to handle this...the intent is that users don't use it, it is just there for testing. I could hide it more, I suppose, by putting it into **kwargs
and popping it from there. That way it wouldn't show up in code completion.
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 suppose parameters can't be flagged as private (correction, private doesn't exist really in Python, I was thinking of name mangling via double underscore, but that won't help here). But it makes sense that it is for testing purposes.
# but does no harm in the other cases (true of both lines below) | ||
# (and yes, both lines below are needed...this is a bug in ipyautoui, | ||
# I think, because open_nested=True isn't respected when we _init_ui. | ||
# Forcing a *change* in the value triggers the behavior we want.) |
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.
Cute fix for the bug.
# but does no harm in the other cases (true of both lines below) | ||
# (and yes, both lines below are needed...this is a bug in ipyautoui, | ||
# I think, because open_nested=True isn't respected when we _init_ui. | ||
# Forcing a *change* in the value triggers the behavior we want.) |
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.
Given you have the same comment and fix twice, makes me wonder if you should just create a function called _jiggle_open_nested_for_ipyautoui
. :)
|
||
# Use a closure here to capture the current state of the widget | ||
def save_confirm_handler(change): | ||
# value of None means the widget has been reset to not answered |
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.
Do you want to clarify this is that the "confirmation" has not been addressed or the "confirmation widget" has been reset to behave as if not answered? I was confused by this at first and only realized what you meant by reading the behavior below. Better yet, maybe place a comment in the function 'docstring' above explaining what the desired behavior is as a whole.
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.
Looks good, I didn't know how you could check UI features, now I know. Made sense, although I had to concentrate at a few points to follow it.
'ignore:Using extra keyword arguments on `Field` is deprecated:' | ||
'ignore:Using extra keyword arguments on `Field` is deprecated:', | ||
# ipywidgets is using something deprecated in traitlets | ||
'ignore:Deprecated in traitlets 4.1, use the instance:DeprecationWarning', |
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.
So we have to wait for an ipywidgets
update to address this...
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.
yeah
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 tweaked my stellardev.yml
file for the stellarphot development environment to include the Jupyter app launcher.
All looks good code wise, I had a few documentation issues, but they were minor. I did also try out the notebooks, using the instructions to students above (after editing them to replace a For the camera, it keeps displaying "(red X) Invalid" at the top, same with Passband Map (but not Observatory). I can't set a Camera name, which may be the problem.... it's greyed out. The Passband Map name is not filled out but I can't seem to get it to be editable. Rebuilt the widget from scratch by re-running the cell that has Some testing reveals if I forget to fill out the Bandpass Map NAME before trying to actually add a mapping, the Name becomes uneditable, which condemns me to an invalid Bandpass Map. For the Camera, I was not able to replicate the problem in some limited testing, the second time, choosing the values that were default did work. |
I'm going merge this -- I addressed the documentation comments, I think, and have opened issues for the rest. |
This PR has a few things:
In addition to the code review please try going through the notebook. Once you have done a
pip install -e .
with this branch in your environment, you should see the button in the launcher:@JuanCab -- if you could review by early next week that would be great.