diff options
author | mathieui <mathieui@mathieui.net> | 2015-01-28 09:46:51 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2015-01-28 09:54:30 +0100 |
commit | 3c46d49704de86635508439f524c684903dc81d3 (patch) | |
tree | 0c8e02a7a6f4d7e50e2d8842c86ce294e5189627 /src/windows | |
parent | 0a7b4360adb26b102d85f3191f1061ce7f8dceb6 (diff) | |
download | poezio-3c46d49704de86635508439f524c684903dc81d3.tar.gz poezio-3c46d49704de86635508439f524c684903dc81d3.tar.bz2 poezio-3c46d49704de86635508439f524c684903dc81d3.tar.xz poezio-3c46d49704de86635508439f524c684903dc81d3.zip |
Minor fixes to the certificate warning prompt (#2949)
- slightly lower the CPU usage (callback instead of active waiting w/ sleep)
- make the terminal beep so the user knows something happened
- prevent the user “escaping” the prompt by pressing /, s, or S
Diffstat (limited to 'src/windows')
-rw-r--r-- | src/windows/input_placeholders.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/windows/input_placeholders.py b/src/windows/input_placeholders.py index 4a6c6d72..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,6 +69,8 @@ class YesNoInput(Win): def do_command(self, key, raw=False): if key.lower() in self.key_func: self.key_func[key]() + if self.value is not None and self.callback is not None: + return self.callback() def on_delete(self): return |