quickie.utils.console.QkConsole

class quickie.utils.console.QkConsole(*args, **kwargs)

Extends the rich console to add more utility methods.

__init__(*args, **kwargs)

Initialize the console.

Methods

__init__(*args, **kwargs)

Initialize the console.

begin_capture()

Begin capturing console output.

bell()

Play a 'bell' sound (if supported by the terminal).

capture()

A context manager to capture the result of print() or log() in a string, rather than writing it to the console.

clear([home])

Clear the screen.

clear_live()

Clear the Live instance.

confirm(prompt[, default])

Prompt the user for confirmation.

control(*control)

Insert non-printing control codes.

end_capture()

End capture mode and return captured string.

export_html(*[, theme, clear, code_format, ...])

Generate HTML from console contents (requires record=True argument in constructor).

export_svg(*[, title, theme, clear, ...])

Generate an SVG from the console contents (requires record=True in Console constructor).

export_text(*[, clear, styles])

Generate text from console contents (requires record=True argument in constructor).

get_style(name, *[, default])

Get a Style instance by its theme name or parse a definition.

input([prompt, markup, emoji, password, stream])

Displays a prompt and waits for input from the user.

line([count])

Write new line(s).

log(*objects[, sep, end, style, justify, ...])

Log rich content to the terminal.

measure(renderable, *[, options])

Measure a renderable.

on_broken_pipe()

This function is called when a BrokenPipeError is raised.

out(*objects[, sep, end, style, highlight])

Output to the terminal.

pager([pager, styles, links])

A context manager to display anything printed within a "pager".

pop_render_hook()

Pop the last renderhook from the stack.

pop_theme()

Remove theme from top of stack, restoring previous theme.

print(*objects[, sep, end, style, justify, ...])

Print to the console.

print_error(*args, **kwargs)

Print an error message.

print_exception(*[, width, extra_lines, ...])

Prints a rich render of the last exception and traceback.

print_info(*args, **kwargs)

Print an info message.

print_json([json, data, indent, highlight, ...])

Pretty prints JSON.

print_success(*args, **kwargs)

Print a success message.

print_warning(*args, **kwargs)

Print a warning message.

prompt(prompt, *[, password, choices, ...])

Prompt the user for input.

push_render_hook(hook)

Add a new render hook to the stack.

push_theme(theme, *[, inherit])

Push a new theme on to the top of the stack, replacing the styles from the previous theme.

render(renderable[, options])

Render an object in to an iterable of Segment instances.

render_lines(renderable[, options, style, ...])

Render objects in to a list of lines.

render_str(text, *[, style, justify, ...])

Convert a string to a Text instance.

rule([title, characters, style, align])

Draw a line with optional centered title.

save_html(path, *[, theme, clear, ...])

Generate HTML from console contents and write to a file (requires record=True argument in constructor).

save_svg(path, *[, title, theme, clear, ...])

Generate an SVG file from the console contents (requires record=True in Console constructor).

save_text(path, *[, clear, styles])

Generate text from console and save to a given location (requires record=True argument in constructor).

screen([hide_cursor, style])

Context manager to enable and disable 'alternative screen' mode.

set_alt_screen([enable])

Enables alternative screen mode.

set_live(live)

Set Live instance.

set_window_title(title)

Set the title of the console terminal window.

show_cursor([show])

Show or hide the cursor.

status(status, *[, spinner, spinner_style, ...])

Display a status and spinner.

update_screen(renderable, *[, region, options])

Update the screen at a given offset.

update_screen_lines(lines[, x, y])

Update lines of the screen at a given offset.

use_theme(theme, *[, inherit])

Use a different theme for the duration of the context manager.

Attributes

color_system

Get color system string.

encoding

Get the encoding of the console file, e.g. "utf-8".

file

Get the file object to write to.

height

Get the height of the console.

is_alt_screen

Check if the alt screen was enabled.

is_dumb_terminal

Detect dumb terminal.

is_terminal

Check if the console is writing to a terminal.

options

Get default console options.

size

Get the size of the console.

width

Get the width of the console.