-
Notifications
You must be signed in to change notification settings - Fork 949
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
Multiple widgets have the same model/view information #1256
Comments
Here are the current duplicates (i.e., python-side classes that implement the same model and view):
|
They used to be different, but now they only differ for the default formatting of the readout. |
Since the default is part of the model spec, that points to them needing to be different models. |
I know, but we have not released the spec, which may say "any value" which satisfies the formatting mini-language. |
Are you saying that the spec may not give a specific default value, and it would be up to the implementation? I think that would be a mistake. |
Nope, I mean that there would be only one numerical slider widget with a default value for the format that is meaningful for all numerical types The Python float slider class would inherit from this numerical slider and merely define a new default value for the trait type. Up on serialization, this would typically result in this being saved in the serialized state since different from the default. |
The only complication in the code is that the default comparison retrieves the default value from the trait type, so we would need to do something different there. |
So the issue at hand is instantiating a python version of the model from the javascript side. If we have multiple python implementations for the same model and view, this would be ambiguous. Before, we hardcoded information about not just the model to instantiate, but about the specific object on the other side implementing the model. That's what #1228 takes away, leaving the model and view information as the final word about what to instantiate on the other side. Is it all right with you if, when we instantiate a slider from javascript, the corresponding python object is just a generic slider, not a FloatSlider or IntSlider? |
I am still not sold on giving up the |
to be clear, it's not giving up the registration, it's giving up assigning specific names to kernel-side variations of the same model. The focus here is making the model spec itself self-contained, and the sole reference if you want to implement the models in a widget package. |
Advantages of the
|
Again, we still have registration, and we still have the |
A ramification of #1228 is that the FloatSlider and FloatRangeSlider are confused in the kernel, since both have exactly the same model and view implementation. So we basically have different presentations of the same model to the user, and have to disambiguate between them.
I think this is a problem with the models, not with the idea of #1228. I think we should probably have separate models for float slider and float range slider, for example.
The text was updated successfully, but these errors were encountered: