@@ -98,47 +98,45 @@ customizable you want things to be. In fact, there are several layers of
9898abstraction.
9999
100100- The most low-level way of creating a layout is by combining
101- :class: `~prompt_toolkit.layout.containers.Container ` and
102- :class: `~prompt_toolkit.layout.controls.UIControl ` objects.
103-
104- Examples of :class: `~prompt_toolkit.layout.containers.Container ` objects are
105- :class: `~prompt_toolkit.layout.containers.VSplit ` (vertical split),
106- :class: `~prompt_toolkit.layout.containers.HSplit ` (horizontal split) and
107- :class: `~prompt_toolkit.layout.containers.FloatContainer `. These containers
108- arrange the layout and can split it in multiple regions. Each container can
109- recursively contain multiple other containers. They can be combined in any
110- way to define the "shape" of the layout.
111-
112- The :class: `~prompt_toolkit.layout.containers.Window ` object is a special
113- kind of container that can contain a
114- :class: `~prompt_toolkit.layout.controls.UIControl ` object. The
115- :class: `~prompt_toolkit.layout.controls.UIControl ` object is responsible for
116- the generation of the actual content. The
117- :class: `~prompt_toolkit.layout.containers.Window ` object acts as an adaptor
118- between the :class: `~prompt_toolkit.layout.controls.UIControl ` and other
119- containers, but it's also responsible for the scrolling and line wrapping of
120- the content.
121-
122- Examples of :class: `~prompt_toolkit.layout.controls.UIControl ` objects are
123- :class: `~prompt_toolkit.layout.controls.BufferControl ` for showing the
124- content of an editable/scrollable buffer, and
125- :class: `~prompt_toolkit.layout.controls.FormattedTextControl ` for displaying
101+ :class: `~prompt_toolkit.layout.Container ` and
102+ :class: `~prompt_toolkit.layout.UIControl ` objects.
103+
104+ Examples of :class: `~prompt_toolkit.layout.Container ` objects are
105+ :class: `~prompt_toolkit.layout.VSplit ` (vertical split),
106+ :class: `~prompt_toolkit.layout.HSplit ` (horizontal split) and
107+ :class: `~prompt_toolkit.layout.FloatContainer `. These containers arrange the
108+ layout and can split it in multiple regions. Each container can recursively
109+ contain multiple other containers. They can be combined in any way to define
110+ the "shape" of the layout.
111+
112+ The :class: `~prompt_toolkit.layout.Window ` object is a special kind of
113+ container that can contain a :class: `~prompt_toolkit.layout.UIControl `
114+ object. The :class: `~prompt_toolkit.layout.UIControl ` object is responsible
115+ for the generation of the actual content. The
116+ :class: `~prompt_toolkit.layout.Window ` object acts as an adaptor between the
117+ :class: `~prompt_toolkit.layout.UIControl ` and other containers, but it's also
118+ responsible for the scrolling and line wrapping of the content.
119+
120+ Examples of :class: `~prompt_toolkit.layout.UIControl ` objects are
121+ :class: `~prompt_toolkit.layout.BufferControl ` for showing the content of an
122+ editable/scrollable buffer, and
123+ :class: `~prompt_toolkit.layout.FormattedTextControl ` for displaying
126124 (:ref: `formatted <formatted_text >`) text.
127125
128126 Normally, it is never needed to create new
129- :class: `~prompt_toolkit.layout.controls. UIControl ` or
130- :class: `~prompt_toolkit.layout.containers. Container ` classes, but instead you
131- would create the layout by composing instances of the existing built-ins.
127+ :class: `~prompt_toolkit.layout.UIControl ` or
128+ :class: `~prompt_toolkit.layout.Container ` classes, but instead you would
129+ create the layout by composing instances of the existing built-ins.
132130
133131- A higher level abstraction of building a layout is by using "widgets". A
134132 widget is a reusable layout component that can contain multiple containers
135133 and controls. It should have a ``__pt__container__ `` function, which is
136134 supposed to return the root container for this widget. Prompt_toolkit
137135 contains a couple of widgets like
138- :class: `~prompt_toolkit.widgets.base. TextArea `,
139- :class: `~prompt_toolkit.widgets.base. Button `,
140- :class: `~prompt_toolkit.widgets.base. Frame `,
141- :class: `~prompt_toolkit.widgets.base. VerticalLine ` and so on.
136+ :class: `~prompt_toolkit.widgets.TextArea `,
137+ :class: `~prompt_toolkit.widgets.Button `,
138+ :class: `~prompt_toolkit.widgets.Frame `,
139+ :class: `~prompt_toolkit.widgets.VerticalLine ` and so on.
142140
143141- The highest level abstractions can be found in the ``shortcuts `` module.
144142 There we don't have to think about the layout, controls and containers at
@@ -163,24 +161,23 @@ responsible for generating the actual content.
163161 content. A :class: `~prompt_toolkit.layout.controls.UIControl ` is not aware
164162 of the screen.
165163
166- +------------------------------------------------------+---------------------------------------------------------------+
167- | Abstract base class | Examples |
168- +======================================================+===============================================================+
169- | :class: `~prompt_toolkit.layout.containers.Container ` | :class: `~prompt_toolkit.layout.containers.HSplit ` |
170- | | :class: `~prompt_toolkit.layout.containers.VSplit ` |
171- | | :class: `~prompt_toolkit.layout.containers.FloatContainer ` |
172- | | :class: `~prompt_toolkit.layout.containers.Window ` |
173- +------------------------------------------------------+---------------------------------------------------------------+
174- | :class: `~prompt_toolkit.layout.controls.UIControl ` | :class: `~prompt_toolkit.layout.controls.BufferControl ` |
175- | | :class: `~prompt_toolkit.layout.controls.FormattedTextControl ` |
176- +------------------------------------------------------+---------------------------------------------------------------+
177-
178- The :class: `~prompt_toolkit.layout.containers.Window ` class itself is
179- particular: it is a :class: `~prompt_toolkit.layout.containers.Container ` that
180- can contain a :class: `~prompt_toolkit.layout.controls.UIControl `. Thus, it's
181- the adaptor between the two. The
182- :class: `~prompt_toolkit.layout.containers.Window ` class also takes care of
183- scrolling the content and wrapping the lines if needed.
164+ +---------------------------------------------+------------------------------------------------------+
165+ | Abstract base class | Examples |
166+ +=============================================+======================================================+
167+ | :class: `~prompt_toolkit.layout.Container ` | :class: `~prompt_toolkit.layout.HSplit ` |
168+ | | :class: `~prompt_toolkit.layout.VSplit ` |
169+ | | :class: `~prompt_toolkit.layout.FloatContainer ` |
170+ | | :class: `~prompt_toolkit.layout.Window ` |
171+ +---------------------------------------------+------------------------------------------------------+
172+ | :class: `~prompt_toolkit.layout.UIControl ` | :class: `~prompt_toolkit.layout.BufferControl ` |
173+ | | :class: `~prompt_toolkit.layout.FormattedTextControl ` |
174+ +---------------------------------------------+------------------------------------------------------+
175+
176+ The :class: `~prompt_toolkit.layout.Window ` class itself is
177+ particular: it is a :class: `~prompt_toolkit.layout.Container ` that
178+ can contain a :class: `~prompt_toolkit.layout.UIControl `. Thus, it's the adaptor
179+ between the two. The :class: `~prompt_toolkit.layout.Window ` class also takes
180+ care of scrolling the content and wrapping the lines if needed.
184181
185182Finally, there is the :class: `~prompt_toolkit.layout.Layout ` class which wraps
186183the whole layout. This is responsible for keeping track of which window has the
@@ -222,9 +219,9 @@ vertical line:
222219
223220
224221 More complex layouts can be achieved by nesting multiple
225- :class: `~prompt_toolkit.layout.containers. VSplit `,
226- :class: `~prompt_toolkit.layout.containers. HSplit ` and
227- :class: `~prompt_toolkit.layout.containers. FloatContainer ` objects.
222+ :class: `~prompt_toolkit.layout.VSplit `,
223+ :class: `~prompt_toolkit.layout.HSplit ` and
224+ :class: `~prompt_toolkit.layout.FloatContainer ` objects.
228225
229226If you want to make some part of the layout only visible when a certain
230227condition is satisfied, use a
@@ -236,7 +233,7 @@ Focusing windows
236233
237234Focussing something can be done by calling the
238235:meth: `~prompt_toolkit.layout.Layout.focus ` method. This method is very
239- flexible and accepts a :class: `~prompt_toolkit.layout.containers. Window `, a
236+ flexible and accepts a :class: `~prompt_toolkit.layout.Window `, a
240237:class: `~prompt_toolkit.buffer.Buffer `, a
241238:class: `~prompt_toolkit.layout.controls.UIControl ` and more.
242239
@@ -269,9 +266,9 @@ There are two kinds of key bindings:
269266- Key bindings that belong to a certain
270267 :class: `~prompt_toolkit.layout.controls.UIControl ` and are only active when
271268 this control is focused. Both
272- :class: `~prompt_toolkit.layout.controls. BufferControl `
273- :class: `~prompt_toolkit.layout.controls. FormattedTextControl ` take a
274- `` key_bindings `` argument.
269+ :class: `~prompt_toolkit.layout.BufferControl `
270+ :class: `~prompt_toolkit.layout.FormattedTextControl ` take a `` key_bindings ``
271+ argument.
275272
276273
277274Global key bindings
@@ -319,8 +316,8 @@ named ``_`` (underscore) as well, because the we won't refer to this name.
319316Modal containers
320317^^^^^^^^^^^^^^^^
321318
322- All container objects, like :class: `~prompt_toolkit.layout.containers. VSplit `
323- and :class: `~prompt_toolkit.layout.containers .HSplit ` take a ``modal `` argument.
319+ All container objects, like :class: `~prompt_toolkit.layout.VSplit ` and
320+ :class: `~prompt_toolkit.layout.HSplit ` take a ``modal `` argument.
324321
325322If this flag has been set, then key bindings from the parent account are not
326323taken into account if one of the children windows has the focus.
@@ -335,17 +332,17 @@ The global key bindings are always active.
335332More about the Window class
336333---------------------------
337334
338- As said earlier, a :class: `~prompt_toolkit.layout.containers. Window ` is a
339- :class: `~prompt_toolkit.layout.containers. Container ` that wraps a
340- :class: `~prompt_toolkit.layout.controls. UIControl `, like a
341- :class: `~prompt_toolkit.layout.controls. BufferControl ` or
342- :class: `~prompt_toolkit.layout.controls. FormattedTextControl `.
335+ As said earlier, a :class: `~prompt_toolkit.layout.Window ` is a
336+ :class: `~prompt_toolkit.layout.Container ` that wraps a
337+ :class: `~prompt_toolkit.layout.UIControl `, like a
338+ :class: `~prompt_toolkit.layout.BufferControl ` or
339+ :class: `~prompt_toolkit.layout.FormattedTextControl `.
343340
344341.. note ::
345342
346343 Basically, windows are the leafs in the tree structure that represent the UI.
347344
348- A :class: `~prompt_toolkit.layout.containers. Window ` provides a "view" on the
345+ A :class: `~prompt_toolkit.layout.Window ` provides a "view" on the
349346:class: `~prompt_toolkit.layout.controls.UIControl `, which provides lines of
350347content. The window is in the first place responsible for the line wrapping and
351348scrolling of the content, but there are much more options.
@@ -359,18 +356,18 @@ scrolling of the content, but there are much more options.
359356- Finally, the background can be filled with a default character.
360357
361358
362- More about buffers and :class: `~prompt_toolkit.layout.controls. BufferControl `
363- -----------------------------------------------------------------------------
359+ More about buffers and :class: `~prompt_toolkit.layout.BufferControl `
360+ --------------------------------------------------------------------
364361
365362
366363
367364Input processors
368365^^^^^^^^^^^^^^^^
369366
370367A :class: `~prompt_toolkit.layout.processors.Processor ` is used to postprocess
371- the content of a :class: `~prompt_toolkit.layout.controls. BufferControl ` before
372- it's displayed. It can for instance highlight matching brackets or change
373- the visualisation of tabs and so on.
368+ the content of a :class: `~prompt_toolkit.layout.BufferControl ` before it's
369+ displayed. It can for instance highlight matching brackets or change the
370+ visualisation of tabs and so on.
374371
375372A :class: `~prompt_toolkit.layout.processors.Processor ` operates on individual
376373lines. Basically, it takes a (formatted) line and produces a new (formatted)
@@ -402,6 +399,6 @@ Some build-in processors:
402399| :class: `~prompt_toolkit.layout.processors.TabsProcessor ` | Visualise tabs as `n ` spaces, or some symbols. |
403400+----------------------------------------------------------------------------+-----------------------------------------------------------+
404401
405- A :class: `~prompt_toolkit.layout.controls. BufferControl ` takes only one
406- processor as input, but it is possible to "merge" multiple processors into one
407- with the :func: `~prompt_toolkit.layout.processors.merge_processors ` function.
402+ A :class: `~prompt_toolkit.layout.BufferControl ` takes only one processor as
403+ input, but it is possible to "merge" multiple processors into one with the
404+ :func: `~prompt_toolkit.layout.processors.merge_processors ` function.
0 commit comments