Commit 44470245e3337d83d1fa0056122b710322461874
1 parent
46e91801
Exists in
master
Sorting surface and mask keys before opening project
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
invesalius/project.py
@@ -332,7 +332,7 @@ class Project(metaclass=Singleton): | @@ -332,7 +332,7 @@ class Project(metaclass=Singleton): | ||
332 | 332 | ||
333 | # Opening the masks | 333 | # Opening the masks |
334 | self.mask_dict = TwoWaysDictionary() | 334 | self.mask_dict = TwoWaysDictionary() |
335 | - for index in project.get("masks", []): | 335 | + for index in sorted(project.get("masks", []), key=lambda x: int(x)): |
336 | filename = project["masks"][index] | 336 | filename = project["masks"][index] |
337 | filepath = os.path.join(dirpath, filename) | 337 | filepath = os.path.join(dirpath, filename) |
338 | m = msk.Mask() | 338 | m = msk.Mask() |
@@ -343,7 +343,7 @@ class Project(metaclass=Singleton): | @@ -343,7 +343,7 @@ class Project(metaclass=Singleton): | ||
343 | 343 | ||
344 | # Opening the surfaces | 344 | # Opening the surfaces |
345 | self.surface_dict = {} | 345 | self.surface_dict = {} |
346 | - for index in project.get("surfaces", []): | 346 | + for index in sorted(project.get("surfaces", []), key=lambda x: int(x)): |
347 | filename = project["surfaces"][index] | 347 | filename = project["surfaces"][index] |
348 | filepath = os.path.join(dirpath, filename) | 348 | filepath = os.path.join(dirpath, filename) |
349 | s = srf.Surface(int(index)) | 349 | s = srf.Surface(int(index)) |