Commit 06754a17 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Don't write backups, todo files or update columns for read only commands

This addresses some slugginess that I encounter in the column UI. For
example, when doing an `ls` on the commandline, formerly it would
execute:

* Perform backups;
* Write the todo file (+ archive if applicable);
* Refresh all the columns;

All in all this takes quite a while.

CLIApplicationBase::_post_execute will now reset the dirty flag of the
todo list. Then writing stuff and refreshing columns will only occur
when the todo list is dirty.

Updating columns can still be made smarter. When an action is executed
on a specific todo item, only update those columns that contain that
item, or are related to it through dependencies.
parent 9b537b02
...@@ -236,6 +236,7 @@ class CLIApplicationBase(object): ...@@ -236,6 +236,7 @@ class CLIApplicationBase(object):
self.backup.save(self.todolist) self.backup.save(self.todolist)
self.todofile.write(self.todolist.print_todos()) self.todofile.write(self.todolist.print_todos())
self.todolist.dirty = False
self.backup = None self.backup = None
......
...@@ -164,8 +164,11 @@ class UIApplication(CLIApplicationBase): ...@@ -164,8 +164,11 @@ class UIApplication(CLIApplicationBase):
pass pass
def _post_execute(self): def _post_execute(self):
# store dirty flag because base _post_execute will reset it after flush
dirty = self.todolist.dirty
super()._post_execute() super()._post_execute()
if dirty:
for column, _ in self.columns.contents: for column, _ in self.columns.contents:
column.update() column.update()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment