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

Storage class #1225

Merged
merged 27 commits into from Nov 8, 2022
Merged

Storage class #1225

merged 27 commits into from Nov 8, 2022

Conversation

vkbo
Copy link
Owner

@vkbo vkbo commented Nov 7, 2022

Summary:

This PR adds a storage class that sits between the project class and the disk storage of a novelWriter project. It has been untangled from within the project class. The main reasons for doing this is to both reduce the complexity of the project class, and to make it possible to modify how projects are stored to include single file storage as an option.

The storage class doesn't handle the I/O as it is now written. The idea is to keep the current model for reading and writing individual files even when a single file storage options is added. The storage class instead provides a ruintime path to the various files in the case of meta data files, and for project content it provides an object for I/O to the component file.

The idea for single file storage is to use an archive format between sessions, and extract the archive to a sensible location when the project is open. I currently do not want to set up an in-memory model, however the storage class can in principle be extended to such a feature by re-implementing how meta data files are accessed. For project content, the change could be handled internally in the storage class.

This PR also:

  • Moves the new project tool to the doctools module, which has been renamed to coretools.
  • Restructures the project XML so that meta data is moved to attributes in more sensible locations. This makes the file format more consistent. The format version is bumped to 1.5.
  • Makes the pack/unpack of project items use the same data structure.
  • Adds UUIDs to projects.

Related Issue(s):

Resolves #1152
Resolves #1222

Reviewer's Checklist:

  • 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
  • Documentation (as docstrings) is complete and understandable
  • Only files that have been actively changed are committed

@vkbo vkbo added this to the Release 2.0 RC 2 milestone Nov 7, 2022
@vkbo vkbo merged commit 5999e72 into main Nov 8, 2022
@vkbo vkbo deleted the storage_class branch November 8, 2022 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactoring: Project storage New project wizard should create then open
1 participant