2.1.1.1.1. pyfx.view.common.frame.Frame

class Frame(screen, buffers, mini_buffers, current_buffer, current_mini_buffer)

An Emacs-like box widget designed for Pyfx use cases.

It splits the whole terminal into three parts:

buffer: a section used to show content information line: a one-line section to show some helpful information mini buffer: a mini editable section to type query etc.

Note

Unlike ::class::urwid.Frame, this widget is designed to be the

top widget used in urwid.MainLoop.

`_buffers`

A map from string to available widget used in buffer.

`_current_buffer`

the key of current widget for buffer in buffers (might not in focus)

`_mini_buffers`

A map from string to available widget used in mini buffer.

`_current_mini_buffer`

the key of current widget for mini buffer in mini buffers (might not in focus though).

`_info_line`

A non-selectable text bar that displays helpful information.

`_focus`

The key of current focused widget in the frame.

`_focus_widget`

The current widget in focus.

`_backup`

A snapshot of previous state. This is used to restore the frame into its previous state. E.g., when we popup a warning message, we temporarily switch the mini buffer but not focus on it.

Methods

__init__(screen, buffers, mini_buffers, ...)

param screen:

The screen object represents

create_snapshot()

get_cursor_coords(size)

Returns the cursor coordinates of the focus widget.

get_focus_path()

Return the .focus_position values starting from this container and proceeding along each child widget until reaching a leaf (non-container) widget.

get_focus_widgets()

Return the .focus values starting from this container and proceeding along each child widget until reaching a leaf (non-container) widget.

keypress(size, key)

Passes keypress to widget in focus.

mouse_event(size, event, button, col, row, focus)

Passes mouse event to appropriate part of frame.

pack(size[, focus])

See Widget.render() for parameter details.

render(size[, focus])

restore(index)

selectable()

Frame is always selectable.

set_buffer(widget_name)

set_focus(widget_name)

set_focus_path(positions)

Set the .focus_position property starting from this container widget and proceeding along newly focused child widgets.

set_mini_buffer(widget_name)

set_no_focus(widget_name)

Switches the widget in the pre-defined area (buffer or mini_buffer).

size(widget_name)

Get the size of the respected widget

sizing()

returns:

A frozenset including one or more of 'box', 'flow' and

Attributes

base_widget

Read-only property that steps through decoration widgets and returns the one at the base.

buffer

focus

focus_position

Property for reading and setting the focus position for container widgets.

mini_buffer

get_cursor_coords(size)

Returns the cursor coordinates of the focus widget.

keypress(size, key)

Passes keypress to widget in focus.

mouse_event(size, event, button, col, row, focus)

Passes mouse event to appropriate part of frame. Focus may be changed on button 1 press.

selectable()

Frame is always selectable.

set_no_focus(widget_name)

Switches the widget in the pre-defined area (buffer or mini_buffer). Don’t focus on it.

size(widget_name)

Get the size of the respected widget

sizing()
Returns:

A frozenset including one or more of 'box', 'flow' and 'fixed'. Default implementation returns the value of _sizing, which for this class includes all three.

The sizing modes returned indicate the modes that may be supported by this widget, but is not sufficient to know that using that sizing mode will work. Subclasses should make an effort to remove sizing modes they know will not work given the state of the widget, but many do not yet do this.

If a sizing mode is missing from the set then the widget should fail when used in that mode.

If 'flow' is among the values returned then the other methods in this widget must be able to accept a single-element tuple (maxcol,) to their size parameter, and the rows() method must be defined.

If 'box' is among the values returned then the other methods must be able to accept a two-element tuple (maxcol, maxrow) to their size parameter.

If 'fixed' is among the values returned then the other methods must be able to accept an empty tuple () to their size parameter, and the pack() method must be defined.