| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Do these views actually do anything? I wonder if this is better fixed on the Python side - i.e. don't attempt to display a widget unless there's something it can display. |
Sorry, something went wrong.
|
I cannot think of a use case where you would really want to display a bare empty view. This is just to avoid an error on the JavaScript when display is called implicitly. |
Sorry, something went wrong.
|
I guess my fix more specifically would be: set view_name to an empty string instead of something like 'WidgetView' (which isn't really a view, just a base class). And then in Widget._ipython_display_(), do nothing if view_name is empty. |
Sorry, something went wrong.
|
Ok, it makes sense. ( Although then calling Widget() still raises an error on the JavaScript side :) ) |
Sorry, something went wrong.
|
Actually we could do both, I find it conceptually annoying that widgets with no views are "displayed". |
Sorry, something went wrong.
|
What error would Widget() raise on the JS side? Can't it instantiate the model without a view name? |
Sorry, something went wrong.
|
Oh you also want Widget to have no view? Not just custom stuff like Link. Then ok. |
Sorry, something went wrong.
|
Yeah, I'm thinking that view_name should only be set if there is a real, displayable view for the widget. |
Sorry, something went wrong.
|
Updated as suggested by Thomas. |
Sorry, something went wrong.
|
+1 to having a null view that actually is special and does nothing (rather than just being the default base class). |
Sorry, something went wrong.
|
Thinking about this some more, I wonder if instantiating Widget() should actually throw an error on the Python side - Widget is effectively an Abstract Base Class, i.e. it should be used by subclassing it. |
Sorry, something went wrong.
I'm +1 for this too, only if we decide not to persist invisible models. |
Sorry, something went wrong.
|
Thanks! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
@jdfreder A quick fix to #6530. Widget and DOMWidget' s view name is set to None. Widgets without a view are not displayed anymore, like what Thomas suggested earlier