Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ConsoleWidget

A widget containing a Jupyter console.

Hierarchy

  • Widget

Implements

  • IDisposable
  • IMessageHandler

Index

Constructors

constructor

  • new ConsoleWidget(session: INotebookSession, rendermime: RenderMime<Widget>): ConsoleWidget
  • Construct a console widget.

    Parameters

    • session: INotebookSession
    • rendermime: RenderMime<Widget>

    Returns ConsoleWidget

Properties

Private _completion

_completion: CompletionWidget

Private _history

_history: IConsoleHistory

Private _mimetype

_mimetype: string

Private _pendingComplete

_pendingComplete: number

Private _pendingInspect

_pendingInspect: number

Private _rendermime

_rendermime: RenderMime<Widget>

Private _session

_session: INotebookSession

Private _tooltip

_tooltip: ConsoleTooltip

disposed

disposed: ISignal<Widget, void>

A signal emitted when the widget is disposed.

See also: dispose, disposed

id

id: string

Set the id of the wrapper's DOM node.

isAttached

isAttached: boolean

Test whether the widget's node is attached to the DOM.

Notes

This is a read-only property.

See also: attach, detach

isDisposed

isDisposed: boolean

Test whether the widget has been disposed.

Notes

This is a read-only property.

See also: dispose, disposed

isHidden

isHidden: boolean

Test whether the widget is explicitly hidden.

Notes

This is a read-only property.

See also: isVisible, hide, show

isVisible

isVisible: boolean

Test whether the widget is visible.

Notes

A widget is visible when it is attached to the DOM, is not explicitly hidden, and has no explicitly hidden ancestors.

This is a read-only property.

See also: isHidden, hide, show

layout

layout: Layout

Set the layout for the widget.

Notes

The layout is single-use only. It cannot be set to null and it cannot be changed after the first assignment.

The layout is disposed automatically when the widget is disposed.

node

node: HTMLElement

Get the DOM node managed by the wrapper.

Notes

This property is read-only.

parent

parent: Widget

Set the parent of the widget.

Notes

The widget will be automatically removed from its current parent.

This is a no-op if there is no effective parent change.

title

title: Title

Get the title data object for the widget.

Notes

The title data is used by some container widgets when displaying the widget along with a title, such as a tab panel or dock panel.

Not all widgets will make use of the title data, so it is created on-demand the first time it is accessed.

Accessors

prompt

session

  • get (): INotebookSession
  • Get the session used by the console.

    Notes

    This is a read-only property.

    Returns INotebookSession

Methods

addClass

  • addClass(name: string): void
  • Add a class name to the wrapper's DOM node.

    Parameters

    • name: string

      The class name to add to the node.

      Notes

      If the class name is already added to the node, this is a no-op.

    Returns void

attach

  • attach(host: HTMLElement): void
  • Attach the widget to a host DOM node.

    throws

    An error if the widget is not a root widget, if the widget is already attached, or if the host is not attached to the DOM.

    Parameters

    • host: HTMLElement

      The DOM node to use as the widget's host.

    Returns void

clear

  • clear(): void

clearFlag

  • clearFlag(flag: WidgetFlag): void
  • Clear the given widget flag.

    Notes

    This will not typically be consumed directly by user code.

    Parameters

    • flag: WidgetFlag

    Returns void

close

  • close(): void
  • Send a 'close-request' message to the widget.

    See also: [[MsgCloseRequest]]

    Returns void

compressMessage

  • compressMessage(msg: Message, pending: Queue<Message>): boolean
  • Compress a message posted to the widget.

    Parameters

    • msg: Message

      The message posted to the widget.

    • pending: Queue<Message>

      The queue of pending messages for the widget.

    Returns boolean

    true if the message should be ignored, or false if the message should be enqueued for delivery as normal.

    Notes

    Subclasses may reimplement this method as needed.

contains

  • contains(widget: Widget): boolean
  • Test whether a widget is a descendant of this widget.

    Parameters

    • widget: Widget

      The widget of interest.

    Returns boolean

    true if the widget is a descendant, false otherwise.

detach

  • detach(): void
  • Detach the widget from its host DOM node.

    throws

    An error if the widget is not a root widget, or if the widget is not attached.

    Returns void

dispose

  • dispose(): void
  • Dispose of the resources held by the widget.

    Returns void

execute

  • execute(): Promise<void>

fit

  • fit(): void
  • Post a 'fit-request' message to the widget.

    See also: [[MsgFitRequest]]

    Returns void

hasClass

  • hasClass(name: string): boolean
  • Test whether the wrapper's DOM node has the given class name.

    Parameters

    • name: string

      The class name of interest.

    Returns boolean

    true if the node has the class, false otherwise.

hide

  • hide(): void
  • Hide the widget and make it hidden to its parent widget.

    Notes

    This causes the isHidden property to be true.

    Returns void

Protected initialize

  • initialize(): void

