Fixed an issue that was making Socializer unable to select or unselect audio by pressing space

This commit is contained in:
2021-04-26 10:10:37 -05:00
parent c6fd4c00eb
commit 3013f34c19
2 changed files with 9 additions and 1 deletions

View File

@@ -158,7 +158,14 @@ class multiselectionBaseList(wx.ListCtrl, listmix.CheckListCtrlMixin):
def on_keydown(self, event):
if event.GetKeyCode() == wx.WXK_SPACE:
self.ToggleItem(self.GetFocusedItem())
# In the example of wx multiselection list they call ToggleItem.
# however this didn't worked quite well. So let's implement it manually.
if self.IsChecked(self.GetFocusedItem()):
self.SetItemImage(self.GetFocusedItem(), 0)
self.OnCheckItem(self.GetFocusedItem(), False)
else:
self.SetItemImage(self.GetFocusedItem(), 1)
self.OnCheckItem(self.GetFocusedItem(), True)
event.Skip()
class list(object):