Advanced Widgets

Advanced widgets are screens which can be used for a specific purpose. For example, reading input from the user and testing acceptance conditions on this input, or asking the user a yes/no question.

Advanced widget classes

class simpleline.render.adv_widgets.ErrorDialog(message)

Bases: simpleline.render.screen.UIScreen

Dialog screen for reporting errors to user.

input(args, key)

This dialog is closed by any input.

And causes the program to quit.

prompt(args=None)

Return the text to be shown as prompt or handle the prompt and return None.

Parameters:args (anything) – optional argument passed from switch_screen calls
Returns:returns an instance of Prompt with text to be shown next to the prompt for input or None to skip further input processing
Return type:Prompt instance|None
refresh(args=None)

Method which prepares the content desired on the screen to self.window.

Parameters:args (anything) – optional argument passed from switch_screen calls
class simpleline.render.adv_widgets.GetInputScreen(message)

Bases: simpleline.render.screen.UIScreen

Screen for getting user input.

add_acceptance_condition(acceptance_function, args=None)

Add acceptance condition to the conditions list.

Parameters:
  • acceptance_function (function(input, args) -> bool - function which takes user input (string) and arguments (args) and return True when input is accepted or False if rejected so we will ask for a new input.) – Functions that accepts or rejects a user input.
  • args (Anything.) – Second argument for acceptance_function the first one will be user input.
clear_acceptance_conditions()

Clear list of the acceptance conditions.

input(args, key)

Method called to process input. If the input is not handled here, return it.

Parameters:
  • key (str) – input string to process
  • args (anything) – optional argument passed from switch_screen calls
Returns:

return simpleline.render.InputState.PROCESSED if key was handled, simpleline.render.InputState.DISCARDED if the screen should not process input on the scheduler and key if you want it to.

Return type:

simpleline.render.InputState enum | str

prompt(args=None)

Return the text to be shown as prompt or handle the prompt and return None.

Parameters:args (anything) – optional argument passed from switch_screen calls
Returns:returns an instance of Prompt with text to be shown next to the prompt for input or None to skip further input processing
Return type:Prompt instance|None
refresh(args=None)

Method which prepares the content desired on the screen to self.window.

Parameters:args (anything) – optional argument passed from switch_screen calls
value

User input.

class simpleline.render.adv_widgets.GetPasswordInputScreen(message)

Bases: simpleline.render.adv_widgets.GetInputScreen

Screen for getting user password input.

class simpleline.render.adv_widgets.HelpScreen(help_path)

Bases: simpleline.render.screen.UIScreen

Screen to display a help message.

input(args, key)

Handle user input.

prompt(args=None)

Return the text to be shown as prompt or handle the prompt and return None.

Parameters:args (anything) – optional argument passed from switch_screen calls
Returns:returns an instance of Prompt with text to be shown next to the prompt for input or None to skip further input processing
Return type:Prompt instance|None
refresh(args=None)

Show the help.

class simpleline.render.adv_widgets.PasswordDialog(message=None)

Bases: simpleline.render.screen.UIScreen

Dialog screen for password input.

answer

The response can be None (no response) or the password entered.

input(args, key)

Method called to process input. If the input is not handled here, return it.

Parameters:
  • key (str) – input string to process
  • args (anything) – optional argument passed from switch_screen calls
Returns:

return simpleline.render.InputState.PROCESSED if key was handled, simpleline.render.InputState.DISCARDED if the screen should not process input on the scheduler and key if you want it to.

Return type:

simpleline.render.InputState enum | str

prompt(args=None)

Return the text to be shown as prompt or handle the prompt and return None.

Parameters:args (anything) – optional argument passed from switch_screen calls
Returns:returns an instance of Prompt with text to be shown next to the prompt for input or None to skip further input processing
Return type:Prompt instance|None
refresh(args=None)

Method which prepares the content desired on the screen to self.window.

Parameters:args (anything) – optional argument passed from switch_screen calls
class simpleline.render.adv_widgets.YesNoDialog(message)

Bases: simpleline.render.screen.UIScreen

Dialog screen for Yes - No questions.

answer

The response can be True (yes), False (no) or None (no response).

input(args, key)

Method called to process input. If the input is not handled here, return it.

Parameters:
  • key (str) – input string to process
  • args (anything) – optional argument passed from switch_screen calls
Returns:

return simpleline.render.InputState.PROCESSED if key was handled, simpleline.render.InputState.DISCARDED if the screen should not process input on the scheduler and key if you want it to.

Return type:

simpleline.render.InputState enum | str

prompt(args=None)

Return the text to be shown as prompt or handle the prompt and return None.

Parameters:args (anything) – optional argument passed from switch_screen calls
Returns:returns an instance of Prompt with text to be shown next to the prompt for input or None to skip further input processing
Return type:Prompt instance|None
refresh(args=None)

Method which prepares the content desired on the screen to self.window.

Parameters:args (anything) – optional argument passed from switch_screen calls