Protected newPrompt

  • newPrompt(): void

Protected notifyLayout

  • notifyLayout(msg: Message): void
  • Invoke the message processing routine of the widget's layout.

    Parameters

    • msg: Message

      The message to dispatch to the layout.

      Notes

      This is a no-op if the widget does not have a layout.

    Returns void

Protected onAfterAttach

  • onAfterAttach(msg: Message): void
  • Handle after_attach messages for the widget.

    Parameters

    • msg: Message

    Returns void

Protected onAfterShow

  • onAfterShow(msg: Message): void
  • A message handler invoked on an 'after-show' message.

    The default implementation of this handler is a no-op.

    See also: [[MsgAfterShow]]

    Parameters

    • msg: Message

    Returns void

Protected onBeforeDetach

  • onBeforeDetach(msg: Message): void
  • A message handler invoked on a 'before-detach' message.

    The default implementation of this handler is a no-op.

    See also: [[MsgBeforeDetach]]

    Parameters

    • msg: Message

    Returns void

Protected onBeforeHide

  • onBeforeHide(msg: Message): void
  • A message handler invoked on a 'before-hide' message.

    The default implementation of this handler is a no-op.

    See also: [[MsgBeforeHide]]

    Parameters

    • msg: Message

    Returns void

Protected onChildAdded

  • onChildAdded(msg: ChildMessage): void
  • A message handler invoked on a 'child-added' message.

    The default implementation of this handler is a no-op.

    See also: [[ChildMessage]]

    Parameters

    • msg: ChildMessage

    Returns void

Protected onChildRemoved

  • onChildRemoved(msg: ChildMessage): void
  • A message handler invoked on a 'child-removed' message.

    The default implementation of this handler is a no-op.

    See also: [[ChildMessage]]

    Parameters

    • msg: ChildMessage

    Returns void

Protected onCloseRequest

  • onCloseRequest(msg: Message): void
  • A message handler invoked on a 'close-request' message.

    Notes

    The default implementation of this handler detaches the widget.

    See also: close, [[MsgCloseRequest]]

    Parameters

    • msg: Message

    Returns void

Protected onCompletionRequest

Protected onCompletionSelect

Protected onEdgeRequest

Protected onResize

  • onResize(msg: ResizeMessage): void
  • A message handler invoked on a 'resize' message.

    The default implementation of this handler is a no-op.

    See also: [[ResizeMessage]]

    Parameters

    • msg: ResizeMessage

    Returns void

Protected onTextChange

Protected onUpdateRequest

  • onUpdateRequest(msg: Message): void
  • Handle update_request messages.

    Parameters

    • msg: Message

    Returns void

processMessage

  • processMessage(msg: Message): void
  • Process a message sent to the widget.

    Parameters

    • msg: Message

      The message sent to the widget.

      Notes

      Subclasses may reimplement this method as needed.

    Returns void

removeClass

  • removeClass(name: string): void
  • Remove a class name from the wrapper's DOM node.

    Parameters

    • name: string

      The class name to remove from the node.

      Notes

      If the class name is not yet added to the node, this is a no-op.

    Returns void

serialize

setFlag

  • setFlag(flag: WidgetFlag): void
  • Set the given widget flag.

    Notes

    This will not typically be consumed directly by user code.

    Parameters

    • flag: WidgetFlag

    Returns void

setHidden

  • setHidden(hidden: boolean): void
  • Set whether the widget is hidden.

    Parameters

    • hidden: boolean

      true to hide the widget, or false to show it.

      Notes

      widget.setHidden(true) is equivalent to widget.hide(), and widget.setHidden(false) is equivalent to widget.show().

    Returns void

show

  • show(): void
  • Show the widget and make it visible to its parent widget.

    Notes

    This causes the isHidden property to be false.

    Returns void

Protected showTooltip

testFlag

  • testFlag(flag: WidgetFlag): boolean
  • Test whether the given widget flag is set.

    Notes

    This will not typically be consumed directly by user code.

    Parameters

    • flag: WidgetFlag

    Returns boolean

toggleClass

  • toggleClass(name: string, force?: boolean): boolean
  • Toggle a class name on the wrapper's DOM node.

    Parameters

    • name: string

      The class name to toggle on the node.

    • Optional force: boolean

      Whether 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.

    Returns boolean

    true if the class is now present, false otherwise.

update

  • update(): void
  • Post an 'update-request' message to the widget.

    See also: [[MsgUpdateRequest]]

    Returns void

Protected updateTooltip

Static createBanner

Static createCompletion

Static createHistory

Static createNode

  • createNode(): HTMLElement
  • Create the DOM node for a new node wrapper instance.

    Returns HTMLElement

    The DOM node to use with the node wrapper instance.

    Notes

    The default implementation creates an empty <div>.

    This may be reimplemented by a subclass to create a custom node.

Static createPrompt

Static createTooltip

Generated using TypeDoc