awsc.termui.ui.UI
- class awsc.termui.ui.UI
- UI singleton object. Handles the main loop of a termui application. - Attributes:
- debugint
- Debug level. Should be unused most of the time. 
- top_blockawsc.termui.block.Block
- The topmost block which spans the screen. Should be used as the parent of all top level blocks displayed on the screen. 
- last_painttime.Time
- Timer tracking when the last paint event occurred. 
- last_size_refreshtime.Time
- Timer tracking when the last refresh of screen size occurred. Screen size refresh is an expensive operation for some reason. 
- termblessed.Terminal
- The blessed Terminal that is being operated on. 
- _wint
- The width of the terminal in characters. Eventually consistent value, only changes on screen size refresh. 
- _hint
- The height of the terminal in characters. Eventually consistent value, only changes on screen size refresh. 
- exitbool
- If set, the program will exit on the next cycle of the main loop. 
- bufawsc.termui.screen.Screen
- The screen buffer that is manipulated in paint operations. Each control outputting directly to the screen is expensive and error prone. Manipulating a buffer and printing it all at once is significantly faster. 
- tickerslist(callable)
- A list of hooks to execute on each main loop cycle. 
- cache_dirstr
- A file cache temporary directory. Ideally erased upon graceful shutdown, with all of its contents. 
- mutexthreading.Lock
- Controls access to the input buffer. 
- input_bufferlist(blessed.keyboard.Keystroke)
- A list of unprocessed keyboard inputs. Handled in the event loop. 
- dirtybool
- Whether the UI requires a repaint. 
- restoreobject
- Stores the state of the terminal to restore to upon shutdown. Required to return the user to a working terminal after exiting. 
- suspend_input_bufferbool
- Atomic for disabling input buffering during unraw operations. 
 
 - Methods - before_paint()- Pre-paint hook for the UI. - buffer_input()- Input buffer loop. - check_one_key()- Retrieves a single keystroke within a timeout half a frame. - filecache(obj, callback, *args, **kwargs)- Retrieves a cached file from the temporary file cache. - filecache_path(obj, callback, *args, **kwargs)- Like filecache, except this one only returns the path of the cached file. - main()- Main loop function of the UI. - paint()- Main paint handler of the UI. - print(out[, xy, color, wrap, bounds, bold])- Prints a text to a specified area of the screen buffer. - print_centered(out, bounds[, color, bold])- Naive center-printing function. - process_input_buffer(start_time)- Processes part of the input buffer. - progress_bar_paint(perc)- Convenience function for painting a progress bar. - read_file(filename)- Reads a file in the correct encoding, or binary mode if mime type does not indicate it is a text file. - refresh_size()- Refreshes the cached width and height of the terminal if it has not been refreshed recently. - set_exit(*args, **kwargs)- Hotkey-compatible function that sets the graceful shutdown flag on the UI. - unraw(cmd, *args, **kwargs)- Runs a callback in a default terminal setting. - __init__()
- Initializes a UI object. 
 - Methods - __init__()- Initializes a UI object. - before_paint()- Pre-paint hook for the UI. - buffer_input()- Input buffer loop. - check_one_key()- Retrieves a single keystroke within a timeout half a frame. - filecache(obj, callback, *args, **kwargs)- Retrieves a cached file from the temporary file cache. - filecache_path(obj, callback, *args, **kwargs)- Like filecache, except this one only returns the path of the cached file. - main()- Main loop function of the UI. - paint()- Main paint handler of the UI. - print(out[, xy, color, wrap, bounds, bold])- Prints a text to a specified area of the screen buffer. - print_centered(out, bounds[, color, bold])- Naive center-printing function. - process_input_buffer(start_time)- Processes part of the input buffer. - progress_bar_paint(perc)- Convenience function for painting a progress bar. - read_file(filename)- Reads a file in the correct encoding, or binary mode if mime type does not indicate it is a text file. - refresh_size()- Refreshes the cached width and height of the terminal if it has not been refreshed recently. - set_exit(*args, **kwargs)- Hotkey-compatible function that sets the graceful shutdown flag on the UI. - unraw(cmd, *args, **kwargs)- Runs a callback in a default terminal setting. - Attributes - dim- Read-only property for the dimensions of the terminal. - height- Read-only property for the height of the terminal. - width- Read-only property for the width of the terminal.