summaryrefslogtreecommitdiff
path: root/src/windows/input_placeholders.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/windows/input_placeholders.py')
-rw-r--r--src/windows/input_placeholders.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/windows/input_placeholders.py b/src/windows/input_placeholders.py
index 6ede6b32..8bcf1524 100644
--- a/src/windows/input_placeholders.py
+++ b/src/windows/input_placeholders.py
@@ -7,7 +7,7 @@ import logging
log = logging.getLogger(__name__)
-from . import Win, g_lock
+from . import Win
from theming import get_theme, to_curses_attr
@@ -25,11 +25,10 @@ class HelpText(Win):
log.debug('Refresh: %s', self.__class__.__name__)
if txt:
self.txt = txt
- with g_lock:
- self._win.erase()
- self.addstr(0, 0, self.txt[:self.width-1], to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
- self.finish_line(get_theme().COLOR_INFORMATION_BAR)
- self._refresh()
+ self._win.erase()
+ self.addstr(0, 0, self.txt[:self.width-1], to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
+ self.finish_line(get_theme().COLOR_INFORMATION_BAR)
+ self._refresh()
def do_command(self, key, raw=False):
return False
@@ -61,11 +60,10 @@ class YesNoInput(Win):
log.debug('Refresh: %s', self.__class__.__name__)
if txt:
self.txt = txt
- with g_lock:
- self._win.erase()
- self.addstr(0, 0, self.txt[:self.width-1], to_curses_attr(get_theme().COLOR_WARNING_PROMPT))
- self.finish_line(get_theme().COLOR_WARNING_PROMPT)
- self._refresh()
+ self._win.erase()
+ self.addstr(0, 0, self.txt[:self.width-1], to_curses_attr(get_theme().COLOR_WARNING_PROMPT))
+ self.finish_line(get_theme().COLOR_WARNING_PROMPT)
+ self._refresh()
def do_command(self, key, raw=False):
if key.lower() in self.key_func:
@@ -73,11 +71,14 @@ class YesNoInput(Win):
def prompt(self):
"""Monopolizes the input while waiting for a recognized keypress"""
- cl = []
- while self.value is None:
- if len(cl) == 1 and cl[0] in self.key_func:
- self.key_func[cl[0]]()
- cl = self.core.read_keyboard()
+ def cb(key):
+ if key in self.key_func:
+ self.key_func[key]()
+ if self.value is None:
+ # We didn’t finish with this prompt, continue monopolizing
+ # it again until value is set
+ keyboard.continuation_keys_callback = cb
+ keyboard.continuation_keys_callback = cb
def on_delete(self):
return