Commit e86b3287 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Allow commands to request user input.

parent d7f9f5c0
...@@ -72,7 +72,7 @@ class UIApplication(CLIApplicationBase): ...@@ -72,7 +72,7 @@ class UIApplication(CLIApplicationBase):
self.todolist, self.todolist,
p_output, p_output,
self._output, self._output,
lambda _: None, # TODO input self._input,
) )
if command.execute() != False: if command.execute() != False:
...@@ -152,6 +152,19 @@ class UIApplication(CLIApplicationBase): ...@@ -152,6 +152,19 @@ class UIApplication(CLIApplicationBase):
self.console.print_text(p_text) self.console.print_text(p_text)
def _input(self, p_question):
self._print_to_console(p_question)
# don't wait for the event loop to enter idle, there is a command
# waiting for input right now, so already go ahead and draw the
# question on screen.
self.mainloop.draw_screen()
user_input = self.mainloop.screen.get_input()
self._hide_console()
return user_input[0]
def run(self): def run(self):
self.todofile = TodoFile.TodoFile(config().todotxt()) self.todofile = TodoFile.TodoFile(config().todotxt())
self.todolist = TodoList.TodoList(self.todofile.read()) self.todolist = TodoList.TodoList(self.todofile.read())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment