diff -r 750eeb7230a1 -r c02818d7e29f controls/CustomEditableListBox.py --- a/controls/CustomEditableListBox.py Mon Aug 14 22:23:17 2017 +0300 +++ b/controls/CustomEditableListBox.py Mon Aug 14 22:30:41 2017 +0300 @@ -26,15 +26,15 @@ import wx.gizmos class CustomEditableListBox(wx.gizmos.EditableListBox): - + def __init__(self, *args, **kwargs): wx.gizmos.EditableListBox.__init__(self, *args, **kwargs) - + listbox = self.GetListCtrl() listbox.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) listbox.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.OnLabelBeginEdit) listbox.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnLabelEndEdit) - + for button, tooltip, call_function in [ (self.GetEditButton(), _("Edit item"), "_OnEditButton"), (self.GetNewButton(), _("New item"), "_OnNewButton"), @@ -43,13 +43,13 @@ (self.GetDownButton(), _("Move down"), "_OnDownButton")]: button.SetToolTipString(tooltip) button.Bind(wx.EVT_BUTTON, self.GetButtonPressedFunction(call_function)) - + self.Editing = False - + def EnsureCurrentItemVisible(self): listctrl = self.GetListCtrl() listctrl.EnsureVisible(listctrl.GetFocusedItem()) - + def OnLabelBeginEdit(self, event): self.Editing = True func = getattr(self, "_OnLabelBeginEdit", None) @@ -57,7 +57,7 @@ func(event) else: event.Skip() - + def OnLabelEndEdit(self, event): self.Editing = False func = getattr(self, "_OnLabelEndEdit", None) @@ -65,7 +65,7 @@ func(event) else: event.Skip() - + def GetButtonPressedFunction(self, call_function): def OnButtonPressed(event): if wx.Platform != '__WXMSW__' or not self.Editing: @@ -77,7 +77,7 @@ wx.CallAfter(self.EnsureCurrentItemVisible) event.Skip() return OnButtonPressed - + def OnKeyDown(self, event): button = None keycode = event.GetKeyCode()