Commit 44470245e3337d83d1fa0056122b710322461874

Authored by Thiago Franco de Moraes
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 332  
333 333 # Opening the masks
334 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 336 filename = project["masks"][index]
337 337 filepath = os.path.join(dirpath, filename)
338 338 m = msk.Mask()
... ... @@ -343,7 +343,7 @@ class Project(metaclass=Singleton):
343 343  
344 344 # Opening the surfaces
345 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 347 filename = project["surfaces"][index]
348 348 filepath = os.path.join(dirpath, filename)
349 349 s = srf.Surface(int(index))
... ...