From 415c7d797910e7cac56439bf7ef020df3eba3eb6 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Sat, 7 Jan 2012 14:54:16 +0100 Subject: [PATCH 1/2] Fix abort_sleep missing crash in Blinkenlights UI This is a regression introduced when renaming signals due to the improved CTRL-C handling. Regression in 6.5.0 Signed-off-by: Sebastian Spaeth --- Changelog.draft.rst | 2 ++ offlineimap/ui/Curses.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Changelog.draft.rst b/Changelog.draft.rst index 1fb8079..e97953b 100644 --- a/Changelog.draft.rst +++ b/Changelog.draft.rst @@ -19,3 +19,5 @@ Changes Bug Fixes --------- +* Abort sleep in blinkenlights UI led to crash ('abort_signal' not existing), + regression from 6.5.0. diff --git a/offlineimap/ui/Curses.py b/offlineimap/ui/Curses.py index 9a2b97f..98055ba 100644 --- a/offlineimap/ui/Curses.py +++ b/offlineimap/ui/Curses.py @@ -157,11 +157,13 @@ class CursesAccountFrame: return tf def sleeping(self, sleepsecs, remainingsecs): - # show how long we are going to sleep and sleep + """show how long we are going to sleep and sleep + + :returns: Boolean, whether we want to abort the sleep""" self.drawleadstr(remainingsecs) self.ui.exec_locked(self.window.refresh) time.sleep(sleepsecs) - return self.account.abort_signal.is_set() + return self.account.get_abort_event() def syncnow(self): """Request that we stop sleeping asap and continue to sync""" From 968dcd57801799110f7749d041a49a17f5523ed1 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Sat, 7 Jan 2012 14:59:42 +0100 Subject: [PATCH 2/2] 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 --- Changelog.draft.rst | 5 ++++- offlineimap/ui/Curses.py | 8 +++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Changelog.draft.rst b/Changelog.draft.rst index e97953b..5c963f6 100644 --- a/Changelog.draft.rst +++ b/Changelog.draft.rst @@ -19,5 +19,8 @@ Changes 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. diff --git a/offlineimap/ui/Curses.py b/offlineimap/ui/Curses.py index 98055ba..af41d35 100644 --- a/offlineimap/ui/Curses.py +++ b/offlineimap/ui/Curses.py @@ -487,11 +487,9 @@ class Blinkenlights(UIBase, CursesUtil): if key < 1 or key > 255: return if chr(key) == 'q': - # Request to quit. - #TODO: this causes us to bail out in main loop when the thread exits - #TODO: review and rework this mechanism. - currentThread().set_exit_exception(SystemExit("User requested shutdown")) - self.terminate() + # Request to quit completely. + self.warn("Requested shutdown via 'q'") + offlineimap.accounts.Account.set_abort_event(self.config, 3) try: index = int(chr(key)) except ValueError: