23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
24 |
25 |
25 |
26 from __future__ import absolute_import |
26 from __future__ import absolute_import |
27 import wx |
27 import wx |
28 import wx.gizmos |
28 import wx.adv |
29 |
29 |
30 |
30 |
31 class CustomEditableListBox(wx.gizmos.EditableListBox): |
31 class CustomEditableListBox(wx.adv.EditableListBox): |
32 |
32 |
33 def __init__(self, *args, **kwargs): |
33 def __init__(self, *args, **kwargs): |
34 wx.gizmos.EditableListBox.__init__(self, *args, **kwargs) |
34 wx.adv.EditableListBox.__init__(self, *args, **kwargs) |
35 |
35 |
36 listbox = self.GetListCtrl() |
36 listbox = self.GetListCtrl() |
37 listbox.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) |
37 listbox.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) |
38 listbox.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.OnLabelBeginEdit) |
38 listbox.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.OnLabelBeginEdit) |
39 listbox.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnLabelEndEdit) |
39 listbox.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnLabelEndEdit) |
42 (self.GetEditButton(), _("Edit item"), "_OnEditButton"), |
42 (self.GetEditButton(), _("Edit item"), "_OnEditButton"), |
43 (self.GetNewButton(), _("New item"), "_OnNewButton"), |
43 (self.GetNewButton(), _("New item"), "_OnNewButton"), |
44 (self.GetDelButton(), _("Delete item"), "_OnDelButton"), |
44 (self.GetDelButton(), _("Delete item"), "_OnDelButton"), |
45 (self.GetUpButton(), _("Move up"), "_OnUpButton"), |
45 (self.GetUpButton(), _("Move up"), "_OnUpButton"), |
46 (self.GetDownButton(), _("Move down"), "_OnDownButton")]: |
46 (self.GetDownButton(), _("Move down"), "_OnDownButton")]: |
47 button.SetToolTipString(tooltip) |
47 button.SetToolTip(tooltip) |
48 button.Bind(wx.EVT_BUTTON, self.GetButtonPressedFunction(call_function)) |
48 button.Bind(wx.EVT_BUTTON, self.GetButtonPressedFunction(call_function)) |
49 |
49 |
50 self.Editing = False |
50 self.Editing = False |
51 |
51 |
52 def EnsureCurrentItemVisible(self): |
52 def EnsureCurrentItemVisible(self): |