Commit 695d43748caa067ff99908fe5de37ee99a06d930
1 parent
6b5eb748
Exists in
master
It was cleaning every mask when removing a mask
Showing
1 changed file
with
7 additions
and
7 deletions
Show diff stats
invesalius/project.py
@@ -119,14 +119,14 @@ class Project(metaclass=Singleton): | @@ -119,14 +119,14 @@ class Project(metaclass=Singleton): | ||
119 | 119 | ||
120 | def RemoveMask(self, index): | 120 | def RemoveMask(self, index): |
121 | new_dict = {} | 121 | new_dict = {} |
122 | + new_index = 0 | ||
122 | for i in self.mask_dict: | 123 | for i in self.mask_dict: |
123 | - mask = self.mask_dict[i] | ||
124 | - mask.cleanup() | ||
125 | - if i < index: | ||
126 | - new_dict[i] = self.mask_dict[i] | ||
127 | - if i > index: | ||
128 | - new_dict[i-1] = self.mask_dict[i] | ||
129 | - new_dict[i-1].index = i-1 | 124 | + if i == index: |
125 | + mask = self.mask_dict[i] | ||
126 | + mask.cleanup() | ||
127 | + else: | ||
128 | + new_dict[new_index] = self.mask_dict[i] | ||
129 | + new_index += 1 | ||
130 | self.mask_dict = new_dict | 130 | self.mask_dict = new_dict |
131 | 131 | ||
132 | def GetMask(self, index): | 132 | def GetMask(self, index): |