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.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/windows/input_placeholders.py b/src/windows/input_placeholders.py
index 8bcf1524..496417d1 100644
--- a/src/windows/input_placeholders.py
+++ b/src/windows/input_placeholders.py
@@ -41,7 +41,7 @@ class YesNoInput(Win):
A Window just displaying a Yes/No input
Used to ask a confirmation
"""
- def __init__(self, text=''):
+ def __init__(self, text='', callback=None):
Win.__init__(self)
self.key_func = {
'y' : self.on_yes,
@@ -49,6 +49,7 @@ class YesNoInput(Win):
}
self.txt = text
self.value = None
+ self.callback = callback
def on_yes(self):
self.value = True
@@ -68,17 +69,8 @@ class YesNoInput(Win):
def do_command(self, key, raw=False):
if key.lower() in self.key_func:
self.key_func[key]()
-
- def prompt(self):
- """Monopolizes the input while waiting for a recognized keypress"""
- 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
+ if self.value is not None and self.callback is not None:
+ return self.callback()
def on_delete(self):
return