From d49096dc4a04d835126032fce56856478e209874 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Wed, 8 Feb 2012 22:51:52 +0000 Subject: rewrite thread.RemoveCommand call flush and use "afterwards" callback for notification --- alot/commands/thread.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 527c84cd..31b4b19f 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -512,21 +512,16 @@ class RemoveCommand(Command): if (yield ui.choice(confirm_msg, select='yes', cancel='no')) == 'no': return - # remove messages - try: - for m in messages: - ui.dbman.remove_message(m) - except DatabaseError, e: - err_msg = str(e) - ui.notify(err_msg, priority='error') - logging.debug(err_msg) - return + # notify callback + def callback(): + ui.notify(ok_msg) + ui.apply_command(RefreshCommand()) - # notify - ui.notify(ok_msg) + # remove messages + for m in messages: + ui.dbman.remove_message(m, afterwards=callback) - # refresh buffer - ui.apply_command(RefreshCommand()) + ui.apply_command(FlushCommand()) @registerCommand(MODE, 'print', arguments=[ -- cgit v1.2.3