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,7 +183,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
| 183 | def __bind_events_wx(self): | 183 | def __bind_events_wx(self): |
| 184 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) | 184 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) |
| 185 | self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel) | 185 | self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel) |
| 186 | - | 186 | + |
| 187 | def __bind_events(self): | 187 | def __bind_events(self): |
| 188 | ps.Publisher().subscribe(self.AddMask, 'Add mask') | 188 | ps.Publisher().subscribe(self.AddMask, 'Add mask') |
| 189 | ps.Publisher().subscribe(self.EditMaskThreshold, | 189 | ps.Publisher().subscribe(self.EditMaskThreshold, |
| @@ -194,6 +194,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -194,6 +194,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
| 194 | ps.Publisher().subscribe(self.OnChangeCurrentMask, 'Change mask selected') | 194 | ps.Publisher().subscribe(self.OnChangeCurrentMask, 'Change mask selected') |
| 195 | ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | 195 | ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') |
| 196 | 196 | ||
| 197 | + | ||
| 197 | def OnCloseProject(self, pubsub_evt): | 198 | def OnCloseProject(self, pubsub_evt): |
| 198 | self.DeleteAllItems() | 199 | self.DeleteAllItems() |
| 199 | self.mask_list_index = {} | 200 | self.mask_list_index = {} |
| @@ -245,6 +246,8 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -245,6 +246,8 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
| 245 | 246 | ||
| 246 | def OnItemActivated(self, evt): | 247 | def OnItemActivated(self, evt): |
| 247 | self.ToggleItem(evt.m_itemIndex) | 248 | self.ToggleItem(evt.m_itemIndex) |
| 249 | + | ||
| 250 | + | ||
| 248 | 251 | ||
| 249 | def OnCheckItem(self, index, flag): | 252 | def OnCheckItem(self, index, flag): |
| 250 | if flag: | 253 | if flag: |
| @@ -366,6 +369,12 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -366,6 +369,12 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
| 366 | def __bind_events_wx(self): | 369 | def __bind_events_wx(self): |
| 367 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) | 370 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) |
| 368 | self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel) | 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 | def __init_columns(self): | 379 | def __init_columns(self): |
| 371 | 380 |
invesalius/gui/default_tasks.py
| @@ -269,7 +269,7 @@ class UpperTaskPanel(wx.Panel): | @@ -269,7 +269,7 @@ class UpperTaskPanel(wx.Panel): | ||
| 269 | self.fold_panel.Bind(fpb.EVT_CAPTIONBAR, self.OnFoldPressCaption) | 269 | self.fold_panel.Bind(fpb.EVT_CAPTIONBAR, self.OnFoldPressCaption) |
| 270 | ps.Publisher().subscribe(self.OnEnableState, "Enable state project") | 270 | ps.Publisher().subscribe(self.OnEnableState, "Enable state project") |
| 271 | ps.Publisher().subscribe(self.OnOverwrite, 'Create surface from index') | 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 | ps.Publisher().subscribe(self.OnFoldExport, 'Fold export task') | 273 | ps.Publisher().subscribe(self.OnFoldExport, 'Fold export task') |
| 274 | 274 | ||
| 275 | def OnOverwrite(self, pubsub_evt): | 275 | def OnOverwrite(self, pubsub_evt): |
invesalius/gui/task_slice.py
| @@ -147,6 +147,7 @@ class InnerTaskPanel(wx.Panel): | @@ -147,6 +147,7 @@ class InnerTaskPanel(wx.Panel): | ||
| 147 | ps.Publisher().sendMessage('Create surface from index', | 147 | ps.Publisher().sendMessage('Create surface from index', |
| 148 | (self.GetMaskSelected(), | 148 | (self.GetMaskSelected(), |
| 149 | overwrite)) | 149 | overwrite)) |
| 150 | + ps.Publisher().sendMessage('Fold surface task') | ||
| 150 | else: | 151 | else: |
| 151 | dlg.InexistentMask() | 152 | dlg.InexistentMask() |
| 152 | 153 |
invesalius/gui/task_surface.py
| @@ -454,11 +454,11 @@ wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP|wx.BOTTOM, 10) | @@ -454,11 +454,11 @@ wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP|wx.BOTTOM, 10) | ||
| 454 | if not overwrite or not self.surface_dict: | 454 | if not overwrite or not self.surface_dict: |
| 455 | self.surface_dict[name] = index | 455 | self.surface_dict[name] = index |
| 456 | index = self.combo_surface_name.Append(name) | 456 | index = self.combo_surface_name.Append(name) |
| 457 | - self.combo_surface_name.SetSelection(index) | ||
| 458 | - | 457 | + |
| 459 | transparency = 100*pubsub_evt.data[4] | 458 | transparency = 100*pubsub_evt.data[4] |
| 460 | self.button_colour.SetColour(colour) | 459 | self.button_colour.SetColour(colour) |
| 461 | self.slider_transparency.SetValue(transparency) | 460 | self.slider_transparency.SetValue(transparency) |
| 461 | + self.combo_surface_name.SetSelection(index) | ||
| 462 | 462 | ||
| 463 | def OnComboName(self, evt): | 463 | def OnComboName(self, evt): |
| 464 | surface_name = evt.GetString() | 464 | surface_name = evt.GetString() |