diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-12-16 17:18:20 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-12-16 17:18:20 +0000 |
commit | a085b67f865b8074bfd41800250c342c73b931ae (patch) | |
tree | abfb8f3a94f72f700259b2642d6ef5b9ad8311f0 | |
parent | d8cf82ce9fd70e4bb383572dd0fd5cb8d48e1cfe (diff) |
prevent multiple 'index locked' notifications
by keeping a "was locked" flag in the UI.
Once changes are successfully flushed, we use a single "all clear"
notification.
-rw-r--r-- | alot/commands/globals.py | 8 | ||||
-rw-r--r-- | alot/ui.py | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 6509e554..9abadbe3 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -470,13 +470,19 @@ class FlushCommand(Command): if callable(self.callback): self.callback() logging.debug('flush complete') + if ui.db_was_locked: + ui.notify('changes flushed') + ui.db_was_locked = False + except DatabaseLockedError: timeout = settings.get('flush_retry_timeout') def f(*args): self.apply(ui) ui.mainloop.set_alarm_in(timeout, f) - ui.notify('index locked, will try again in %d secs' % timeout) + if not ui.db_was_locked: + ui.notify('index locked, will try again in %d secs' % timeout) + ui.db_was_locked = True ui.update() return @@ -29,6 +29,8 @@ class UI(object): """points to currently active :class:`~alot.buffers.Buffer`""" dbman = None """Database Manager (:class:`~alot.db.manager.DBManager`)""" + db_was_locked = False + """flag used to prevent multiple 'index locked' notifications""" mode = 'global' """interface mode identifier - type of current buffer""" commandprompthistory = [] |