Screen

class Screen(items)[source]

Bases: object

Initialize the screen window Attributes

window: A full curses screen window width: The width of window height: The height of window max_lines: Maximum visible line count for result_window top: Available top line position for current page (used on scrolling) bottom: Available bottom line position for whole pages (as length of items) current: Current highlighted line number (as window cursor) page: Total page count which being changed corresponding to result of a query (starts from 0) ┌————————————–┐ |1. Item | |--------------------------------------| <- top = 1 |2. Item | |3. Item | |4./Item///////////////////////////////| <- current = 3 |5. Item | |6. Item | |7. Item | |8. Item | <- max_lines = 7 |--------------------------------------| |9. Item | |10. Item | <- bottom = 10 | | | | <- page = 1 (0 and 1) └————————————–┘

Returns

None

Methods

batch

display

Display the items on window

init_curses

Setup the curses

input_stream

Waiting an input and run a proper method according to type of input

paging

Paging the window when pressing left/right arrow keys

run

Continue running the TUI until get interrupted

scroll

Scrolling the window when pressing up/down arrow keys

Attributes

DOWN

UP

__init__(items)[source]

Initialize the screen window Attributes

window: A full curses screen window width: The width of window height: The height of window max_lines: Maximum visible line count for result_window top: Available top line position for current page (used on scrolling) bottom: Available bottom line position for whole pages (as length of items) current: Current highlighted line number (as window cursor) page: Total page count which being changed corresponding to result of a query (starts from 0) ┌————————————–┐ |1. Item | |--------------------------------------| <- top = 1 |2. Item | |3. Item | |4./Item///////////////////////////////| <- current = 3 |5. Item | |6. Item | |7. Item | |8. Item | <- max_lines = 7 |--------------------------------------| |9. Item | |10. Item | <- bottom = 10 | | | | <- page = 1 (0 and 1) └————————————–┘

Returns

None

display()[source]

Display the items on window

init_curses()[source]

Setup the curses

input_stream()[source]

Waiting an input and run a proper method according to type of input

paging(direction)[source]

Paging the window when pressing left/right arrow keys

run()[source]

Continue running the TUI until get interrupted

scroll(direction)[source]

Scrolling the window when pressing up/down arrow keys