Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autorefresh todo list from disk #9

Open
felipesere opened this issue Aug 12, 2014 · 8 comments
Open

autorefresh todo list from disk #9

felipesere opened this issue Aug 12, 2014 · 8 comments

Comments

@felipesere
Copy link

Hi,
I wanted to use todotxt-machine as a view for my todo.txt.
I'll be adding most of my todos from todo.txt-vim while keeping todotxt-machine open on a separate tab.
Is it possible to make it refresh the list from the file?

@fdlm
Copy link
Contributor

fdlm commented Aug 17, 2014

I started implementing this functionality, since I need it to be able to sync my todo.txt over multiple devices but want to keep the terminal with todotxt-machine open. Find the code here: ad28e62

There are however a few things that need to be discussed. First of all, how to handle the case where you entered a new todo item within todotxt-machine but did not save it yet (e.g. because you forgot), and a new todo item is added from somewhere else. In my current implementation, all unsaved changes are lost, which obviously is not the way to go.

A possibility to overcome this would be to automatically save the todo.txt file after every change. IMHO, this shouldn't be a problem, but people have asked to be able to explicitly specify when todotxt-machine should write changes to disk (see Issue #6), so I don't know...

Any opinions?

@felipesere
Copy link
Author

I also started working on this :)
In my variation I use watchdog to watch the filesystem.

Saving any modification straight to disk should be valid. It does not help if the file is also being manipulated by a remote client. Imagine having you file in dropbox. Once you phone syncs those changes into dropbox, conflicts should pop up.
I would ignore "conflict resolution" for the time being.

I do think though that some refactoring is needed to make the code more manageable.

@fdlm
Copy link
Contributor

fdlm commented Aug 18, 2014

Great!

Using watchdog, are you able to update the todo list without waiting for a keypress? That would be really great. The downside is of course that it introduces another dependency, but it might be worth it!

The sync problem you mentioned comes up regardless of which todo.txt manager you use when using simple cloud solutions like Dropbox. I don't see how one could solve it within the application. So, I agree, we should ignore it.

@felipesere
Copy link
Author

Yeah, watchdog is pretty neat. As far as I can tell, it is multi-platform.
I'll see if I can push my branch into a fork some time this week.

@AnthonyDiGirolamo
Copy link
Owner

Watchdog looks very cool, I'd be happy to merge a pull request with that functionality. I'm currently working on throwing away the screen.py file which is completely unmaintainable and using urwid for the ui.

@matze
Copy link
Contributor

matze commented Aug 20, 2014

I'm currently working on throwing away the screen.py file which is completely unmaintainable and using urwid for the ui.

I hope you keep the UI elements as they are. I really appreciate the UI.

@AnthonyDiGirolamo
Copy link
Owner

I hope you keep the UI elements as they are. I really appreciate the UI.

I definitely want to keep the same ui appearance and feel.

@AnthonyDiGirolamo
Copy link
Owner

Hi felipesere, I've implemented reloading/reverting a todo.txt file from disk on a keypress (not automatically) implemented in the urwid branch now. Not all the original functionality is in the urwid branch. Hopefully that will help with implementing autoreloading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants