diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-02-08 22:51:52 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-02-08 22:55:00 +0000 |
commit | d49096dc4a04d835126032fce56856478e209874 (patch) | |
tree | 301ca6f7b1e7b7f612466777a50e365fbf9271fd | |
parent | ee4f6a9c9e0c48e0e2890eab8d39c520dd32ef9e (diff) |
rewrite thread.RemoveCommand
call flush and use "afterwards" callback for notification
-rw-r--r-- | alot/commands/thread.py | 21 |
1 files 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=[ |