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

Allow multiple roots of same class #1031

Merged
merged 17 commits into from
Apr 17, 2022
Merged

Allow multiple roots of same class #1031

merged 17 commits into from
Apr 17, 2022

Conversation

vkbo
Copy link
Owner

@vkbo vkbo commented Apr 3, 2022

Summary:

This PR allows each class of root folders to be added multiple times. For notes, this is trivial as no part of the code cares about what root folder a note is in, only what class the folder is. However, for novel documents, the outline and novel tree treats them all as one, which defeats the purpose of allowing multiple novels in one project.

To solve this, the items now track what root folder they belong to. This more or less renders the class setting redundant as it is determined by the root folder, but it is kept anyway because it is faster to look up directly than via the root folder handle. However, the synchronisation of these settings are updated each time an item is changed as well as at load time.

This PR also simplifies the creation of new items, and the updating of settings when an item is moved. A lot more decisions are now handled by the NWItem class itself. Most decisions are now taken in a central place instead of relying on a lot of in-place checks where changes to items are made. This significantly simplifies the logic in the project tree class for instance.

Due to these changes, several restrictions on drag and drop have been lifted. The remaining rules are:

  • Files can be moved anywhere, but they are converted to a Note if the root folder does not allow novel documents.
  • Folders can only be moved within the same root folder, but can be moved otherwise freely.
  • Root folders cannot be moved at all by drag and drop, but can still be moved from the menu.
  • Items cannot be dropped on top of a file (moved inside), as before.

Related Issue(s):

Resolves #967

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 1.7 Beta 1 milestone Apr 3, 2022
@vkbo vkbo merged commit e938ea8 into main Apr 17, 2022
@vkbo vkbo deleted the multi_root branch April 17, 2022 17:35
@vkbo vkbo mentioned this pull request Apr 17, 2022
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.

Support for serie novels
1 participant