We no longer have to manually fix user’s broken patterns with reagrds to the out of order <groups> and <images> blocks.
The next release will automatically repair a broken file. Just have the user update Seamly.
We no longer have to manually fix user’s broken patterns with reagrds to the out of order <groups> and <images> blocks.
The next release will automatically repair a broken file. Just have the user update Seamly.
This is great! since there seems to be something that still occasionally causes files to have this corruption.
![]()
Yes. I figured I’d let you and Grace know since the 3 of us are the ones generally fixing users files. @seam did the initial fix to swap the groups and images blocks if they were in the wrong order. I added a fix to create empty blocks for any missing groups and / or images block so the files are always valid.
Hey
@Douglas Thanks for finishing this off and merging it!
I think the “create the missing blocks” part may cause a problem with older files, though (it does for me). On a clean build of current develop, none of the sample patterns in share/samples/patterns (all version 0.6.8) open any more. They fail with:
File exception. Exception: no declaration found for element 'images'
The repair runs in the converter’s constructor, before the file is validated against its own version’s schema and before it’s converted. So a pre-0.7.1 file gets an <images> element that its schema doesn’t allow yet. Files already at 0.7.1 or newer work fine, which may be why it didn’t show up in testing. It isn’t in a release yet, so no users are affected so far.
A possible fix is to only add the missing <groups>/<images> when the file’s version already allows them, or to run that step after conversion. The reordering itself is fine as it is. Happy to open an issue and PR for it if that works for you.
You are correct. Need to check version and only apply if >= <mages> was added to schema.
Easy fix… just have to check if the loaded version is older than the image import schema.
const int current_ver = GetVersion(getVersionStr()); const int image_import_ver = GetVersion(QStringLiteral("0.7.1")); // Image import introduced. if (current_ver >= image_import_ver) { if (fixGroupsOrder()) { saveRepairedCopy(); } }