module terminal.backend_ren

renpy init python:

Functions

def get_size(obj, seen) -> None

Recursively finds size of objects

Arguments:

  • obj
  • seen
def get_terminal(name, command_handler) -> RenPyTerminal

Gets a terminal with a given name or creates a new one

Arguments:

  • name(str)
  • command_handler

Classes

class RenPyTerminal(pyte.HistoryScreen):

Methods

def __init__(
    self,
    command_handler,
    motd,
    prompt,
    prompt_len,
    print_motd,
    print_prompt,
    print_prompt_on_start,
    no_default_in_handling,
    no_default_out_handling,
    width,
    height
) -> None
def print(self, val) -> None
def get_empty_render_buffer(self) -> None
def reset_handlers(self) -> None
def put_output(self, out) -> None
def put_input(self, inp) -> None
def queue_thread_handler(self) -> None
def launch_program(self, cmd) -> None

Launch a given program using

Arguments:

  • cmd
def bell(self) -> None
def toggle_cursor(self, value) -> None

Handle terminal cursor blinking and explict calls to show or hide it.

Arguments:

  • value
def handle_backspace(self) -> None
def pty_handle_backspace(self, terminal, inp) -> None
def process_hidden_input(self, value) -> None
def pty_process_input(self, terminal, inp) -> None
def pty_render_handler(self, terminal, inp, out) -> None
def handle_ctrlc(self) -> None
def move_left(self) -> None
def move_right(self) -> None
def pty_move_handler(self, terminal, inp) -> None
def process_command(self) -> None
def pty_default_process_command(self, terminal, inp) -> None
def show_prompt(self, linebreak_before) -> None
def feed(self, data) -> None

A wrapper method around the self.stream.feed function. Also calls the render function.

Arguments:

  • data
def get_visible_lines(self) -> None
def get_render(self, frame) -> None
def terminal_history_up(self) -> None

Get the previously used command and send it to the prompt

def terminal_history_down(self) -> None

Get the afterwards used command and show it in prompt

def handle_char_click(self, x, y) -> None

Handle a character click by moving the cursor to the given position TODO: Rewrite as pty_handler

Arguments:

  • x
  • y
def handle_pageup(self) -> None

Handle a PAGEUP key press. Scrolls the terminal to the top. TODO: Rewrite as pty_handler

def handle_pagedown(self) -> None

Handle a PAGEDOWN key press. Scrolls the terminal to the bottom. TODO: Rewrite as pty_handler

def render(self) -> None

Sets the render_buffer to the output of get_visible_lines. TODO: Maybe also add partial rendering of lines?

def format_line(self, frame, current_y) -> None

class TermInputField(InputValue):

A nifty bodge to prevent the user from moving the cursor inside the hidden input field with something like CTRL+K_LEFT or CTRL+K_RIGHT

Methods

def __init__(self, terminal) -> None

Arguments:

  • terminal
def get_text(self) -> None
def set_text(self, s) -> None