Commit fce40bdfc44fc335b5c963ce82fb496b34f3293e
1 parent
647494a0
Exists in
master
and in
51 other branches
Fixed: it was generating a surface when user cancels the operation
Showing
1 changed file
with
17 additions
and
13 deletions
Show diff stats
invesalius/gui/task_slice.py
@@ -146,6 +146,7 @@ class InnerTaskPanel(wx.Panel): | @@ -146,6 +146,7 @@ class InnerTaskPanel(wx.Panel): | ||
146 | overwrite = self.check_box.IsChecked() | 146 | overwrite = self.check_box.IsChecked() |
147 | algorithm = 'Default' | 147 | algorithm = 'Default' |
148 | options = {} | 148 | options = {} |
149 | + to_generate = True | ||
149 | if self.GetMaskSelected() != -1: | 150 | if self.GetMaskSelected() != -1: |
150 | sl = slice_.Slice() | 151 | sl = slice_.Slice() |
151 | if sl.current_mask.was_edited: | 152 | if sl.current_mask.was_edited: |
@@ -153,22 +154,25 @@ class InnerTaskPanel(wx.Panel): | @@ -153,22 +154,25 @@ class InnerTaskPanel(wx.Panel): | ||
153 | if dlgs.ShowModal() == wx.ID_OK: | 154 | if dlgs.ShowModal() == wx.ID_OK: |
154 | algorithm = dlgs.GetAlgorithmSelected() | 155 | algorithm = dlgs.GetAlgorithmSelected() |
155 | options = dlgs.GetOptions() | 156 | options = dlgs.GetOptions() |
157 | + else: | ||
158 | + to_generate = False | ||
156 | 159 | ||
157 | dlgs.Destroy() | 160 | dlgs.Destroy() |
158 | 161 | ||
159 | - mask_index = sl.current_mask.index | ||
160 | - method = {'algorithm': algorithm, | ||
161 | - 'options': options} | ||
162 | - srf_options = {"index": mask_index, | ||
163 | - "name": '', | ||
164 | - "quality": _('Optimal *'), | ||
165 | - "fill": False, | ||
166 | - "keep_largest": False, | ||
167 | - "overwrite": overwrite} | ||
168 | - | ||
169 | - Publisher.sendMessage('Create surface from index', | ||
170 | - {'method': method, 'options': srf_options}) | ||
171 | - Publisher.sendMessage('Fold surface task') | 162 | + if to_generate: |
163 | + mask_index = sl.current_mask.index | ||
164 | + method = {'algorithm': algorithm, | ||
165 | + 'options': options} | ||
166 | + srf_options = {"index": mask_index, | ||
167 | + "name": '', | ||
168 | + "quality": _('Optimal *'), | ||
169 | + "fill": False, | ||
170 | + "keep_largest": False, | ||
171 | + "overwrite": overwrite} | ||
172 | + | ||
173 | + Publisher.sendMessage('Create surface from index', | ||
174 | + {'method': method, 'options': srf_options}) | ||
175 | + Publisher.sendMessage('Fold surface task') | ||
172 | 176 | ||
173 | else: | 177 | else: |
174 | dlg.InexistentMask() | 178 | dlg.InexistentMask() |