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

Saveas feature #795

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Saveas feature #795

wants to merge 3 commits into from

Conversation

ollelogdahl
Copy link

My implementation of the feature suggested in #741

Works for the most part, missing 2 features:

  • By default, the save dialog window requires all files to end in .lpp. This does not make sense for a folder. How should the dialog be called instead?
  • The .lpp file doesn't get renamed to the same name as the new project, as the project files get strictly copied.

@ollelogdahl
Copy link
Author

ollelogdahl commented Oct 21, 2020

Unsure why mac is failing. Seems to be unrelated, has something to do with git.

@ubruhin
Copy link
Member

ubruhin commented Oct 22, 2020

Thanks for working on this!

Without reviewing the code in detail yet, my biggest concern is that this "Save as" feature behaves very differently compared to basically all other applications. A "Save as" usually saves the opened project to a new location, and any further modification on the project will be saved to the new location too. That's currently not the case - any further modification will be stored to the old project location, which is probably not what the user expects.

To be honest, I'm not sure how complicated it will be to change this behavior. Maybe it's a matter of a few lines of code, maybe it's a matter of hundreds of lines of code...

Another problem I experienced is that a lock file will be created immediately in the new project directory, which makes it impossible to open the new project. One has to restart LibrePCB to invalidate the lock.

By default, the save dialog window requires all files to end in .lpp. This does not make sense for a folder. How should the dialog be called instead?

Hmm, actually the dialog doesn't require the file to end in .lpp. I suspect the "file must end with .lpp" error comes from Project::create() because the second argument needs to be the lpp file name (not path), but you passed the directory path instead.

Unsure why mac is failing. Seems to be unrelated, has something to do with git.

Indeed 🤔 I restarted the CI job.

@dbrgn
Copy link
Member

dbrgn commented Oct 22, 2020

Without reviewing the code in detail yet, my biggest concern is that this "Save as" feature behaves very differently compared to basically all other applications. A "Save as" usually saves the opened project to a new location, and any further modification on the project will be saved to the new location too. That's currently not the case - any further modification will be stored to the old project location, which is probably not what the user expects.

This is what applications usually call "Save copy as" or "Save a copy" (e.g. Inkscape).

@ollelogdahl
Copy link
Author

Thank you for the feedback. You are right, it is kind of unintuitive. I will take a look at copying the project and switching to it, although not sure if it would require complete reload of the editor. If the change doesn't make sense, it might be worth going the Inkscape route.

As said, looking into it. The .lpp thing should be easily fixed. I will be taking a deeper look at the project loading, and asking here if i get any more questions. The intended way to save using the current project and transactionaldirectory/-filesystem design is quite difficult to comprehend (atleast for my part).

@ubruhin
Copy link
Member

ubruhin commented Oct 23, 2020

This is what applications usually call "Save copy as" or "Save a copy" (e.g. Inkscape).

Ah, interesting, so far I never saw such a feature :)

I will take a look at copying the project and switching to it, although not sure if it would require complete reload of the editor. If the change doesn't make sense, it might be worth going the Inkscape route.

Great! 🎉 Maybe it would not even be a big issue to reload the whole editor. We already do that when updating a project's library. Of course it would be much nicer without such a "workaround", but basically it works and is better than nothing ;)

@ollelogdahl
Copy link
Author

Great, good pointer. Will look at that code if the reload workaround is neccesary!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants