Construct a notebook widget.
Protected
_viewProtected
cellsReadonly
contentThe cell factory used by the widget.
Protected
jumpedA signal that emits the index when the virtual scrollbar jumps to an item.
Readonly
kernelReadonly
nodeGet the DOM node owned by the widget.
Protected
rendererThe renderer for this windowed list. Set at instantiation.
Readonly
rendermimeThe Rendermime instance used by the widget.
Readonly
translatorTranslator to be used by cell renderers
Static
Readonly
DEFAULT_Default widget size
Get the mimetype for code cells.
The dataset for the widget's DOM node.
A configuration object for cell editor settings.
Get the method for hiding the widget.
Set the method for hiding the widget.
Get the id of the widget's DOM node.
Set the id of the widget's DOM node.
Test whether the widget's node is attached to the DOM.
Test whether the widget has been disposed.
Whether the parent is hidden or not.
This should be set externally if a container is hidden to stop updating the widget size when hidden.
Test whether the widget is visible.
A widget is visible when it is attached to the DOM, is not explicitly hidden, and has no explicitly hidden ancestors.
Since 2.7.0, this does not rely on the Widget.Flag.IsVisible flag. It recursively checks the visibility of all parent widgets.
Widget layout
The model for the widget.
A configuration object for notebook settings.
The outer container of the windowed list.
Get the parent of the widget.
Set the parent of the widget.
Children are typically added to a widget by using a layout, which means user code will not normally set the parent widget directly.
The widget will be automatically removed from its old parent.
This is a no-op if there is no effective parent change.
Flag to enable virtual scrollbar.
The title object for the widget.
The title object is used by some container widgets when displaying the widget alongside some title, such as a tab panel or side bar.
Since not all widgets will use the title, it is created on demand.
The owner
property of the title is set to this widget.
Protected
viewViewport
A read-only sequence of the widgets in the notebook.
Protected
_onHandle a change cells event.
Protected
addCreate an iterator over the widget's children.
A new iterator over the children of the widget.
The widget must have a populated layout in order to have children.
If a layout is not installed, the returned iterator will be empty.
Hide the widget and make it hidden to its parent widget.
This causes the isHidden property to be true
.
If the widget is explicitly hidden, this is a no-op.
Move cells preserving widget view state.
This is required because at the model level a move is a deletion followed by an insertion. Hence the view state is not preserved.
The index of the cell to move
The new index of the cell
Number of cells to move
Protected
notifyProtected
onProtected
onProtected
onProtected
onProtected
onProtected
onProtected
onProtected
onProtected
onProtected
onHandle a cell being inserted.
The default implementation is a no-op
Protected
onHandle a cell being removed.
The default implementation is a no-op
Protected
onProtected
onProtected
onProtected
onProtected
onHandle changes to the notebook model metadata.
The default implementation updates the mimetypes of the code cells
when the language_info
metadata changes.
Protected
onHandle a new model.
This method is called after the model change has been handled
internally and before the modelChanged
signal is emitted.
The default implementation is a no-op.
Protected
onHandle changes to the notebook model content.
The default implementation emits the modelContentChanged
signal.
Protected
onProtected
onProtected
onCallback on view model change
Windowed list model
Change
Protected
onProtected
removeScroll to the specified item.
By default, the list will scroll as little as possible to ensure the item is fully visible (auto
).
You can control the alignment of the item though by specifying a second alignment parameter.
Acceptable values are:
auto - Automatically align with the top or bottom minimising the amount scrolled,
If alignPreference
is given, follow such preferred alignment.
If item is smaller than the viewport and fully visible, do not scroll at all.
smart - If the item is significantly visible, don't scroll at all (regardless of whether it fits in the viewport).
If the item is less than one viewport away, scroll so that it becomes fully visible (following the auto
heuristics).
If the item is more than one viewport away, scroll so that it is centered within the viewport (center
if smaller than viewport, top-center
otherwise).
center - Align the middle of the item with the middle of the viewport (it only works well for items smaller than the viewport).
top-center - Align the top of the item with the middle of the viewport (works well for items larger than the viewport).
end - Align the bottom of the item to the bottom of the list.
start - Align the top of item to the top of the list.
Item index to scroll to
Optional
align: ScrollToAlignType of alignment
Optional
margin: numberIn 'smart' mode the viewport proportion to add
Optional
alignPreference: BaseScrollToAlignmentAllows to override the alignment of item when the auto
heuristic decides that the item needs to be scrolled into view.
Show the widget and make it visible to its parent widget.
This causes the isHidden property to be false
.
If the widget is not explicitly hidden, this is a no-op.
Toggle a class name on the widget's DOM node.
The class name to toggle on the node.
Optional
force: booleanWhether to force add the class (true
) or force
remove the class (false
). If not provided, the presence of
the class will be toggled from its current state.
true
if the class is now present, false
otherwise.
The class name must not contain whitespace.
A widget which renders static non-interactive notebooks.
Notes
The widget model must be set separately and can be changed at any time. Consumers of the widget must account for a
null
model, and may want to listen to themodelChanged
signal.