wxyz.lab#

Widgets for reusing parts of the JupyterLab interface

class wxyz.lab.DockBox(**kwargs: Any)[source]#

Bases: LabBase, Box

A Box that renders as a DockPanel

border_size#

CSS size value for border width

box_style#

Use a predefined styling for the box.

children#

List of widget children

dock_layout#

An AreaConfig from DockPanel.saveLayout from @lumino/widgets, e.g. {

“type”: “split-area”, “orientation”: “orientation”, “sizes”: [1, 1, 1, 1] “children”: [

{“type”: “tab-area”, “widgets”: [0], “currentIndex”: 0}, {“type”: “tab-area”, “widgets”: [1], “currentIndex”: 0}, {“type”: “tab-area”, “widgets”: [2], “currentIndex”: 0}, {“type”: “tab-area”, “widgets”: [3], “currentIndex”: 0}

]

}

The widgets list of a tab-area should be indices of children

spacing#

Spacing between children

tab_size#

CSS size value for tab bars

class wxyz.lab.DockPop(**kwargs: Any)[source]#

Bases: LabBase, Box

A “box” that just adds stuff to the main JupyterLab area

box_style#

Use a predefined styling for the box.

children#

List of widget children

class wxyz.lab.Editor(**kwargs: Any)[source]#

Bases: LabBase, Textarea

A basic editor

continuous_update#

Update the value as the user types. If False, update on submission, e.g., pressing Enter or navigating away.

description_allow_html#

Accept HTML in the description.

property description_tooltip#

The tooltip information. .. deprecated :: 8.0.0

Use tooltip attribute instead.

disabled#

Enable or disable user changes

get_interact_value()#

Return the value for this widget which should be passed to interactive functions. Custom widgets can change this method to process the raw value self.value.

placeholder#

Placeholder text to display when nothing has been typed

rows#

The number of rows to display.

class wxyz.lab.EditorConfig(**kwargs: Any)[source]#

Bases: Widget

JSON-compatible CodeMirror configuration options.

autofocus#

Can be used to make CodeMirror focus itself on initialization. Defaults to off. When fromTextArea is used, and no explicit value is given for this option, it will be set to true when either the source textarea is focused, or it has an autofocus attribute and no other element is focused.

cursorBlinkRate#

Half - period in milliseconds used for cursor blinking. The default blink rate is 530ms.

cursorHeight#

Determines the height of the cursor. Default is 1 , meaning it spans the whole height of the line. For some fonts (and by some tastes) a smaller height (for example 0.85), which causes the cursor to not reach all the way to the bottom of the line, looks better

dragDrop#

Controls whether drag-and - drop is enabled. On by default.

electricChars#

Configures whether the editor should re-indent the current line when a character is typed that might change its proper indentation (only works if the mode supports indentation). Default is true.

firstLineNumber#

At which number to start counting lines. Default is 1.

fixedGutter#

Determines whether the gutter scrolls along with the content horizontally (false) or whether it stays fixed during horizontal scrolling (true, the default).

flattenSpans#

By default, CodeMirror will combine adjacent tokens into a single span if they have the same class. This will result in a simpler DOM tree, and thus perform better. With some kinds of styling(such as rounded corners), this will change the way the document looks. You can set this option to false to disable this behavior.

foldGutter#

Provides an option foldGutter, which can be used to create a gutter with markers indicating the blocks that can be folded.

gutters#

Can be used to add extra gutters (beyond or instead of the line number gutter). Should be an array of CSS class names, each of which defines a width (and optionally a background), and which will be used to draw the background of the gutters. May include the CodeMirror-linenumbers class, in order to explicitly set the position of the line number gutter (it will default to be to the right of all other gutters). These class names are the keys passed to setGutterMarker.

historyEventDelay#

The period of inactivity (in milliseconds) that will cause a new history event to be started when typing or deleting. Defaults to 500.

indentUnit#

How many spaces a block (whatever that means in the edited language) should be indented. The default is 2.

