Commit 91384f68e4e7f9ea6daedaefdccdcd0e468459a4
1 parent
cf86c0a2
Exists in
master
and in
68 other branches
ENC: Change mask name
Showing
3 changed files
with
16 additions
and
15 deletions
Show diff stats
invesalius/data/slice_.py
| ... | ... | @@ -32,6 +32,13 @@ class Slice(object): |
| 32 | 32 | ps.Publisher().subscribe(self.UpdateCursorPosition, |
| 33 | 33 | 'Update cursor position in slice') |
| 34 | 34 | ps.Publisher().subscribe(self.ShowMask, 'Show mask') |
| 35 | + ps.Publisher().subscribe(self.ChangeMaskName, 'Change mask name') | |
| 36 | + | |
| 37 | + def ChangeMaskName(self, pubsub_evt): | |
| 38 | + index, name = pubsub_evt.data | |
| 39 | + | |
| 40 | + proj = Project() | |
| 41 | + proj.mask_dict[index].name = name | |
| 35 | 42 | |
| 36 | 43 | |
| 37 | 44 | def ShowMask(self, pubsub_evt): | ... | ... |
invesalius/gui/data_notebook.py
| ... | ... | @@ -120,26 +120,13 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
| 120 | 120 | self.image_gray = Image.open("../icons/object_colour.jpg") |
| 121 | 121 | |
| 122 | 122 | def OnEditLabel(self, evt): |
| 123 | - print "Editing label", evt.GetLabel() | |
| 124 | - #print evt.GetImage() | |
| 125 | - #print evt.GetId() | |
| 126 | - print evt.GetIndex() | |
| 127 | - #print "--------" | |
| 128 | - #print evt.m_oldItemIndex | |
| 129 | - #print evt.m_itemIndex | |
| 130 | - #index = evt.GetIndex() | |
| 131 | - #print dir(evt) | |
| 132 | - | |
| 133 | - #print "Get item data:", self.GetItemData(index) | |
| 134 | - #print "Get item position:", self.GetItemPosition(index) | |
| 135 | - #print "Get next item:", self.GetNextItem(index) | |
| 123 | + print "Editing label", evt.GetIndex(), evt.GetLabel() | |
| 124 | + ps.Publisher().sendMessage('Change mask name', (evt.GetIndex(), evt.GetLabel())) | |
| 136 | 125 | evt.Skip() |
| 137 | 126 | |
| 138 | 127 | def OnItemActivated(self, evt): |
| 139 | - print "OnItemActivated" | |
| 140 | 128 | self.ToggleItem(evt.m_itemIndex) |
| 141 | 129 | |
| 142 | - | |
| 143 | 130 | def OnCheckItem(self, index, flag): |
| 144 | 131 | |
| 145 | 132 | if flag: | ... | ... |
invesalius/gui/task_slice.py
| 1 | + | |
| 1 | 2 | #-------------------------------------------------------------------------- |
| 2 | 3 | # Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas |
| 3 | 4 | # Copyright: (C) 2001 Centro de Pesquisas Renato Archer |
| ... | ... | @@ -286,6 +287,7 @@ class MaskProperties(wx.Panel): |
| 286 | 287 | ps.Publisher().subscribe(self.SetThresholdValues, |
| 287 | 288 | 'Set threshold values in gradient') |
| 288 | 289 | ps.Publisher().subscribe(self.SelectMaskName, 'Select mask name in combo') |
| 290 | + ps.Publisher().subscribe(self.ChangeMaskName, 'Change mask name') | |
| 289 | 291 | |
| 290 | 292 | def __bind_events_wx(self): |
| 291 | 293 | self.combo_thresh.Bind(wx.EVT_COMBOBOX, self.OnComboThresh) |
| ... | ... | @@ -295,6 +297,11 @@ class MaskProperties(wx.Panel): |
| 295 | 297 | def SelectMaskName(self, pubsub_evt): |
| 296 | 298 | index = pubsub_evt.data |
| 297 | 299 | self.combo_mask_name.SetSelection(index) |
| 300 | + | |
| 301 | + def ChangeMaskName(self, pubsub_evt): | |
| 302 | + index, name = pubsub_evt.data | |
| 303 | + self.combo_mask_name.SetString(index, name) | |
| 304 | + self.combo_mask_name.Refresh() | |
| 298 | 305 | |
| 299 | 306 | def SetThresholdValues(self, pubsub_evt): |
| 300 | 307 | thresh_min, thresh_max = pubsub_evt.data | ... | ... |