Improved the SaveAs file dialogs

Hey folks… I’ve had another bug fix sitting on the side for a bit and more or less finished fixing it. It’s Github issue

In a nutshell it resolves around the locking mechanism in that you can’t Save As the current file to itself as the file is locked. The save() routine doesn;'t check for the lock, the saveAs() does, so if you try to saveAs with the same path/filename you get the critical error msg. Which BTW the error, is not critical, it just means you can’t save the file where you’re trying to.

So… I fixed a few things. (this applies to both Seamly2D and SeamlyMe)

  1. When you saveAs() the current file name is now displayed in the dialog instead of “pattern” or “measurements”.

Screenshot (1371)

  1. Doing a saveAs() with the current filename bypasses the lock check so it’s as if you just save()'d the file.

  2. The window title bar now displays the App name followed by the full path of the filename. And in the case of Seamly2D the pattern name is still followed by any associated measurement file. BTW… for those that are unaware - if the pattern has unsaved changes the file name is followed by an *. Also for what it’s worth… if a pattern had to be converted to the latest schema, the pattern is considered “unsaved” even without making any changes.

title

So… just a few other notes on saving as. If you try to save as to an existing file you still get the exists warning.

warning

If you’re trying to save the current file to another dir, and it has a file open with the same name, the lock check will then still display the file lock message - which I changed to a warning instead of the Critical Error.

lockwarning

3 Likes

Great stuff! @Douglas, thank you. Just one small question…

If I try to save the pattern to another dir and I change the name… Will it still give a warning? And if I don’t change the name, will it still save the file to the new location after it’s given the warning? And, if so (in either situation) and after the save, which file will be open in Seamly?

Ok, so not only 1 question. :blush:

1 Like

It will give a warning IF a file already exists with that filename and / or will give a warning if a file of the filename is open in another window and has a lock on it.

Same as above applies whether you change the name or not. When ever you Save As, and change the name, it should release the lock on the old name, create a new lock with the new name. If you don’t change the dir and name, then it just acts as if you saved the file. The original issue was if you tried to Save As without changing the dir and name, it threw the lock error. Now if the name hasnt changed it just bypasses the lock check like it does if you were saving it. That’s why I added the full path name in the title bar… you can tell which file is which if you more than 1 open with the same name. I should note that the locking mechanism only checks if there is a file open with a given name - not that open files are the same file. You could conceivably have 2 totally different patterns (in different folders) with the same name.

Also the Save as defaults to the currently opened file name in the save dialog, and if it’s a new file then it will default to “pattern” or “measurement” and [vit / vst].

3 Likes

Thank you very much, @Douglas :star_struck:

2 Likes