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

Implement saving and reloading of a global config file #37

Closed

Conversation

shssoichiro
Copy link

@shssoichiro shssoichiro commented Sep 29, 2021

This is intended as a potential solution to #8. It is rather rough, I am not familiar with PyQT and this is probably not the ideal way to do things. However, it does work.

This changes the current storage, which is per vapoursynth script, to a per-file storage which contains only the elements relevant to that video (scening, last frame viewed, etc.), and a global config file, stored in either ~/.config/vspreview or %APPDATA%/vspreview depending on OS, which contains a user's settings they would like to carry over between sessions, such as window dimensions and which toolbars are open. This is a breaking change to how configs currently work, but it will not require any user intervention, as vspreview will simply issue ignorable warnings, and on close will overwrite the storage file with the new format.

The reason I took this approach for saving and loading with a dict instead of with yaml tags is because yaml tags seemed to automatically place the entire yaml object into our main class. That is not compatible with what we want to do here, which is load some components from one file, and some components from another file, therefore this more manual but fine-grained approach was taken.

@Endilll
Copy link
Owner

Endilll commented Sep 29, 2021

User can very well have different UI setups for different projects. I'm sure layout for working with DVD and 4K are quite different in terms of window size. Same for opened toolbars: some sources require you to go through video and create a list for scenes that require additional processing, some doesn't. And you don't want Scening toolbar for the latter.

While I agree that having global config is beneficial, and makes space for some constants currently hardcoded in main.py, a major design effort is required for the whole config subsystem before touching the source code. Current implementation proves design points I put there initially to be correct, but I missed too many use cases back then, and implementation is quite convoluted in terms of what's happening underneath.

@Endilll
Copy link
Owner

Endilll commented Sep 29, 2021

Since I'm not sure what direction VSP is going to take (and very scarce on time to think about it), there's no way I can be sure that this PR is a move in the right direction.

What I also don't like about this PR is that Misc toolbar is concerned with all other toolbars. Toolbars being independent even when it comes to saving and loading state is a strong point of current design.

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.

2 participants