Commit a81e4af61b1e7b5f35baaf5d573ab959019a2c76
1 parent
a972d246
Exists in
master
and in
68 other branches
ENH: Select surface (to be affected by connectivity tools) using data notebook
Showing
4 changed files
with
14 additions
and
4 deletions
Show diff stats
invesalius/gui/data_notebook.py
... | ... | @@ -183,7 +183,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
183 | 183 | def __bind_events_wx(self): |
184 | 184 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) |
185 | 185 | self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel) |
186 | - | |
186 | + | |
187 | 187 | def __bind_events(self): |
188 | 188 | ps.Publisher().subscribe(self.AddMask, 'Add mask') |
189 | 189 | ps.Publisher().subscribe(self.EditMaskThreshold, |
... | ... | @@ -194,6 +194,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
194 | 194 | ps.Publisher().subscribe(self.OnChangeCurrentMask, 'Change mask selected') |
195 | 195 | ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') |
196 | 196 | |
197 | + | |
197 | 198 | def OnCloseProject(self, pubsub_evt): |
198 | 199 | self.DeleteAllItems() |
199 | 200 | self.mask_list_index = {} |
... | ... | @@ -245,6 +246,8 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
245 | 246 | |
246 | 247 | def OnItemActivated(self, evt): |
247 | 248 | self.ToggleItem(evt.m_itemIndex) |
249 | + | |
250 | + | |
248 | 251 | |
249 | 252 | def OnCheckItem(self, index, flag): |
250 | 253 | if flag: |
... | ... | @@ -366,6 +369,12 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
366 | 369 | def __bind_events_wx(self): |
367 | 370 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) |
368 | 371 | self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel) |
372 | + self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected) | |
373 | + | |
374 | + def OnItemSelected(self, evt): | |
375 | + last_surface_index = evt.m_itemIndex | |
376 | + ps.Publisher().sendMessage('Change surface selected', | |
377 | + last_surface_index) | |
369 | 378 | |
370 | 379 | def __init_columns(self): |
371 | 380 | ... | ... |
invesalius/gui/default_tasks.py
... | ... | @@ -269,7 +269,7 @@ class UpperTaskPanel(wx.Panel): |
269 | 269 | self.fold_panel.Bind(fpb.EVT_CAPTIONBAR, self.OnFoldPressCaption) |
270 | 270 | ps.Publisher().subscribe(self.OnEnableState, "Enable state project") |
271 | 271 | ps.Publisher().subscribe(self.OnOverwrite, 'Create surface from index') |
272 | - ps.Publisher().subscribe(self.OnFoldSurface, 'Update surface info in GUI') | |
272 | + ps.Publisher().subscribe(self.OnFoldSurface, 'Fold surface task') | |
273 | 273 | ps.Publisher().subscribe(self.OnFoldExport, 'Fold export task') |
274 | 274 | |
275 | 275 | def OnOverwrite(self, pubsub_evt): | ... | ... |
invesalius/gui/task_slice.py
invesalius/gui/task_surface.py
... | ... | @@ -454,11 +454,11 @@ wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP|wx.BOTTOM, 10) |
454 | 454 | if not overwrite or not self.surface_dict: |
455 | 455 | self.surface_dict[name] = index |
456 | 456 | index = self.combo_surface_name.Append(name) |
457 | - self.combo_surface_name.SetSelection(index) | |
458 | - | |
457 | + | |
459 | 458 | transparency = 100*pubsub_evt.data[4] |
460 | 459 | self.button_colour.SetColour(colour) |
461 | 460 | self.slider_transparency.SetValue(transparency) |
461 | + self.combo_surface_name.SetSelection(index) | |
462 | 462 | |
463 | 463 | def OnComboName(self, evt): |
464 | 464 | surface_name = evt.GetString() | ... | ... |