Commit ef93066217e7cf795839e53ea0e431469b66a732
1 parent
a81e4af6
Exists in
master
and in
68 other branches
ADD: Delete key support on data notebook
Showing
1 changed file
with
14 additions
and
1 deletions
Show diff stats
invesalius/gui/data_notebook.py
... | ... | @@ -183,7 +183,9 @@ 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 | + self.Bind(wx.EVT_KEY_UP, self.OnKeyEvent) | |
187 | + | |
188 | + | |
187 | 189 | def __bind_events(self): |
188 | 190 | ps.Publisher().subscribe(self.AddMask, 'Add mask') |
189 | 191 | ps.Publisher().subscribe(self.EditMaskThreshold, |
... | ... | @@ -194,6 +196,17 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
194 | 196 | ps.Publisher().subscribe(self.OnChangeCurrentMask, 'Change mask selected') |
195 | 197 | ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') |
196 | 198 | |
199 | + def OnKeyEvent(self, event): | |
200 | + keycode = event.GetKeyCode() | |
201 | + if (sys.platform == 'darwin') and (keycode == wx.WXK_BACK): | |
202 | + selected = self.GetSelected() | |
203 | + for item in selected: | |
204 | + self.RemoveMask(item) | |
205 | + elif (keycode == wx.WXK_DELETE): | |
206 | + selected = self.GetSelected() | |
207 | + for item in selected: | |
208 | + self.RemoveMask(item) | |
209 | + | |
197 | 210 | |
198 | 211 | def OnCloseProject(self, pubsub_evt): |
199 | 212 | self.DeleteAllItems() | ... | ... |