--- a/dialogs/ArrayTypeDialog.py Wed Oct 12 23:47:48 2011 +0200
+++ b/dialogs/ArrayTypeDialog.py Fri Oct 14 19:26:29 2011 +0200
@@ -25,7 +25,8 @@
from types import TupleType
import wx
-import wx.gizmos
+
+from controls import CustomEditableListBox
DIMENSION_MODEL = re.compile("([0-9]+)\.\.([0-9]+)$")
@@ -80,22 +81,13 @@
name='BaseType', parent=self, pos=wx.Point(0, 0),
size=wx.Size(0, 28), style=wx.CB_READONLY)
- self.Dimensions = wx.gizmos.EditableListBox(id=ID_ARRAYTYPEDIALOGDIMENSIONS,
+ self.Dimensions = CustomEditableListBox(id=ID_ARRAYTYPEDIALOGDIMENSIONS,
name='ArrayDimensions', parent=self, label=_("Dimensions:"), pos=wx.Point(0, 0),
size=wx.Size(0, 24), style=wx.gizmos.EL_ALLOW_NEW | wx.gizmos.EL_ALLOW_EDIT | wx.gizmos.EL_ALLOW_DELETE)
- self.Dimensions.GetListCtrl().Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnDimensionsChanged)
- new_button = self.Dimensions.GetNewButton()
- new_button.SetToolTipString(_("New item"))
- new_button.Bind(wx.EVT_BUTTON, self.OnDimensionsChanged)
- del_button = self.Dimensions.GetDelButton()
- del_button.SetToolTipString(_("Delete item"))
- del_button.Bind(wx.EVT_BUTTON, self.OnDimensionsChanged)
- up_button = self.Dimensions.GetUpButton()
- up_button.SetToolTipString(_("Move up"))
- up_button.Bind(wx.EVT_BUTTON, self.OnDimensionsChanged)
- down_button = self.Dimensions.GetDownButton()
- down_button.SetToolTipString(_("Move down"))
- down_button.Bind(wx.EVT_BUTTON, self.OnDimensionsChanged)
+ list_ctrl = self.Dimensions.GetListCtrl()
+ list_ctrl.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnDimensionsChanged)
+ for func in ["_OnAddButton", "_OnDelButton", "_OnUpButton", "_OnDownButton"]:
+ setattr(self.Dimensions, func, self.OnDimensionsChanged)
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
if wx.VERSION >= (2, 5, 0):
@@ -117,6 +109,8 @@
elif infos in datatypes:
self.BaseType.SetStringSelection(infos)
+ self.BaseType.SetFocus()
+
def GetDimensions(self):
dimensions_list = []
for dimensions in self.Dimensions.GetStrings():
@@ -144,4 +138,4 @@
self.EndModal(wx.ID_OK)
def GetValue(self):
- return "array", self.BaseType.GetStringSelection(), self.GetDimensions()
\ No newline at end of file
+ return "array", self.BaseType.GetStringSelection(), self.GetDimensions()