todoman icon indicating copy to clipboard operation
todoman copied to clipboard

Create interactive command for curses interface (for discussion purposes)

Open Pi2048 opened this issue 8 years ago • 15 comments

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 ones
  • e: Edit, edit the currently highlighted item
  • n: New, create a new item in this database
  • m: Move, move the currently highlighted item to a database
  • c: Copy, copy the currently highlighted item to a database
  • d: Delete, delete the currently highlighted item
  • D: Delete all completed, delete all tasks in the database that are completed
  • h: Hide or show completed tasks in the database
  • j and k are like 'up' and 'down', like in vim
  • space or enter toggles 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.

Pi2048 avatar Jan 11 '17 00:01 Pi2048

First bug found: if I create a new item, it defaults to completed, without regard to the information the user provided in the editor.

Pi2048 avatar Jan 11 '17 00:01 Pi2048

Also, please rebase onto master and add yourself to AUTHORS.

WhyNotHugo avatar Jan 11 '17 01:01 WhyNotHugo

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.

untitaker avatar Jan 11 '17 10:01 untitaker

I generally feel like a lot of classes are unnecessarily prefixed by Todoman.

untitaker avatar Jan 11 '17 10:01 untitaker

@Pieter1024 it's been a while. Are you still willing to work on this?

untitaker avatar Feb 13 '17 11:02 untitaker

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.

WhyNotHugo avatar Feb 13 '17 12:02 WhyNotHugo

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.

WhyNotHugo avatar Feb 18 '17 16:02 WhyNotHugo

I'll make a separate PR for the logging.

untitaker avatar Feb 18 '17 17:02 untitaker

See #106

untitaker avatar Feb 18 '17 17:02 untitaker

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).

WhyNotHugo avatar Feb 18 '17 18:02 WhyNotHugo

Move TodoEditor into this module, rename ui to formatter and move cli, formatter, interactive into a new ui subpackag

untitaker avatar Feb 18 '17 18:02 untitaker

I just tried to refactor and bumped into a few design limits of the current datamodel

untitaker avatar Feb 18 '17 18:02 untitaker

Proposal seems great.

Do these limitations block the refactor? Or are they for future reference?

WhyNotHugo avatar Feb 19 '17 14:02 WhyNotHugo

I think so, the API isn't very pleasing for this usage.

Particularly the split between Todo and FileTodo is problematic.

untitaker avatar Feb 19 '17 14:02 untitaker

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?).

WhyNotHugo avatar Feb 19 '17 15:02 WhyNotHugo