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
(char, attributes)¶ Bases:
tuple
-
attributes
¶ Alias for field number 1
-
char
¶ Alias for field number 0
-
count
(value) → integer -- return number of occurrences of value¶
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
-
class
plainbox.vendor.textland.
DrawingContext
(image: plainbox.vendor.textland.image.TextImage)[source]¶ Bases:
object
Context for simple text drawing
-
class
plainbox.vendor.textland.
Event
(kind, data)¶ Bases:
tuple
-
count
(value) → integer -- return number of occurrences of value¶
-
data
¶ Alias for field number 1
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
kind
¶ Alias for field number 0
-
-
class
plainbox.vendor.textland.
IApplication
[source]¶ Bases:
object
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[source]¶ 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.
KeyboardData
(key)¶ Bases:
tuple
-
count
(value) → integer -- return number of occurrences of value¶
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
key
¶ Alias for field number 0
-
-
class
plainbox.vendor.textland.
MouseData
(x, y, buttons)¶ Bases:
tuple
Alias for field number 2
-
count
(value) → integer -- return number of occurrences of value¶
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
x
¶ Alias for field number 0
-
y
¶ Alias for field number 1
-
class
plainbox.vendor.textland.
Rect
(x1, y1, x2, y2)¶ Bases:
tuple
-
count
(value) → integer -- return number of occurrences of value¶
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
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
(width, height)¶ Bases:
tuple
-
count
(value) → integer -- return number of occurrences of value¶
-
height
¶ Alias for field number 1
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
width
¶ Alias for field number 0
-
-
class
plainbox.vendor.textland.
TestDisplay
(size=Size(width=80, height=25))[source]¶ Bases:
plainbox.vendor.textland.display.AbstractDisplay
A display that records all images and replays pre-recorded events
-
inject_event
(event: plainbox.vendor.textland.events.Event) → None[source]¶ Inject an event.
Events are served in FIFO mode.
-
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.
TextAttributes
[source]¶ Bases:
object
-
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)[source]¶ Bases:
object
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).