summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-12-18 00:09:41 +0100
committermathieui <mathieui@mathieui.net>2012-12-18 00:22:36 +0100
commitf291d07567236fcf06396399461822697e715b4e (patch)
treedb42facd21614e833ab85adbe877fe51ae5e55b1
parent294a45fe093d5d029310d3a184a4f3cea413486b (diff)
downloadpoezio-f291d07567236fcf06396399461822697e715b4e.tar.gz
poezio-f291d07567236fcf06396399461822697e715b4e.tar.bz2
poezio-f291d07567236fcf06396399461822697e715b4e.tar.xz
poezio-f291d07567236fcf06396399461822697e715b4e.zip
Do not take 100% of the CPU when the certificate has changed
and let the user have a better chance to read the question entirely
-rw-r--r--src/core.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core.py b/src/core.py
index 6bd54efb..b0d8d832 100644
--- a/src/core.py
+++ b/src/core.py
@@ -16,6 +16,7 @@ import ssl
from functools import reduce
from hashlib import sha1
+from threading import Event
from datetime import datetime
from xml.etree import cElementTree as ET
@@ -119,6 +120,7 @@ class Core(object):
roster.set_node(self.xmpp.client_roster)
decorators.refresh_wrapper.core = self
self.paused = False
+ self.event = Event()
self.debug = False
self.remote_fifo = None
# a unique buffer used to store global informations
@@ -400,7 +402,6 @@ class Core(object):
res.append(current)
return res
while self.running:
- if self.paused: continue
big_char_list = [common.replace_key_with_bound(key)\
for key in self.read_keyboard()]
# whether to refresh after ALL keys have been handled
@@ -408,6 +409,7 @@ class Core(object):
if self.paused:
self.current_tab().input.do_command(char_list[0])
self.current_tab().input.prompt()
+ self.event.set()
continue
# Special case for M-x where x is a number
if len(char_list) == 1:
@@ -2922,14 +2924,14 @@ class Core(object):
else:
saved_input = self.current_tab().input
log.debug('\nWARNING: CERTIFICATE CHANGED old: %s, new: %s\n', cert, found_cert)
- input = windows.YesNoInput(text="WARNING! Certificate hash changed to %s. Accept? (y/n)" % found_cert)
+ input = windows.YesNoInput(text="WARNING! Server certificate has changed, accept? (y/n) (%s)" % found_cert)
self.current_tab().input = input
input.resize(1, self.current_tab().width, self.current_tab().height-1, 0)
input.refresh()
self.doupdate()
self.paused = True
while input.value is None:
- pass
+ self.event.wait()
self.current_tab().input = saved_input
self.paused = False
if input.value: