novelWriter icon indicating copy to clipboard operation
novelWriter copied to clipboard

Project and session goals

Open BlayW opened this issue 10 months ago • 9 comments

Summary:

I've added project settings for project word count goal, project completion target date, and a session word count goal that can optionally be automatically calculated based off the project completion target date. These are also visualised in the status bar as progress bars that update alongside the existing word count label in the status bar.

Related Issue(s):

Closes #2223

Reviewer's Checklist:

  • [x] The header of all files contain a reference to the repository license
  • [ ] The overall test coverage is increased or remains the same as before
  • [ ] All tests are passing
  • [ ] All flake8 checks are passing and the style guide is followed
  • [x] Documentation (as docstrings) is complete and understandable
  • [x] Only files that have been actively changed are committed

BlayW avatar Feb 20 '25 13:02 BlayW

Great! This is a good start.

Here are some ToDos:

  • I prefer to design a custom progress bar widget instead of relying on style sheets. Style sheets are annoying to deal with in terms of theme updates, so I only use them when there are no other options. I can create a new progress bar widget for this purpose. There are already two custom ones in the code, so it's pretty straightforward to duplicate and tweak.
  • I think this is a complex enough feature to warrant its own core class. If not for anything else other than handling the settings internally. Which means there would only be a single value added to NWProjectData.
  • The progress bars should be hidden if the goals are set to 0. I'm unsure whether 0 should be the default though.

I can handle the custom widget and the core class if you wish, or we can split them. The core class should be modelled after the NWStatus class. You don't need to use the NW prefix. I don't use those any more, and plan to remove them. ProjectGoal is a sensible name.

Some implementation comments:

  • In this project it is preferred to use Python native features before the Qt ones. Since the Qt library is implemented in C++ with a Python interface layer and two competing garbage collectors, it is simpler. So, just use the Python date module instead of QDate.
  • The PR will be run through flake8 linting with some rules and restrictions, so it's a good idea to also run it locally to avoid linting errors. I saw a few. Not sure what editor you use, but VSCode has flake8 support built into its Python extension.
  • Anything added to the project need to be 100% covered by tests. But we can handle that when everything else is done.

vkbo avatar Feb 20 '25 16:02 vkbo

All checks failed, but the tests fail because the project file format has changed, so that's a non-issue at this point.

vkbo avatar Feb 20 '25 16:02 vkbo

I initially considered adapting one of the existing custom progress bars, so I'll create the widget as a start, at least.

BlayW avatar Feb 20 '25 22:02 BlayW

Is it okay with you if I change a parent class for NProgressCircle that contains everything except paintEvent, it will reduce duplicate code I think.

BlayW avatar Feb 20 '25 23:02 BlayW

Is it okay with you if I change a parent class for NProgressCircle that contains everything except paintEvent, it will reduce duplicate code I think.

Just duplicate for now, and if it turns out they do not diverge, we can create the parent class later. I'm planning a different colouring feature for this progress bar, so I don't think they will stay that similar.

vkbo avatar Feb 21 '25 07:02 vkbo

My most recent push adds the new NProgressGoals progress bar class while retaining most of the control in the status bar.py file. I expect a lot of that functionality will be moved to the new core class, so I tried not to alter it at all beyond retaining the current functionality. I also removed the QDate usage in favour of date time.date objects and addressed the flake8 issues

BlayW avatar Feb 22 '25 19:02 BlayW

My most recent push adds the new NProgressGoals progress bar class while retaining most of the control in the status bar.py file. I expect a lot of that functionality will be moved to the new core class, so I tried not to alter it at all beyond retaining the current functionality. I also removed the QDate usage in favour of date time.date objects and addressed the flake8 issues

Thanks! I'll take a look at the branch a bit later and add the data class for the config.

I'm still wondering if the progress bars should be in the side panel rather than the status bar, but I will create an example and we can compare from screenshots. I need to see it side by side to get a good impression.

vkbo avatar Feb 22 '25 19:02 vkbo

Sorry for the slow progress from my side. I don't have time to work on new code right now as I've been very busy with work and other things. I'll get back to it soon.

vkbo avatar Mar 09 '25 13:03 vkbo

As you may have seen I've postponed remaining features till 2.8 while I work to get 2.7 done. I'll pick this up again when I start working on 2.8.

vkbo avatar Apr 24 '25 08:04 vkbo