todoman
todoman copied to clipboard
Create interactive command for curses interface (for discussion purposes)
This is my first attempt at a curses-based interface for Todoman. I would like your feedback on what I've written so far. I am aware that it is by no means done, but before I start polishing it I would like to know I'm polishing the right thing. This PR is in reference to issue #62.
To run:
- Create a virtualenv as you would for development purposes
- Run
todo interactive
In the database listing view (the one you see when starting the program), the following commands are available:
l: ListChooser, choose a different database from the available onese: Edit, edit the currently highlighted itemn: New, create a new item in this databasem: Move, move the currently highlighted item to a databasec: Copy, copy the currently highlighted item to a databased: Delete, delete the currently highlighted itemD: Delete all completed, delete all tasks in the database that are completedh: Hide or show completed tasks in the databasejandkare like 'up' and 'down', like in vimspaceorentertoggles the currently highlighted item
In all screens, esc closes the current screen and returns you to the previous one.
I have one specific issue on which I would appreciate your views. When I create a new item, the current database should be updated. However, you defined the todos property of Database as a cached_property, which prevents this. I have, for now, changed the cached_property into a property, but I have already noticed this is a severe performance impairment. Could we resolve this situation in a neater way? E.g., could we explicitly add the new item to the cached database?
The following definitely still needs to be done:
- Help screen
- Status bar messages
- Some configuration options (hide_completed, default_list, sort_order)
I would also like to make a page that shows all upcoming tasks across databases.
First bug found: if I create a new item, it defaults to completed, without regard to the information the user provided in the editor.
Also, please rebase onto master and add yourself to AUTHORS.
I'd prefer if the interactive interface does deletions and marking things as done upon exiting the interface, so I can hit ^C to discard those changes.
I generally feel like a lot of classes are unnecessarily prefixed by Todoman.
@Pieter1024 it's been a while. Are you still willing to work on this?
Sorry, I really broke this PR with some substantial changes to todoman.
I'll can rebase it into master if you're still interesting on working on it, @Pieter1024.
I've rebased this to master and fixed style violations, but haven't really looked at the code more closely. Since @Pieter1024 hasn't responded back, will probably be picking this up in the coming days, if time allows.
I'll make a separate PR for the logging.
See #106
Thanks. I also think we should shuffle packages around:
ui: has some interactive stuff, and formatters.interactive: has more interactive stuff.
I think this should end up in:
ui/interactive(don't care which name): all the interactive stuff.formatting: Just the formatters (shared between cli and interactive).
Move TodoEditor into this module, rename ui to formatter and move cli, formatter, interactive into a new ui subpackag
I just tried to refactor and bumped into a few design limits of the current datamodel
Proposal seems great.
Do these limitations block the refactor? Or are they for future reference?
I think so, the API isn't very pleasing for this usage.
Particularly the split between Todo and FileTodo is problematic.
Maybe I'll have to revisit that. Having a separate class keeps the door open for separate storage types (will we ever want that!?). And I think is a good abstraction.
Maybe having the save logic in the database is a better choice (as far as abstraction goes), but we need to track "read from file" vs "read from cache". Maybe a flag in Todo will do (readonly?).