indentWithTabs#

Whether, when indenting, the first N*tabSize spaces should be replaced by N tabs. Default is false.

keyMap#

Configures the keymap to use. The default is “default”, which is the only keymap defined in codemirror.js itself. Extra keymaps are found in the keymap directory. See the section on keymaps for more information.

lineNumbers#

Whether to show line numbers to the left of the editor.

lineWrapping#

Whether CodeMirror should scroll or wrap for long lines. Defaults to false (scroll).

maxHighlightLength#

When highlighting long lines, in order to stay responsive, the editor will give up and simply style the rest of the line as plain text when it reaches a certain position. The default is 10000. You can set this to Infinity to turn off this behavior.

mode#

true}).

Type:

string|object. The mode to use. When not given, this will default to the first mode that was loaded. It may be a string, which either simply names the mode or is a MIME type associated with the mode. Alternatively, it may be an object containing configuration options for the mode, with a name property that names the mode (for example {name

Type:

“javascript”, json

placeholder#

Optional value to be used in conjunction with CodeMirror’s placeholder add-on.

pollInterval#

Indicates how quickly CodeMirror should poll its input textarea for changes(when focused). Most input is captured by events, but some things, like IME input on some browsers, don’t generate events that allow CodeMirror to properly detect it. Thus, it polls. Default is 100 milliseconds.

readOnly#

boolean|string. This disables editing of the editor content by the user. If the special value “nocursor” is given (instead of simply true), focusing of the editor is also disallowed.

rtlMoveVisually#

Determines whether horizontal cursor movement through right-to-left (Arabic, Hebrew) text is visual (pressing the left arrow moves the cursor left) or logical (pressing the left arrow moves to the next lower index in the string, which is visually right in right-to-left text). The default is false on Windows, and true on other platforms.

scrollbarStyle#

Chooses a scrollbar implementation. The default is “native”, showing native scrollbars. The core library also provides the “null” style, which completely hides the scrollbars. Addons can implement additional scrollbar models.

showCursorWhenSelecting#

Whether the cursor should be drawn when a selection is active. Defaults to false.

smartIndent#

Whether to use the context-sensitive indentation that the mode provides (or just indent the same as the line before). Defaults to true.

tabSize#

The width of a tab character. Defaults to 4.

tabindex#

The tab index to assign to the editor. If not given, no tab index will be assigned.

theme#

The theme to style the editor with. You must make sure the CSS file defining the corresponding .cm-s-[name] styles is loaded. The default is “default”.

undoDepth#

The maximum number of undo levels that the editor stores. Defaults to 40.

viewportMargin#

Specifies the amount of lines that are rendered above and below the part of the document that’s currently scrolled into view. This affects the amount of updates needed when scrolling, and the amount of work that such an update does. You should usually leave it at its default, 10. Can be set to Infinity to make sure the whole document is always rendered, and thus the browser’s text search works on it. This will have bad effects on performance of big documents.

workDelay#

See workTime.

workTime#

Highlighting is done by a pseudo background - thread that will work for workTime milliseconds, and then use timeout to sleep for workDelay milliseconds. The defaults are 200 and 300, you can change these options to make the highlighting more or less aggressive.

class wxyz.lab.EditorModeInfo(**kwargs: Any)[source]#

Bases: Widget

CodeMirror modes known to the frontend

class wxyz.lab.Markdown(**kwargs: Any)[source]#

Bases: Fn, LabBase

A widget that turns markdown source into HTML source

mode#

whether to execute transformations on the client and/or the kernel

source: any#

the source

the_function(source)[source]#

Render some markdown

the_observer(*_)#

Base observer that updates value and/or error

value: any#

the value produced by evaluating the function

class wxyz.lab.Terminal(**kwargs: Any)[source]#

Bases: LabBase

A basic terminal

data(content)[source]#

programmatically call all data listeners

on_data(callback, remove=False)[source]#

register a callback which will receive a message

send_line(line)[source]#

convenience wrapper around send