Make exit via 'q' key work again in Blinkenlights UI

With the new abort signal handler, we can send a signal that lets us
exit cleanly. Make use of this, rather than crashing out in ugly ways.

This affects only the Blinkenlights UI when pressing 'q'.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-01-07 14:59:42 +01:00
parent 415c7d7979
commit 968dcd5780
2 changed files with 7 additions and 6 deletions

View File

@ -19,5 +19,8 @@ Changes
Bug Fixes Bug Fixes
--------- ---------
* Abort sleep in blinkenlights UI led to crash ('abort_signal' not existing), * [Blinkenlights UI] Abort sleep led to crash ('abort_signal' not existing),
regression from 6.5.0.
* [Blinkenlights UI] Make exit via 'q' key work again cleanly
regression from 6.5.0. regression from 6.5.0.

View File

@ -487,11 +487,9 @@ class Blinkenlights(UIBase, CursesUtil):
if key < 1 or key > 255: if key < 1 or key > 255:
return return
if chr(key) == 'q': if chr(key) == 'q':
# Request to quit. # Request to quit completely.
#TODO: this causes us to bail out in main loop when the thread exits self.warn("Requested shutdown via 'q'")
#TODO: review and rework this mechanism. offlineimap.accounts.Account.set_abort_event(self.config, 3)
currentThread().set_exit_exception(SystemExit("User requested shutdown"))
self.terminate()
try: try:
index = int(chr(key)) index = int(chr(key))
except ValueError: except ValueError: