Commit fce40bdfc44fc335b5c963ce82fb496b34f3293e

Authored by Thiago Franco de Moraes
1 parent 647494a0

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 146 overwrite = self.check_box.IsChecked()
147 147 algorithm = 'Default'
148 148 options = {}
  149 + to_generate = True
149 150 if self.GetMaskSelected() != -1:
150 151 sl = slice_.Slice()
151 152 if sl.current_mask.was_edited:
... ... @@ -153,22 +154,25 @@ class InnerTaskPanel(wx.Panel):
153 154 if dlgs.ShowModal() == wx.ID_OK:
154 155 algorithm = dlgs.GetAlgorithmSelected()
155 156 options = dlgs.GetOptions()
  157 + else:
  158 + to_generate = False
156 159  
157 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 177 else:
174 178 dlg.InexistentMask()
... ...