raw_keys -- return raw keycodes as well as translated versions
This function will immediately return all the input since the
last time it was called. If there is no input pending it will
wait briefly for new input.
If raw_keys is False (default) this function will return a list
of keys pressed. If raw_keys is True this function will return
a ( keys pressed, raw keycodes ) tuple instead.
body -- a box widget for the body of the frame
header -- a flow widget for above the body (or None)
footer -- a flow widget for below the body (or None)
middle -- ( row offset(when +ve) or inset(when -ve),
focus widget, focus position, focus rows,
cursor coords or None )
top -- ( # lines to trim off top,
list of (widget, position, rows) tuples above focus
in order from bottom to top )
bottom -- ( # lines to trim off bottom,
list of (widget, position, rows) tuples below focus
in order from top to bottom )
position -- a position compatible with self.body.set_focus
offset_inset_rows -- either the number of rows between the
top of the listbox and the start of the focus widget (+ve
value) or the number of lines of the focus widget hidden off
the top edge of the listbox (-ve value) or 0 if the top edge
of the focus widget is aligned with the top edge of the
listbox (default if unspecified)
coming_from -- eiter 'above', 'below' or unspecified (None)
cursor_coords -- (x, y) tuple indicating the desired
column and row for the cursor, a (x,) tuple indicating only
the column for the cursor, or unspecified (None)
snap_rows -- the maximum number of extra rows to scroll
when trying to "snap" a selectable focus into the view
Move selection through the list elements scrolling when
necessary. 'up' and 'down' are first passed to widget in focus
in case that widget can handle them. 'page up' and 'page down'
are always handled by the ListBox.
Keystrokes handled by this widget are:
'up' up one line (or widget)
'down' down one line (or widget)
'page up' move cursor up one listbox length
'page down' move cursor down one listbox length
Set the focus position and try to keep the old focus in view.
position -- a position compatible with self.body.set_focus
coming_from -- set to 'above' or 'below' if you know that
old position is above or below the new position.
Move the location of the current focus relative to the top.
offset_inset -- either the number of rows between the
top of the listbox and the start of the focus widget (+ve
value) or the number of lines of the focus widget hidden off
the top edge of the listbox (-ve value) or 0 if the top edge
of the focus widget is aligned with the top edge of the
listbox
markup -- content of text widget, one of:
plain string -- string is displayed
( attr, markup2 ) -- markup2 is given attribute attr
[ markupA, markupB, ... ] -- list items joined together
align -- align mode or None (widget will use Text.align_mode)
wrap -- wrap mode or None (widget will use Text.wrap_mode)
Return line translation for mapping self.text to a canvas.
The line translation is a list of (l_pad, l_trim, r_trim, epos)
tuples. Each tuple in the line translation represents one row.
l_pad -- number of spaces to add on the left of the line
l_trim -- number of characters to remove from left of line
r_trim -- number of characters to remove from right of line
epos -- character index at the end of the line (start of next)
Return line translation for mapping self.text to a canvas.
The line translation is a list of (l_pad, l_trim, r_trim, epos)
tuples. Each tuple in the line translation represents one row.
l_pad -- number of spaces to add on the left of the line
l_trim -- number of characters to remove from left of line
r_trim -- number of characters to remove from right of line
epos -- character index at the end of the line (start of next)
Return line translation for mapping self.text to a canvas.
The line translation is a list of (l_pad, l_trim, r_trim, epos)
tuples. Each tuple in the line translation represents one row.
l_pad -- number of spaces to add on the left of the line
l_trim -- number of characters to remove from left of line
r_trim -- number of characters to remove from right of line
epos -- character index at the end of the line (start of next)
Custom alignment function:
fn( text, width, b, wrap_mode, align_mode )
text -- original text string to align
b -- line breaks calculated from wrap_mode function
wrap_mode -- current wrap_mode
align_mode -- current align_mode
Must return:
line translation (see Text.get_line_translation for description)
Custom wrapping function:
fn( text, width, wrap_mode )
text -- original text string to wrap
width -- max number of characters per row
wrap_mode -- current wrap_mode
Must return:
list of offsets into text for line breaks
eg. [4,6] would split "hallabaloo" into "hall","ab","aloo"
Replace curses_display.Screen class with HtmlGenerator.
Call this function before executing an application that uses
curses_display.Screen to have that code use HtmlGenerator instead.
sizes -- list of ( columns, rows ) tuples to be returned by each call
to HtmlGenerator.get_cols_rows()
keys -- list of lists of keys to be returned by each call to
HtmlGenerator.get_input()
Lists of keys may include "window resize" to force the application to
call get_cols_rows and read a new screen size.
For example, the following call will prepare an application to:
1. start in 80x25 with its first call to get_cols_rows()
2. take a screenshot when it calls draw_screen(..)
3. simulate 5 "down" keys from get_input()
4. take a screenshot when it calls draw_screen(..)
5. simulate keys "a", "b", "c" and a "window resize"
6. resize to 20x10 on its second call to get_cols_rows()
7. take a screenshot when it calls draw_screen(..)
8. simulate a "Q" keypress to quit the application