plainbox.vendor.textland – TextLand

This package contains a bundled copy of the upstream TextLand project. Over time it will be updated with subsequent releases. Eventually it will be replaced by a dependency on API-stable TextLand release.

See also

TextLand upstream project: https://github.com/zyga/textland/

Text Land

class plainbox.vendor.textland.Cell

Cell(char, attributes)

attributes

Alias for field number 1

char

Alias for field number 0

class plainbox.vendor.textland.DrawingContext(image: plainbox.vendor.textland.image.TextImage)

Context for simple text drawing

border(lm=0, rm=0, tm=0, bm=0) → None

Draw a border around the edges of the current cli. Each parameter specifies the margin to use for a specific side of the border.

clip_by(dx1: int, dy1: int, dx2: int, dy2: int) → None
clip_to(x1: int, y1: int, x2: int, y2: int) → None
fill(c: str) → None
move_by(dx: int, dy: int) → None

Move paint offset by the specified delta

move_to(x: int, y: int) → None

Move paint offset to the specified spot

print(text: str) → None

Print the specified text

Multi-line strings are supported. The offset and clipping area is respected. Painting beyond the clipping area is ignored

The offset is automatically adjusted to point to the end of the string.

class plainbox.vendor.textland.Event

Event(kind, data)

data

Alias for field number 1

kind

Alias for field number 0

class plainbox.vendor.textland.IApplication

Interface for all applications.

Applications are simple objects that react to events by repainting their buffer. Each application has exactly one full-screen buffer.

consume_event(event: plainbox.vendor.textland.events.Event) → plainbox.vendor.textland.image.TextImage

Send an event to the controller.

Parameters:event – Event that the controller should handle

This method is called whenever the application should react to an event. The application may raise StopIteration to ask the display to exit.

class plainbox.vendor.textland.IDisplay

Abstract display system.

run(app: plainbox.vendor.textland.abc.IApplication) → None

Run forever, feeding events to the controller the controller can raise StopIteration to “quit”

class plainbox.vendor.textland.KeyboardData

KeyboardData(key,)

key

Alias for field number 0

class plainbox.vendor.textland.MouseData

MouseData(x, y, buttons)

buttons

Alias for field number 2

x

Alias for field number 0

y

Alias for field number 1

class plainbox.vendor.textland.Rect

Rect(x1, y1, x2, y2)

x1

Alias for field number 0

x2

Alias for field number 2

y1

Alias for field number 1

y2

Alias for field number 3

class plainbox.vendor.textland.Size

Size(width, height)

height

Alias for field number 1

width

Alias for field number 0

class plainbox.vendor.textland.TestDisplay(size=Size(width=80, height=25))

A display that records all images and replays pre-recorded events

display_image(image: plainbox.vendor.textland.image.TextImage) → None
get_display_size() → plainbox.vendor.textland.bits.Size
inject_event(event: plainbox.vendor.textland.events.Event) → None

Inject an event.

Events are served in FIFO mode.

wait_for_event() → plainbox.vendor.textland.events.Event
class plainbox.vendor.textland.TextAttributes
packed
reset()
static unpack(pa: int) -> (<class 'int'>, <class 'int'>, <class 'int'>)

Unpack packed attributes into (fg, bg, style)

class plainbox.vendor.textland.TextImage(size: plainbox.vendor.textland.bits.Size)

A rectangular, mutable text image.

The image supports NORMAL, REVERSE and UNDERLINE as per-cell attributes, the 8 colors described in the ANSI standard and the BOLD video attribute to render the foreground colors as bright (aka light or intensified).

get(x: int, y: int) → plainbox.vendor.textland.bits.Cell

Get a cell from (x, y)

Parameters:
  • x – X coordinate
  • y – Y coordinate
Returns:

Cell(c, pa)

print_frame() → None
put(x: int, y: int, c: str, pa: int) → None

Put character c with attributes pa into cell at (x, y)

Parameters:
  • x – X coordinate
  • y – Y coordinate
  • c – One character string
  • pa – Packed attribute (up to uint16_t)
plainbox.vendor.textland.get_display(display=None) → plainbox.vendor.textland.abc.IDisplay

Get a ITextDisplay according to TEXTLAND_DISPLAY environment variable

Table Of Contents

Previous topic

plainbox.vendor – vendorized packages

Next topic

Glossary

This Page